Change build setup of JS clients, reintroduce beta publishing after losing it due to unmerged code (#238)

This commit is contained in:
Janos Dobronszki
2021-10-22 09:49:47 +01:00
committed by GitHub
parent 7cc2a86d0f
commit 293d5ecdde
140 changed files with 13946 additions and 643 deletions

View File

@@ -1,12 +1,12 @@
import * as address from "m3o/address";
const { AddressService } = require("m3o/address");
// Lookup a list of UK addresses by postcode
async function LookupPostcode() {
let addressService = new address.AddressService(process.env.MICRO_API_TOKEN);
async function lookupPostcode() {
let addressService = new AddressService(process.env.MICRO_API_TOKEN);
let rsp = await addressService.lookupPostcode({
postcode: "SW1A 2AA",
});
console.log(rsp);
}
await LookupPostcode();
lookupPostcode();

View File

@@ -1,12 +1,12 @@
import * as answer from "m3o/answer";
const { AnswerService } = require("m3o/answer");
// Ask a question and receive an instant answer
async function AskAquestion() {
let answerService = new answer.AnswerService(process.env.MICRO_API_TOKEN);
async function askAquestion() {
let answerService = new AnswerService(process.env.MICRO_API_TOKEN);
let rsp = await answerService.question({
query: "microsoft",
});
console.log(rsp);
}
await AskAquestion();
askAquestion();

View File

@@ -1,8 +1,8 @@
import * as cache from "m3o/cache";
const { CacheService } = require("m3o/cache");
// Decrement a value (if it's a number)
async function DecrementAvalue() {
let cacheService = new cache.CacheService(process.env.MICRO_API_TOKEN);
async function decrementAvalue() {
let cacheService = new CacheService(process.env.MICRO_API_TOKEN);
let rsp = await cacheService.decrement({
key: "counter",
value: 2,
@@ -10,4 +10,4 @@ async function DecrementAvalue() {
console.log(rsp);
}
await DecrementAvalue();
decrementAvalue();

View File

@@ -1,12 +1,12 @@
import * as cache from "m3o/cache";
const { CacheService } = require("m3o/cache");
// Delete a value from the cache
async function DeleteAvalue() {
let cacheService = new cache.CacheService(process.env.MICRO_API_TOKEN);
async function deleteAvalue() {
let cacheService = new CacheService(process.env.MICRO_API_TOKEN);
let rsp = await cacheService.delete({
key: "foo",
});
console.log(rsp);
}
await DeleteAvalue();
deleteAvalue();

View File

@@ -1,12 +1,12 @@
import * as cache from "m3o/cache";
const { CacheService } = require("m3o/cache");
// Get an item from the cache by key
async function GetAvalue() {
let cacheService = new cache.CacheService(process.env.MICRO_API_TOKEN);
async function getAvalue() {
let cacheService = new CacheService(process.env.MICRO_API_TOKEN);
let rsp = await cacheService.get({
key: "foo",
});
console.log(rsp);
}
await GetAvalue();
getAvalue();

View File

@@ -1,8 +1,8 @@
import * as cache from "m3o/cache";
const { CacheService } = require("m3o/cache");
// Increment a value (if it's a number)
async function IncrementAvalue() {
let cacheService = new cache.CacheService(process.env.MICRO_API_TOKEN);
async function incrementAvalue() {
let cacheService = new CacheService(process.env.MICRO_API_TOKEN);
let rsp = await cacheService.increment({
key: "counter",
value: 2,
@@ -10,4 +10,4 @@ async function IncrementAvalue() {
console.log(rsp);
}
await IncrementAvalue();
incrementAvalue();

View File

@@ -1,8 +1,8 @@
import * as cache from "m3o/cache";
const { CacheService } = require("m3o/cache");
// Set an item in the cache. Overwrites any existing value already set.
async function SetAvalue() {
let cacheService = new cache.CacheService(process.env.MICRO_API_TOKEN);
async function setAvalue() {
let cacheService = new CacheService(process.env.MICRO_API_TOKEN);
let rsp = await cacheService.set({
key: "foo",
value: "bar",
@@ -10,4 +10,4 @@ async function SetAvalue() {
console.log(rsp);
}
await SetAvalue();
setAvalue();

View File

@@ -1,12 +1,12 @@
import * as crypto from "m3o/crypto";
const { CryptoService } = require("m3o/crypto");
// Returns the history for the previous close
async function GetPreviousClose() {
let cryptoService = new crypto.CryptoService(process.env.MICRO_API_TOKEN);
async function getPreviousClose() {
let cryptoService = new CryptoService(process.env.MICRO_API_TOKEN);
let rsp = await cryptoService.history({
symbol: "BTCUSD",
});
console.log(rsp);
}
await GetPreviousClose();
getPreviousClose();

View File

@@ -1,12 +1,12 @@
import * as crypto from "m3o/crypto";
const { CryptoService } = require("m3o/crypto");
// Get news related to a currency
async function GetCryptocurrencyNews() {
let cryptoService = new crypto.CryptoService(process.env.MICRO_API_TOKEN);
async function getCryptocurrencyNews() {
let cryptoService = new CryptoService(process.env.MICRO_API_TOKEN);
let rsp = await cryptoService.news({
symbol: "BTCUSD",
});
console.log(rsp);
}
await GetCryptocurrencyNews();
getCryptocurrencyNews();

View File

@@ -1,12 +1,12 @@
import * as crypto from "m3o/crypto";
const { CryptoService } = require("m3o/crypto");
// Get the last price for a given crypto ticker
async function GetCryptocurrencyPrice() {
let cryptoService = new crypto.CryptoService(process.env.MICRO_API_TOKEN);
async function getCryptocurrencyPrice() {
let cryptoService = new CryptoService(process.env.MICRO_API_TOKEN);
let rsp = await cryptoService.price({
symbol: "BTCUSD",
});
console.log(rsp);
}
await GetCryptocurrencyPrice();
getCryptocurrencyPrice();

View File

@@ -1,12 +1,12 @@
import * as crypto from "m3o/crypto";
const { CryptoService } = require("m3o/crypto");
// Get the last quote for a given crypto ticker
async function GetAcryptocurrencyQuote() {
let cryptoService = new crypto.CryptoService(process.env.MICRO_API_TOKEN);
async function getAcryptocurrencyQuote() {
let cryptoService = new CryptoService(process.env.MICRO_API_TOKEN);
let rsp = await cryptoService.quote({
symbol: "BTCUSD",
});
console.log(rsp);
}
await GetAcryptocurrencyQuote();
getAcryptocurrencyQuote();

View File

@@ -1,12 +1,10 @@
import * as currency from "m3o/currency";
const { CurrencyService } = require("m3o/currency");
// Codes returns the supported currency codes for the API
async function GetSupportedCodes() {
let currencyService = new currency.CurrencyService(
process.env.MICRO_API_TOKEN
);
async function getSupportedCodes() {
let currencyService = new CurrencyService(process.env.MICRO_API_TOKEN);
let rsp = await currencyService.codes({});
console.log(rsp);
}
await GetSupportedCodes();
getSupportedCodes();

View File

@@ -1,10 +1,8 @@
import * as currency from "m3o/currency";
const { CurrencyService } = require("m3o/currency");
// Convert returns the currency conversion rate between two pairs e.g USD/GBP
async function Convert10usdToGbp() {
let currencyService = new currency.CurrencyService(
process.env.MICRO_API_TOKEN
);
async function convert10usdToGbp() {
let currencyService = new CurrencyService(process.env.MICRO_API_TOKEN);
let rsp = await currencyService.convert({
amount: 10,
from: "USD",
@@ -13,4 +11,4 @@ async function Convert10usdToGbp() {
console.log(rsp);
}
await Convert10usdToGbp();
convert10usdToGbp();

View File

@@ -1,10 +1,8 @@
import * as currency from "m3o/currency";
const { CurrencyService } = require("m3o/currency");
// Convert returns the currency conversion rate between two pairs e.g USD/GBP
async function ConvertUsdToGbp() {
let currencyService = new currency.CurrencyService(
process.env.MICRO_API_TOKEN
);
async function convertUsdToGbp() {
let currencyService = new CurrencyService(process.env.MICRO_API_TOKEN);
let rsp = await currencyService.convert({
from: "USD",
to: "GBP",
@@ -12,4 +10,4 @@ async function ConvertUsdToGbp() {
console.log(rsp);
}
await ConvertUsdToGbp();
convertUsdToGbp();

View File

@@ -1,10 +1,8 @@
import * as currency from "m3o/currency";
const { CurrencyService } = require("m3o/currency");
// Returns the historic rates for a currency on a given date
async function HistoricRatesForAcurrency() {
let currencyService = new currency.CurrencyService(
process.env.MICRO_API_TOKEN
);
async function historicRatesForAcurrency() {
let currencyService = new CurrencyService(process.env.MICRO_API_TOKEN);
let rsp = await currencyService.history({
code: "USD",
date: "2021-05-30",
@@ -12,4 +10,4 @@ async function HistoricRatesForAcurrency() {
console.log(rsp);
}
await HistoricRatesForAcurrency();
historicRatesForAcurrency();

View File

@@ -1,14 +1,12 @@
import * as currency from "m3o/currency";
const { CurrencyService } = require("m3o/currency");
// Rates returns the currency rates for a given code e.g USD
async function GetRatesForUsd() {
let currencyService = new currency.CurrencyService(
process.env.MICRO_API_TOKEN
);
async function getRatesForUsd() {
let currencyService = new CurrencyService(process.env.MICRO_API_TOKEN);
let rsp = await currencyService.rates({
code: "USD",
});
console.log(rsp);
}
await GetRatesForUsd();
getRatesForUsd();

View File

@@ -1,12 +1,12 @@
import * as db from "m3o/db";
const { DbService } = require("m3o/db");
// Count records in a table
async function CountEntriesInAtable() {
let dbService = new db.DbService(process.env.MICRO_API_TOKEN);
async function countEntriesInAtable() {
let dbService = new DbService(process.env.MICRO_API_TOKEN);
let rsp = await dbService.count({
table: "users",
});
console.log(rsp);
}
await CountEntriesInAtable();
countEntriesInAtable();

View File

@@ -1,8 +1,8 @@
import * as db from "m3o/db";
const { DbService } = require("m3o/db");
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
async function CreateArecord() {
let dbService = new db.DbService(process.env.MICRO_API_TOKEN);
async function createArecord() {
let dbService = new DbService(process.env.MICRO_API_TOKEN);
let rsp = await dbService.create({
record: {
age: 42,
@@ -15,4 +15,4 @@ async function CreateArecord() {
console.log(rsp);
}
await CreateArecord();
createArecord();

View File

@@ -1,8 +1,8 @@
import * as db from "m3o/db";
const { DbService } = require("m3o/db");
// Delete a record in the database by id.
async function DeleteArecord() {
let dbService = new db.DbService(process.env.MICRO_API_TOKEN);
async function deleteArecord() {
let dbService = new DbService(process.env.MICRO_API_TOKEN);
let rsp = await dbService.delete({
id: "1",
table: "users",
@@ -10,4 +10,4 @@ async function DeleteArecord() {
console.log(rsp);
}
await DeleteArecord();
deleteArecord();

View File

@@ -1,8 +1,8 @@
import * as db from "m3o/db";
const { DbService } = require("m3o/db");
// Read data from a table. Lookup can be by ID or via querying any field in the record.
async function ReadRecords() {
let dbService = new db.DbService(process.env.MICRO_API_TOKEN);
async function readRecords() {
let dbService = new DbService(process.env.MICRO_API_TOKEN);
let rsp = await dbService.read({
query: "age == 43",
table: "users",
@@ -10,4 +10,4 @@ async function ReadRecords() {
console.log(rsp);
}
await ReadRecords();
readRecords();

View File

@@ -1,12 +1,12 @@
import * as db from "m3o/db";
const { DbService } = require("m3o/db");
// Truncate the records in a table
async function TruncateTable() {
let dbService = new db.DbService(process.env.MICRO_API_TOKEN);
async function truncateTable() {
let dbService = new DbService(process.env.MICRO_API_TOKEN);
let rsp = await dbService.truncate({
table: "users",
});
console.log(rsp);
}
await TruncateTable();
truncateTable();

View File

@@ -1,8 +1,8 @@
import * as db from "m3o/db";
const { DbService } = require("m3o/db");
// Update a record in the database. Include an "id" in the record to update.
async function UpdateArecord() {
let dbService = new db.DbService(process.env.MICRO_API_TOKEN);
async function updateArecord() {
let dbService = new DbService(process.env.MICRO_API_TOKEN);
let rsp = await dbService.update({
record: {
age: 43,
@@ -13,4 +13,4 @@ async function UpdateArecord() {
console.log(rsp);
}
await UpdateArecord();
updateArecord();

View File

@@ -1,8 +1,8 @@
import * as email from "m3o/email";
const { EmailService } = require("m3o/email");
// Send an email by passing in from, to, subject, and a text or html body
async function SendEmail() {
let emailService = new email.EmailService(process.env.MICRO_API_TOKEN);
async function sendEmail() {
let emailService = new EmailService(process.env.MICRO_API_TOKEN);
let rsp = await emailService.send({
from: "Awesome Dot Com",
subject: "Email verification",
@@ -12,4 +12,4 @@ async function SendEmail() {
console.log(rsp);
}
await SendEmail();
sendEmail();

View File

@@ -1,12 +1,12 @@
import * as emoji from "m3o/emoji";
const { EmojiService } = require("m3o/emoji");
// Find an emoji by its alias e.g :beer:
async function FindEmoji() {
let emojiService = new emoji.EmojiService(process.env.MICRO_API_TOKEN);
async function findEmoji() {
let emojiService = new EmojiService(process.env.MICRO_API_TOKEN);
let rsp = await emojiService.find({
alias: ":beer:",
});
console.log(rsp);
}
await FindEmoji();
findEmoji();

View File

@@ -1,12 +1,12 @@
import * as emoji from "m3o/emoji";
const { EmojiService } = require("m3o/emoji");
// Get the flag for a country. Requires country code e.g GB for great britain
async function GetFlagByCountryCode() {
let emojiService = new emoji.EmojiService(process.env.MICRO_API_TOKEN);
async function getFlagByCountryCode() {
let emojiService = new EmojiService(process.env.MICRO_API_TOKEN);
let rsp = await emojiService.flag({
alias: "GB",
});
console.log(rsp);
}
await GetFlagByCountryCode();
getFlagByCountryCode();

View File

@@ -1,13 +1,13 @@
import * as emoji from "m3o/emoji";
const { EmojiService } = require("m3o/emoji");
// Print text and renders the emojis with aliases e.g
// let's grab a :beer: becomes let's grab a 🍺
async function PrintTextIncludingEmoji() {
let emojiService = new emoji.EmojiService(process.env.MICRO_API_TOKEN);
async function printTextIncludingEmoji() {
let emojiService = new EmojiService(process.env.MICRO_API_TOKEN);
let rsp = await emojiService.print({
text: "let's grab a :beer:",
});
console.log(rsp);
}
await PrintTextIncludingEmoji();
printTextIncludingEmoji();

View File

@@ -1,8 +1,8 @@
import * as emoji from "m3o/emoji";
const { EmojiService } = require("m3o/emoji");
// Send an emoji to anyone via SMS. Messages are sent in the form '<message> Sent from <from>'
async function SendAtextContainingAnEmojiToAnyoneViaSms() {
let emojiService = new emoji.EmojiService(process.env.MICRO_API_TOKEN);
async function sendAtextContainingAnEmojiToAnyoneViaSms() {
let emojiService = new EmojiService(process.env.MICRO_API_TOKEN);
let rsp = await emojiService.send({
from: "Alice",
message: "let's grab a :beer:",
@@ -11,4 +11,4 @@ async function SendAtextContainingAnEmojiToAnyoneViaSms() {
console.log(rsp);
}
await SendAtextContainingAnEmojiToAnyoneViaSms();
sendAtextContainingAnEmojiToAnyoneViaSms();

View File

@@ -1,12 +1,10 @@
import * as evchargers from "m3o/evchargers";
const { EvchargersService } = require("m3o/evchargers");
// Retrieve reference data as used by this API and in conjunction with the Search endpoint
async function GetReferenceData() {
let evchargersService = new evchargers.EvchargersService(
process.env.MICRO_API_TOKEN
);
async function getReferenceData() {
let evchargersService = new EvchargersService(process.env.MICRO_API_TOKEN);
let rsp = await evchargersService.referenceData({});
console.log(rsp);
}
await GetReferenceData();
getReferenceData();

View File

@@ -1,10 +1,8 @@
import * as evchargers from "m3o/evchargers";
const { EvchargersService } = require("m3o/evchargers");
// Search by giving a coordinate and a max distance, or bounding box and optional filters
async function SearchByBoundingBox() {
let evchargersService = new evchargers.EvchargersService(
process.env.MICRO_API_TOKEN
);
async function searchByBoundingBox() {
let evchargersService = new EvchargersService(process.env.MICRO_API_TOKEN);
let rsp = await evchargersService.search({
box: {
bottom_left: {
@@ -21,4 +19,4 @@ async function SearchByBoundingBox() {
console.log(rsp);
}
await SearchByBoundingBox();
searchByBoundingBox();

View File

@@ -1,10 +1,8 @@
import * as evchargers from "m3o/evchargers";
const { EvchargersService } = require("m3o/evchargers");
// Search by giving a coordinate and a max distance, or bounding box and optional filters
async function SearchByLocation() {
let evchargersService = new evchargers.EvchargersService(
process.env.MICRO_API_TOKEN
);
async function searchByLocation() {
let evchargersService = new EvchargersService(process.env.MICRO_API_TOKEN);
let rsp = await evchargersService.search({
distance: 2000,
location: {
@@ -16,4 +14,4 @@ async function SearchByLocation() {
console.log(rsp);
}
await SearchByLocation();
searchByLocation();

View File

@@ -1,10 +1,8 @@
import * as evchargers from "m3o/evchargers";
const { EvchargersService } = require("m3o/evchargers");
// Search by giving a coordinate and a max distance, or bounding box and optional filters
async function SearchWithFiltersFastChargersOnly() {
let evchargersService = new evchargers.EvchargersService(
process.env.MICRO_API_TOKEN
);
async function searchWithFiltersFastChargersOnly() {
let evchargersService = new EvchargersService(process.env.MICRO_API_TOKEN);
let rsp = await evchargersService.search({
distance: 2000,
levels: ["3"],
@@ -17,4 +15,4 @@ async function SearchWithFiltersFastChargersOnly() {
console.log(rsp);
}
await SearchWithFiltersFastChargersOnly();
searchWithFiltersFastChargersOnly();

View File

@@ -1,8 +1,8 @@
import * as file from "m3o/file";
const { FileService } = require("m3o/file");
// Delete a file by project name/path
async function DeleteFile() {
let fileService = new file.FileService(process.env.MICRO_API_TOKEN);
async function deleteFile() {
let fileService = new FileService(process.env.MICRO_API_TOKEN);
let rsp = await fileService.delete({
path: "/document/text-files/file.txt",
project: "examples",
@@ -10,4 +10,4 @@ async function DeleteFile() {
console.log(rsp);
}
await DeleteFile();
deleteFile();

View File

@@ -1,12 +1,12 @@
import * as file from "m3o/file";
const { FileService } = require("m3o/file");
// List files by their project and optionally a path.
async function ListFiles() {
let fileService = new file.FileService(process.env.MICRO_API_TOKEN);
async function listFiles() {
let fileService = new FileService(process.env.MICRO_API_TOKEN);
let rsp = await fileService.list({
project: "examples",
});
console.log(rsp);
}
await ListFiles();
listFiles();

View File

@@ -1,8 +1,8 @@
import * as file from "m3o/file";
const { FileService } = require("m3o/file");
// Read a file by path
async function ReadFile() {
let fileService = new file.FileService(process.env.MICRO_API_TOKEN);
async function readFile() {
let fileService = new FileService(process.env.MICRO_API_TOKEN);
let rsp = await fileService.read({
path: "/document/text-files/file.txt",
project: "examples",
@@ -10,4 +10,4 @@ async function ReadFile() {
console.log(rsp);
}
await ReadFile();
readFile();

View File

@@ -1,8 +1,8 @@
import * as file from "m3o/file";
const { FileService } = require("m3o/file");
// Save a file
async function SaveFile() {
let fileService = new file.FileService(process.env.MICRO_API_TOKEN);
async function saveFile() {
let fileService = new FileService(process.env.MICRO_API_TOKEN);
let rsp = await fileService.save({
file: {
content: "file content example",
@@ -13,4 +13,4 @@ async function SaveFile() {
console.log(rsp);
}
await SaveFile();
saveFile();

View File

@@ -1,12 +1,12 @@
import * as forex from "m3o/forex";
const { ForexService } = require("m3o/forex");
// Returns the data for the previous close
async function GetPreviousClose() {
let forexService = new forex.ForexService(process.env.MICRO_API_TOKEN);
async function getPreviousClose() {
let forexService = new ForexService(process.env.MICRO_API_TOKEN);
let rsp = await forexService.history({
symbol: "GBPUSD",
});
console.log(rsp);
}
await GetPreviousClose();
getPreviousClose();

View File

@@ -1,12 +1,12 @@
import * as forex from "m3o/forex";
const { ForexService } = require("m3o/forex");
// Get the latest price for a given forex ticker
async function GetAnFxPrice() {
let forexService = new forex.ForexService(process.env.MICRO_API_TOKEN);
async function getAnFxPrice() {
let forexService = new ForexService(process.env.MICRO_API_TOKEN);
let rsp = await forexService.price({
symbol: "GBPUSD",
});
console.log(rsp);
}
await GetAnFxPrice();
getAnFxPrice();

View File

@@ -1,12 +1,12 @@
import * as forex from "m3o/forex";
const { ForexService } = require("m3o/forex");
// Get the latest quote for the forex
async function GetAfxQuote() {
let forexService = new forex.ForexService(process.env.MICRO_API_TOKEN);
async function getAfxQuote() {
let forexService = new ForexService(process.env.MICRO_API_TOKEN);
let rsp = await forexService.quote({
symbol: "GBPUSD",
});
console.log(rsp);
}
await GetAfxQuote();
getAfxQuote();

View File

@@ -1,8 +1,8 @@
import * as fx from "m3o/function";
const { FunctionService } = require("m3o/function");
// Call a function by name
async function CallAfunction() {
let functionService = new fx.FunctionService(process.env.MICRO_API_TOKEN);
async function callAfunction() {
let functionService = new FunctionService(process.env.MICRO_API_TOKEN);
let rsp = await functionService.call({
name: "my-first-func",
request: {},
@@ -10,4 +10,4 @@ async function CallAfunction() {
console.log(rsp);
}
await CallAfunction();
callAfunction();

View File

@@ -1,8 +1,8 @@
import * as fx from "m3o/function";
const { FunctionService } = require("m3o/function");
// Delete a function by name
async function DeleteAfunction() {
let functionService = new fx.FunctionService(process.env.MICRO_API_TOKEN);
async function deleteAfunction() {
let functionService = new FunctionService(process.env.MICRO_API_TOKEN);
let rsp = await functionService.delete({
name: "my-first-func",
project: "tests",
@@ -10,4 +10,4 @@ async function DeleteAfunction() {
console.log(rsp);
}
await DeleteAfunction();
deleteAfunction();

View File

@@ -1,8 +1,8 @@
import * as fx from "m3o/function";
const { FunctionService } = require("m3o/function");
// Deploy a group of functions
async function DeployAfunction() {
let functionService = new fx.FunctionService(process.env.MICRO_API_TOKEN);
async function deployAfunction() {
let functionService = new FunctionService(process.env.MICRO_API_TOKEN);
let rsp = await functionService.deploy({
entrypoint: "helloworld",
name: "my-first-func",
@@ -13,4 +13,4 @@ async function DeployAfunction() {
console.log(rsp);
}
await DeployAfunction();
deployAfunction();

View File

@@ -1,8 +1,8 @@
import * as fx from "m3o/function";
const { FunctionService } = require("m3o/function");
//
async function DescribeFunctionStatus() {
let functionService = new fx.FunctionService(process.env.MICRO_API_TOKEN);
async function describeFunctionStatus() {
let functionService = new FunctionService(process.env.MICRO_API_TOKEN);
let rsp = await functionService.describe({
name: "my-first-func",
project: "tests",
@@ -10,4 +10,4 @@ async function DescribeFunctionStatus() {
console.log(rsp);
}
await DescribeFunctionStatus();
describeFunctionStatus();

View File

@@ -1,10 +1,10 @@
import * as fx from "m3o/function";
const { FunctionService } = require("m3o/function");
// List all the deployed functions
async function ListFunctions() {
let functionService = new fx.FunctionService(process.env.MICRO_API_TOKEN);
async function listFunctions() {
let functionService = new FunctionService(process.env.MICRO_API_TOKEN);
let rsp = await functionService.list({});
console.log(rsp);
}
await ListFunctions();
listFunctions();

View File

@@ -1,10 +1,8 @@
import * as geocoding from "m3o/geocoding";
const { GeocodingService } = require("m3o/geocoding");
// Lookup returns a geocoded address including normalized address and gps coordinates. All fields are optional, provide more to get more accurate results
async function GeocodeAnAddress() {
let geocodingService = new geocoding.GeocodingService(
process.env.MICRO_API_TOKEN
);
async function geocodeAnAddress() {
let geocodingService = new GeocodingService(process.env.MICRO_API_TOKEN);
let rsp = await geocodingService.lookup({
address: "10 russell st",
city: "london",
@@ -14,4 +12,4 @@ async function GeocodeAnAddress() {
console.log(rsp);
}
await GeocodeAnAddress();
geocodeAnAddress();

View File

@@ -1,10 +1,8 @@
import * as geocoding from "m3o/geocoding";
const { GeocodingService } = require("m3o/geocoding");
// Reverse lookup an address from gps coordinates
async function ReverseGeocodeLocation() {
let geocodingService = new geocoding.GeocodingService(
process.env.MICRO_API_TOKEN
);
async function reverseGeocodeLocation() {
let geocodingService = new GeocodingService(process.env.MICRO_API_TOKEN);
let rsp = await geocodingService.reverse({
latitude: 51.5123064,
longitude: -0.1216235,
@@ -12,4 +10,4 @@ async function ReverseGeocodeLocation() {
console.log(rsp);
}
await ReverseGeocodeLocation();
reverseGeocodeLocation();

View File

@@ -1,14 +1,12 @@
import * as helloworld from "m3o/helloworld";
const { HelloworldService } = require("m3o/helloworld");
// Call returns a personalised "Hello $name" response
async function CallTheHelloworldService() {
let helloworldService = new helloworld.HelloworldService(
process.env.MICRO_API_TOKEN
);
async function callTheHelloworldService() {
let helloworldService = new HelloworldService(process.env.MICRO_API_TOKEN);
let rsp = await helloworldService.call({
name: "John",
});
console.log(rsp);
}
await CallTheHelloworldService();
callTheHelloworldService();

View File

@@ -1,14 +1,12 @@
import * as helloworld from "m3o/helloworld";
const { HelloworldService } = require("m3o/helloworld");
// Stream returns a stream of "Hello $name" responses
async function StreamsAreCurrentlyTemporarilyNotSupportedInClients() {
let helloworldService = new helloworld.HelloworldService(
process.env.MICRO_API_TOKEN
);
async function streamsAreCurrentlyTemporarilyNotSupportedInClients() {
let helloworldService = new HelloworldService(process.env.MICRO_API_TOKEN);
let rsp = await helloworldService.stream({
name: "not supported",
});
console.log(rsp);
}
await StreamsAreCurrentlyTemporarilyNotSupportedInClients();
streamsAreCurrentlyTemporarilyNotSupportedInClients();

View File

@@ -1,12 +1,10 @@
import * as holidays from "m3o/holidays";
const { HolidaysService } = require("m3o/holidays");
// Get the list of countries that are supported by this API
async function ListCountries() {
let holidaysService = new holidays.HolidaysService(
process.env.MICRO_API_TOKEN
);
async function listCountries() {
let holidaysService = new HolidaysService(process.env.MICRO_API_TOKEN);
let rsp = await holidaysService.countries({});
console.log(rsp);
}
await ListCountries();
listCountries();

View File

@@ -1,10 +1,8 @@
import * as holidays from "m3o/holidays";
const { HolidaysService } = require("m3o/holidays");
// List the holiday dates for a given country and year
async function GetHolidays() {
let holidaysService = new holidays.HolidaysService(
process.env.MICRO_API_TOKEN
);
async function getHolidays() {
let holidaysService = new HolidaysService(process.env.MICRO_API_TOKEN);
let rsp = await holidaysService.list({
country_code: "GB",
year: 2022,
@@ -12,4 +10,4 @@ async function GetHolidays() {
console.log(rsp);
}
await GetHolidays();
getHolidays();

View File

@@ -1,12 +1,12 @@
import * as id from "m3o/id";
const { IdService } = require("m3o/id");
// Generate a unique ID. Defaults to uuid.
async function GenerateAbigflakeId() {
let idService = new id.IdService(process.env.MICRO_API_TOKEN);
async function generateAbigflakeId() {
let idService = new IdService(process.env.MICRO_API_TOKEN);
let rsp = await idService.generate({
type: "bigflake",
});
console.log(rsp);
}
await GenerateAbigflakeId();
generateAbigflakeId();

View File

@@ -1,12 +1,12 @@
import * as id from "m3o/id";
const { IdService } = require("m3o/id");
// Generate a unique ID. Defaults to uuid.
async function GenerateAshortId() {
let idService = new id.IdService(process.env.MICRO_API_TOKEN);
async function generateAshortId() {
let idService = new IdService(process.env.MICRO_API_TOKEN);
let rsp = await idService.generate({
type: "shortid",
});
console.log(rsp);
}
await GenerateAshortId();
generateAshortId();

View File

@@ -1,12 +1,12 @@
import * as id from "m3o/id";
const { IdService } = require("m3o/id");
// Generate a unique ID. Defaults to uuid.
async function GenerateAsnowflakeId() {
let idService = new id.IdService(process.env.MICRO_API_TOKEN);
async function generateAsnowflakeId() {
let idService = new IdService(process.env.MICRO_API_TOKEN);
let rsp = await idService.generate({
type: "snowflake",
});
console.log(rsp);
}
await GenerateAsnowflakeId();
generateAsnowflakeId();

View File

@@ -1,12 +1,12 @@
import * as id from "m3o/id";
const { IdService } = require("m3o/id");
// Generate a unique ID. Defaults to uuid.
async function GenerateAuniqueId() {
let idService = new id.IdService(process.env.MICRO_API_TOKEN);
async function generateAuniqueId() {
let idService = new IdService(process.env.MICRO_API_TOKEN);
let rsp = await idService.generate({
type: "uuid",
});
console.log(rsp);
}
await GenerateAuniqueId();
generateAuniqueId();

View File

@@ -1,10 +1,10 @@
import * as id from "m3o/id";
const { IdService } = require("m3o/id");
// List the types of IDs available. No query params needed.
async function ListTheTypesOfIdsAvailable() {
let idService = new id.IdService(process.env.MICRO_API_TOKEN);
async function listTheTypesOfIdsAvailable() {
let idService = new IdService(process.env.MICRO_API_TOKEN);
let rsp = await idService.types({});
console.log(rsp);
}
await ListTheTypesOfIdsAvailable();
listTheTypesOfIdsAvailable();

View File

@@ -1,9 +1,9 @@
import * as image from "m3o/image";
const { ImageService } = require("m3o/image");
// Convert an image from one format (jpeg, png etc.) to an other either on the fly (from base64 to base64),
// or by uploading the conversion result.
async function ConvertApngImageToAjpegTakenFromAurlAndSavedToAurlOnMicrosCdn() {
let imageService = new image.ImageService(process.env.MICRO_API_TOKEN);
async function convertApngImageToAjpegTakenFromAurlAndSavedToAurlOnMicrosCdn() {
let imageService = new ImageService(process.env.MICRO_API_TOKEN);
let rsp = await imageService.convert({
name: "cat.jpeg",
outputURL: true,
@@ -12,4 +12,4 @@ async function ConvertApngImageToAjpegTakenFromAurlAndSavedToAurlOnMicrosCdn() {
console.log(rsp);
}
await ConvertApngImageToAjpegTakenFromAurlAndSavedToAurlOnMicrosCdn();
convertApngImageToAjpegTakenFromAurlAndSavedToAurlOnMicrosCdn();

View File

@@ -1,10 +1,10 @@
import * as image from "m3o/image";
const { ImageService } = require("m3o/image");
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
// If one of width or height is 0, the image aspect ratio is preserved.
// Optional cropping.
async function Base64toBase64image() {
let imageService = new image.ImageService(process.env.MICRO_API_TOKEN);
async function base64toBase64image() {
let imageService = new ImageService(process.env.MICRO_API_TOKEN);
let rsp = await imageService.resize({
base64:
"data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
@@ -14,4 +14,4 @@ async function Base64toBase64image() {
console.log(rsp);
}
await Base64toBase64image();
base64toBase64image();

View File

@@ -1,10 +1,10 @@
import * as image from "m3o/image";
const { ImageService } = require("m3o/image");
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
// If one of width or height is 0, the image aspect ratio is preserved.
// Optional cropping.
async function Base64toBase64imageWithCropping() {
let imageService = new image.ImageService(process.env.MICRO_API_TOKEN);
async function base64toBase64imageWithCropping() {
let imageService = new ImageService(process.env.MICRO_API_TOKEN);
let rsp = await imageService.resize({
base64:
"data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
@@ -18,4 +18,4 @@ async function Base64toBase64imageWithCropping() {
console.log(rsp);
}
await Base64toBase64imageWithCropping();
base64toBase64imageWithCropping();

View File

@@ -1,10 +1,10 @@
import * as image from "m3o/image";
const { ImageService } = require("m3o/image");
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
// If one of width or height is 0, the image aspect ratio is preserved.
// Optional cropping.
async function Base64toHostedImage() {
let imageService = new image.ImageService(process.env.MICRO_API_TOKEN);
async function base64toHostedImage() {
let imageService = new ImageService(process.env.MICRO_API_TOKEN);
let rsp = await imageService.resize({
base64:
"data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
@@ -16,4 +16,4 @@ async function Base64toHostedImage() {
console.log(rsp);
}
await Base64toHostedImage();
base64toHostedImage();

View File

@@ -1,9 +1,9 @@
import * as image from "m3o/image";
const { ImageService } = require("m3o/image");
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
// To resize an image before uploading, see the Resize endpoint.
async function UploadAbase64imageToMicrosCdn() {
let imageService = new image.ImageService(process.env.MICRO_API_TOKEN);
async function uploadAbase64imageToMicrosCdn() {
let imageService = new ImageService(process.env.MICRO_API_TOKEN);
let rsp = await imageService.upload({
base64:
"data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAx0lEQVR4nOzaMaoDMQyE4ZHj+x82vVdhwQoTkzKQEcwP5r0ihT7sbjUTeAJ4HCegXQJYfOYefOyjDuBiz3yjwJBoCIl6QZOeUjTC1Ix1IxEJXF9+0KWsf2bD4bn37OO/c/wuQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9Sa/NG94Tf3j4WBdaxudMEkn4IM2rZBA0wBrvo7aOcpj2emXvLeVt0IGm0GVXUj91mvAAAA//+V2CZl+4AKXwAAAABJRU5ErkJggg==",
@@ -13,4 +13,4 @@ async function UploadAbase64imageToMicrosCdn() {
console.log(rsp);
}
await UploadAbase64imageToMicrosCdn();
uploadAbase64imageToMicrosCdn();

View File

@@ -1,9 +1,9 @@
import * as image from "m3o/image";
const { ImageService } = require("m3o/image");
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
// To resize an image before uploading, see the Resize endpoint.
async function UploadAnImageFromAurlToMicrosCdn() {
let imageService = new image.ImageService(process.env.MICRO_API_TOKEN);
async function uploadAnImageFromAurlToMicrosCdn() {
let imageService = new ImageService(process.env.MICRO_API_TOKEN);
let rsp = await imageService.upload({
name: "cat.jpeg",
url: "somewebsite.com/cat.png",
@@ -11,4 +11,4 @@ async function UploadAnImageFromAurlToMicrosCdn() {
console.log(rsp);
}
await UploadAnImageFromAurlToMicrosCdn();
uploadAnImageFromAurlToMicrosCdn();

View File

@@ -1,12 +1,12 @@
import * as ip from "m3o/ip";
const { IpService } = require("m3o/ip");
// Lookup the geolocation information for an IP address
async function LookupIpInfo() {
let ipService = new ip.IpService(process.env.MICRO_API_TOKEN);
async function lookupIpInfo() {
let ipService = new IpService(process.env.MICRO_API_TOKEN);
let rsp = await ipService.lookup({
ip: "93.148.214.31",
});
console.log(rsp);
}
await LookupIpInfo();
lookupIpInfo();

View File

@@ -1,14 +1,12 @@
import * as location from "m3o/location";
const { LocationService } = require("m3o/location");
// Read an entity by its ID
async function GetLocationById() {
let locationService = new location.LocationService(
process.env.MICRO_API_TOKEN
);
async function getLocationById() {
let locationService = new LocationService(process.env.MICRO_API_TOKEN);
let rsp = await locationService.read({
id: "1",
});
console.log(rsp);
}
await GetLocationById();
getLocationById();

View File

@@ -1,10 +1,8 @@
import * as location from "m3o/location";
const { LocationService } = require("m3o/location");
// Save an entity's current position
async function SaveAnEntity() {
let locationService = new location.LocationService(
process.env.MICRO_API_TOKEN
);
async function saveAnEntity() {
let locationService = new LocationService(process.env.MICRO_API_TOKEN);
let rsp = await locationService.save({
entity: {
id: "1",
@@ -19,4 +17,4 @@ async function SaveAnEntity() {
console.log(rsp);
}
await SaveAnEntity();
saveAnEntity();

View File

@@ -1,10 +1,8 @@
import * as location from "m3o/location";
const { LocationService } = require("m3o/location");
// Search for entities in a given radius
async function SearchForLocations() {
let locationService = new location.LocationService(
process.env.MICRO_API_TOKEN
);
async function searchForLocations() {
let locationService = new LocationService(process.env.MICRO_API_TOKEN);
let rsp = await locationService.search({
center: {
latitude: 51.511061,
@@ -17,4 +15,4 @@ async function SearchForLocations() {
console.log(rsp);
}
await SearchForLocations();
searchForLocations();

View File

@@ -1,8 +1,8 @@
import * as notes from "m3o/notes";
const { NotesService } = require("m3o/notes");
// Create a new note
async function CreateAnote() {
let notesService = new notes.NotesService(process.env.MICRO_API_TOKEN);
async function createAnote() {
let notesService = new NotesService(process.env.MICRO_API_TOKEN);
let rsp = await notesService.create({
text: "This is my note",
title: "New Note",
@@ -10,4 +10,4 @@ async function CreateAnote() {
console.log(rsp);
}
await CreateAnote();
createAnote();

View File

@@ -1,12 +1,12 @@
import * as notes from "m3o/notes";
const { NotesService } = require("m3o/notes");
// Delete a note
async function DeleteAnote() {
let notesService = new notes.NotesService(process.env.MICRO_API_TOKEN);
async function deleteAnote() {
let notesService = new NotesService(process.env.MICRO_API_TOKEN);
let rsp = await notesService.delete({
id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
});
console.log(rsp);
}
await DeleteAnote();
deleteAnote();

View File

@@ -1,10 +1,10 @@
import * as notes from "m3o/notes";
const { NotesService } = require("m3o/notes");
// List all the notes
async function ListAllNotes() {
let notesService = new notes.NotesService(process.env.MICRO_API_TOKEN);
async function listAllNotes() {
let notesService = new NotesService(process.env.MICRO_API_TOKEN);
let rsp = await notesService.list({});
console.log(rsp);
}
await ListAllNotes();
listAllNotes();

View File

@@ -1,12 +1,12 @@
import * as notes from "m3o/notes";
const { NotesService } = require("m3o/notes");
// Read a note
async function ReadAnote() {
let notesService = new notes.NotesService(process.env.MICRO_API_TOKEN);
async function readAnote() {
let notesService = new NotesService(process.env.MICRO_API_TOKEN);
let rsp = await notesService.read({
id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
});
console.log(rsp);
}
await ReadAnote();
readAnote();

View File

@@ -1,8 +1,8 @@
import * as notes from "m3o/notes";
const { NotesService } = require("m3o/notes");
// Update a note
async function UpdateAnote() {
let notesService = new notes.NotesService(process.env.MICRO_API_TOKEN);
async function updateAnote() {
let notesService = new NotesService(process.env.MICRO_API_TOKEN);
let rsp = await notesService.update({
note: {
id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
@@ -13,4 +13,4 @@ async function UpdateAnote() {
console.log(rsp);
}
await UpdateAnote();
updateAnote();

View File

@@ -1,12 +1,12 @@
import * as otp from "m3o/otp";
const { OtpService } = require("m3o/otp");
// Generate an OTP (one time pass) code
async function GenerateOtp() {
let otpService = new otp.OtpService(process.env.MICRO_API_TOKEN);
async function generateOtp() {
let otpService = new OtpService(process.env.MICRO_API_TOKEN);
let rsp = await otpService.generate({
id: "asim@example.com",
});
console.log(rsp);
}
await GenerateOtp();
generateOtp();

View File

@@ -1,8 +1,8 @@
import * as otp from "m3o/otp";
const { OtpService } = require("m3o/otp");
// Validate the OTP code
async function ValidateOtp() {
let otpService = new otp.OtpService(process.env.MICRO_API_TOKEN);
async function validateOtp() {
let otpService = new OtpService(process.env.MICRO_API_TOKEN);
let rsp = await otpService.validate({
code: "656211",
id: "asim@example.com",
@@ -10,4 +10,4 @@ async function ValidateOtp() {
console.log(rsp);
}
await ValidateOtp();
validateOtp();

View File

@@ -1,14 +1,12 @@
import * as postcode from "m3o/postcode";
const { PostcodeService } = require("m3o/postcode");
// Lookup a postcode to retrieve the related region, county, etc
async function LookupPostcode() {
let postcodeService = new postcode.PostcodeService(
process.env.MICRO_API_TOKEN
);
async function lookupPostcode() {
let postcodeService = new PostcodeService(process.env.MICRO_API_TOKEN);
let rsp = await postcodeService.lookup({
postcode: "SW1A 2AA",
});
console.log(rsp);
}
await LookupPostcode();
lookupPostcode();

View File

@@ -1,12 +1,10 @@
import * as postcode from "m3o/postcode";
const { PostcodeService } = require("m3o/postcode");
// Return a random postcode and its related info
async function ReturnArandomPostcodeAndItsInformation() {
let postcodeService = new postcode.PostcodeService(
process.env.MICRO_API_TOKEN
);
async function returnArandomPostcodeAndItsInformation() {
let postcodeService = new PostcodeService(process.env.MICRO_API_TOKEN);
let rsp = await postcodeService.random({});
console.log(rsp);
}
await ReturnArandomPostcodeAndItsInformation();
returnArandomPostcodeAndItsInformation();

View File

@@ -1,14 +1,12 @@
import * as postcode from "m3o/postcode";
const { PostcodeService } = require("m3o/postcode");
// Validate a postcode.
async function ReturnArandomPostcodeAndItsInformation() {
let postcodeService = new postcode.PostcodeService(
process.env.MICRO_API_TOKEN
);
async function returnArandomPostcodeAndItsInformation() {
let postcodeService = new PostcodeService(process.env.MICRO_API_TOKEN);
let rsp = await postcodeService.validate({
postcode: "SW1A 2AA",
});
console.log(rsp);
}
await ReturnArandomPostcodeAndItsInformation();
returnArandomPostcodeAndItsInformation();

View File

@@ -1,12 +1,12 @@
import * as prayer from "m3o/prayer";
const { PrayerService } = require("m3o/prayer");
// Get the prayer (salah) times for a location on a given date
async function PrayerTimes() {
let prayerService = new prayer.PrayerService(process.env.MICRO_API_TOKEN);
async function prayerTimes() {
let prayerService = new PrayerService(process.env.MICRO_API_TOKEN);
let rsp = await prayerService.times({
location: "london",
});
console.log(rsp);
}
await PrayerTimes();
prayerTimes();

View File

@@ -1,8 +1,8 @@
import * as qr from "m3o/qr";
const { QrService } = require("m3o/qr");
// Generate a QR code with a specific text and size
async function GenerateAqrCode() {
let qrService = new qr.QrService(process.env.MICRO_API_TOKEN);
async function generateAqrCode() {
let qrService = new QrService(process.env.MICRO_API_TOKEN);
let rsp = await qrService.generate({
size: 300,
text: "https://m3o.com/qr",
@@ -10,4 +10,4 @@ async function GenerateAqrCode() {
console.log(rsp);
}
await GenerateAqrCode();
generateAqrCode();

View File

@@ -1,12 +1,12 @@
import * as quran from "m3o/quran";
const { QuranService } = require("m3o/quran");
// List the Chapters (surahs) of the Quran
async function ListChapters() {
let quranService = new quran.QuranService(process.env.MICRO_API_TOKEN);
async function listChapters() {
let quranService = new QuranService(process.env.MICRO_API_TOKEN);
let rsp = await quranService.chapters({
language: "en",
});
console.log(rsp);
}
await ListChapters();
listChapters();

View File

@@ -1,12 +1,12 @@
import * as quran from "m3o/quran";
const { QuranService } = require("m3o/quran");
// Search the Quran for any form of query or questions
async function SearchTheQuran() {
let quranService = new quran.QuranService(process.env.MICRO_API_TOKEN);
async function searchTheQuran() {
let quranService = new QuranService(process.env.MICRO_API_TOKEN);
let rsp = await quranService.search({
query: "messenger",
});
console.log(rsp);
}
await SearchTheQuran();
searchTheQuran();

View File

@@ -1,12 +1,12 @@
import * as quran from "m3o/quran";
const { QuranService } = require("m3o/quran");
// Get a summary for a given chapter (surah)
async function GetChapterSummary() {
let quranService = new quran.QuranService(process.env.MICRO_API_TOKEN);
async function getChapterSummary() {
let quranService = new QuranService(process.env.MICRO_API_TOKEN);
let rsp = await quranService.summary({
chapter: 1,
});
console.log(rsp);
}
await GetChapterSummary();
getChapterSummary();

View File

@@ -1,14 +1,14 @@
import * as quran from "m3o/quran";
const { QuranService } = require("m3o/quran");
// Lookup the verses (ayahs) for a chapter including
// translation, interpretation and breakdown by individual
// words.
async function GetVersesOfAchapter() {
let quranService = new quran.QuranService(process.env.MICRO_API_TOKEN);
async function getVersesOfAchapter() {
let quranService = new QuranService(process.env.MICRO_API_TOKEN);
let rsp = await quranService.verses({
chapter: 1,
});
console.log(rsp);
}
await GetVersesOfAchapter();
getVersesOfAchapter();

View File

@@ -1,8 +1,8 @@
import * as routing from "m3o/routing";
const { RoutingService } = require("m3o/routing");
// Turn by turn directions from a start point to an end point including maneuvers and bearings
async function TurnByTurnDirections() {
let routingService = new routing.RoutingService(process.env.MICRO_API_TOKEN);
async function turnByTurnDirections() {
let routingService = new RoutingService(process.env.MICRO_API_TOKEN);
let rsp = await routingService.directions({
destination: {
latitude: 52.529407,
@@ -16,4 +16,4 @@ async function TurnByTurnDirections() {
console.log(rsp);
}
await TurnByTurnDirections();
turnByTurnDirections();

View File

@@ -1,8 +1,8 @@
import * as routing from "m3o/routing";
const { RoutingService } = require("m3o/routing");
// Get the eta for a route from origin to destination. The eta is an estimated time based on car routes
async function EtaFromPointAtoPointB() {
let routingService = new routing.RoutingService(process.env.MICRO_API_TOKEN);
async function etaFromPointAtoPointB() {
let routingService = new RoutingService(process.env.MICRO_API_TOKEN);
let rsp = await routingService.eta({
destination: {
latitude: 52.529407,
@@ -16,4 +16,4 @@ async function EtaFromPointAtoPointB() {
console.log(rsp);
}
await EtaFromPointAtoPointB();
etaFromPointAtoPointB();

View File

@@ -1,8 +1,8 @@
import * as routing from "m3o/routing";
const { RoutingService } = require("m3o/routing");
// Retrieve a route as a simple list of gps points along with total distance and estimated duration
async function GpsPointsForAroute() {
let routingService = new routing.RoutingService(process.env.MICRO_API_TOKEN);
async function gpsPointsForAroute() {
let routingService = new RoutingService(process.env.MICRO_API_TOKEN);
let rsp = await routingService.route({
destination: {
latitude: 52.529407,
@@ -16,4 +16,4 @@ async function GpsPointsForAroute() {
console.log(rsp);
}
await GpsPointsForAroute();
gpsPointsForAroute();

View File

@@ -1,8 +1,8 @@
import * as rss from "m3o/rss";
const { RssService } = require("m3o/rss");
// Add a new RSS feed with a name, url, and category
async function AddAnewFeed() {
let rssService = new rss.RssService(process.env.MICRO_API_TOKEN);
async function addAnewFeed() {
let rssService = new RssService(process.env.MICRO_API_TOKEN);
let rsp = await rssService.add({
category: "news",
name: "bbc",
@@ -11,4 +11,4 @@ async function AddAnewFeed() {
console.log(rsp);
}
await AddAnewFeed();
addAnewFeed();

View File

@@ -1,12 +1,12 @@
import * as rss from "m3o/rss";
const { RssService } = require("m3o/rss");
// Get an RSS feed by name. If no name is given, all feeds are returned. Default limit is 25 entries.
async function ReadAfeed() {
let rssService = new rss.RssService(process.env.MICRO_API_TOKEN);
async function readAfeed() {
let rssService = new RssService(process.env.MICRO_API_TOKEN);
let rsp = await rssService.feed({
name: "bbc",
});
console.log(rsp);
}
await ReadAfeed();
readAfeed();

View File

@@ -1,10 +1,10 @@
import * as rss from "m3o/rss";
const { RssService } = require("m3o/rss");
// List the saved RSS fields
async function ListRssFeeds() {
let rssService = new rss.RssService(process.env.MICRO_API_TOKEN);
async function listRssFeeds() {
let rssService = new RssService(process.env.MICRO_API_TOKEN);
let rsp = await rssService.list({});
console.log(rsp);
}
await ListRssFeeds();
listRssFeeds();

View File

@@ -1,12 +1,12 @@
import * as rss from "m3o/rss";
const { RssService } = require("m3o/rss");
// Remove an RSS feed by name
async function RemoveAfeed() {
let rssService = new rss.RssService(process.env.MICRO_API_TOKEN);
async function removeAfeed() {
let rssService = new RssService(process.env.MICRO_API_TOKEN);
let rsp = await rssService.remove({
name: "bbc",
});
console.log(rsp);
}
await RemoveAfeed();
removeAfeed();

View File

@@ -1,14 +1,12 @@
import * as sentiment from "m3o/sentiment";
const { SentimentService } = require("m3o/sentiment");
// Analyze and score a piece of text
async function AnalyzeApieceOfText() {
let sentimentService = new sentiment.SentimentService(
process.env.MICRO_API_TOKEN
);
async function analyzeApieceOfText() {
let sentimentService = new SentimentService(process.env.MICRO_API_TOKEN);
let rsp = await sentimentService.analyze({
text: "this is amazing",
});
console.log(rsp);
}
await AnalyzeApieceOfText();
analyzeApieceOfText();

View File

@@ -1,8 +1,8 @@
import * as sms from "m3o/sms";
const { SmsService } = require("m3o/sms");
// Send an SMS.
async function SendSms() {
let smsService = new sms.SmsService(process.env.MICRO_API_TOKEN);
async function sendSms() {
let smsService = new SmsService(process.env.MICRO_API_TOKEN);
let rsp = await smsService.send({
from: "Alice",
message: "Hi there!",
@@ -11,4 +11,4 @@ async function SendSms() {
console.log(rsp);
}
await SendSms();
sendSms();

View File

@@ -1,8 +1,8 @@
import * as stock from "m3o/stock";
const { StockService } = require("m3o/stock");
// Get the historic open-close for a given day
async function GetHistoricData() {
let stockService = new stock.StockService(process.env.MICRO_API_TOKEN);
async function getHistoricData() {
let stockService = new StockService(process.env.MICRO_API_TOKEN);
let rsp = await stockService.history({
date: "2020-10-01",
stock: "AAPL",
@@ -10,4 +10,4 @@ async function GetHistoricData() {
console.log(rsp);
}
await GetHistoricData();
getHistoricData();

View File

@@ -1,8 +1,8 @@
import * as stock from "m3o/stock";
const { StockService } = require("m3o/stock");
// Get the historic order book and each trade by timestamp
async function OrderBookHistory() {
let stockService = new stock.StockService(process.env.MICRO_API_TOKEN);
async function orderBookHistory() {
let stockService = new StockService(process.env.MICRO_API_TOKEN);
let rsp = await stockService.orderBook({
date: "2020-10-01",
end: "2020-10-01T11:00:00Z",
@@ -13,4 +13,4 @@ async function OrderBookHistory() {
console.log(rsp);
}
await OrderBookHistory();
orderBookHistory();

View File

@@ -1,12 +1,12 @@
import * as stock from "m3o/stock";
const { StockService } = require("m3o/stock");
// Get the last price for a given stock ticker
async function GetAstockPrice() {
let stockService = new stock.StockService(process.env.MICRO_API_TOKEN);
async function getAstockPrice() {
let stockService = new StockService(process.env.MICRO_API_TOKEN);
let rsp = await stockService.price({
symbol: "AAPL",
});
console.log(rsp);
}
await GetAstockPrice();
getAstockPrice();

View File

@@ -1,12 +1,12 @@
import * as stock from "m3o/stock";
const { StockService } = require("m3o/stock");
// Get the last quote for the stock
async function GetAstockQuote() {
let stockService = new stock.StockService(process.env.MICRO_API_TOKEN);
async function getAstockQuote() {
let stockService = new StockService(process.env.MICRO_API_TOKEN);
let rsp = await stockService.quote({
symbol: "AAPL",
});
console.log(rsp);
}
await GetAstockQuote();
getAstockQuote();

View File

@@ -11,9 +11,9 @@ func PublishAmessage() {
streamService := stream.NewStreamService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := streamService.Publish(&stream.PublishRequest{
Message: map[string]interface{}{
"user": "john",
"id": "1",
"type": "signup",
"user": "john",
},
Topic: "events",
})

View File

@@ -1,8 +1,8 @@
import * as stream from "m3o/stream";
const { StreamService } = require("m3o/stream");
// Publish a message to the stream. Specify a topic to group messages for a specific topic.
async function PublishAmessage() {
let streamService = new stream.StreamService(process.env.MICRO_API_TOKEN);
async function publishAmessage() {
let streamService = new StreamService(process.env.MICRO_API_TOKEN);
let rsp = await streamService.publish({
message: {
id: "1",
@@ -14,4 +14,4 @@ async function PublishAmessage() {
console.log(rsp);
}
await PublishAmessage();
publishAmessage();

View File

@@ -1,13 +1,13 @@
import * as sunnah from "m3o/sunnah";
const { SunnahService } = require("m3o/sunnah");
// Get a list of books from within a collection. A book can contain many chapters
// each with its own hadiths.
async function GetTheBooksWithinAcollection() {
let sunnahService = new sunnah.SunnahService(process.env.MICRO_API_TOKEN);
async function getTheBooksWithinAcollection() {
let sunnahService = new SunnahService(process.env.MICRO_API_TOKEN);
let rsp = await sunnahService.books({
collection: "bukhari",
});
console.log(rsp);
}
await GetTheBooksWithinAcollection();
getTheBooksWithinAcollection();

View File

@@ -1,8 +1,8 @@
import * as sunnah from "m3o/sunnah";
const { SunnahService } = require("m3o/sunnah");
// Get all the chapters of a given book within a collection.
async function ListTheChaptersInAbook() {
let sunnahService = new sunnah.SunnahService(process.env.MICRO_API_TOKEN);
async function listTheChaptersInAbook() {
let sunnahService = new SunnahService(process.env.MICRO_API_TOKEN);
let rsp = await sunnahService.chapters({
book: 1,
collection: "bukhari",
@@ -10,4 +10,4 @@ async function ListTheChaptersInAbook() {
console.log(rsp);
}
await ListTheChaptersInAbook();
listTheChaptersInAbook();

View File

@@ -1,11 +1,11 @@
import * as sunnah from "m3o/sunnah";
const { SunnahService } = require("m3o/sunnah");
// Get a list of available collections. A collection is
// a compilation of hadiths collected and written by an author.
async function ListAvailableCollections() {
let sunnahService = new sunnah.SunnahService(process.env.MICRO_API_TOKEN);
async function listAvailableCollections() {
let sunnahService = new SunnahService(process.env.MICRO_API_TOKEN);
let rsp = await sunnahService.collections({});
console.log(rsp);
}
await ListAvailableCollections();
listAvailableCollections();

View File

@@ -1,9 +1,9 @@
import * as sunnah from "m3o/sunnah";
const { SunnahService } = require("m3o/sunnah");
// Hadiths returns a list of hadiths and their corresponding text for a
// given book within a collection.
async function ListTheHadithsInAbook() {
let sunnahService = new sunnah.SunnahService(process.env.MICRO_API_TOKEN);
async function listTheHadithsInAbook() {
let sunnahService = new SunnahService(process.env.MICRO_API_TOKEN);
let rsp = await sunnahService.hadiths({
book: 1,
collection: "bukhari",
@@ -11,4 +11,4 @@ async function ListTheHadithsInAbook() {
console.log(rsp);
}
await ListTheHadithsInAbook();
listTheHadithsInAbook();

View File

@@ -1,10 +1,8 @@
import * as thumbnail from "m3o/thumbnail";
const { ThumbnailService } = require("m3o/thumbnail");
// Create a thumbnail screenshot by passing in a url, height and width
async function TakeScreenshotOfAurl() {
let thumbnailService = new thumbnail.ThumbnailService(
process.env.MICRO_API_TOKEN
);
async function takeScreenshotOfAurl() {
let thumbnailService = new ThumbnailService(process.env.MICRO_API_TOKEN);
let rsp = await thumbnailService.screenshot({
height: 600,
url: "https://m3o.com",
@@ -13,4 +11,4 @@ async function TakeScreenshotOfAurl() {
console.log(rsp);
}
await TakeScreenshotOfAurl();
takeScreenshotOfAurl();

Some files were not shown because too many files have changed in this diff Show More