mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-23 07:41:25 +00:00
Generate clients (#206)
This commit is contained in:
1
clients/ts/.gitignore
vendored
Normal file
1
clients/ts/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
dist
|
||||
53
clients/ts/address/index.ts
Executable file
53
clients/ts/address/index.ts
Executable file
@@ -0,0 +1,53 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class AddressService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Lookup a list of UK addresses by postcode
|
||||
lookupPostcode(
|
||||
request: LookupPostcodeRequest
|
||||
): Promise<LookupPostcodeResponse> {
|
||||
return this.client.call(
|
||||
"address",
|
||||
"LookupPostcode",
|
||||
request
|
||||
) as Promise<LookupPostcodeResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface LookupPostcodeRequest {
|
||||
// UK postcode e.g SW1A 2AA
|
||||
postcode?: string;
|
||||
}
|
||||
|
||||
export interface LookupPostcodeResponse {
|
||||
addresses?: Record[];
|
||||
}
|
||||
|
||||
export interface Record {
|
||||
// building name
|
||||
buildingName?: string;
|
||||
// the county
|
||||
county?: string;
|
||||
// line one of address
|
||||
lineOne?: string;
|
||||
// line two of address
|
||||
lineTwo?: string;
|
||||
// dependent locality
|
||||
locality?: string;
|
||||
// organisation if present
|
||||
organisation?: string;
|
||||
// the postcode
|
||||
postcode?: string;
|
||||
// the premise
|
||||
premise?: string;
|
||||
// street name
|
||||
street?: string;
|
||||
// the complete address
|
||||
summary?: string;
|
||||
// post town
|
||||
town?: string;
|
||||
}
|
||||
31
clients/ts/answer/index.ts
Executable file
31
clients/ts/answer/index.ts
Executable file
@@ -0,0 +1,31 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class AnswerService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Ask a question and receive an instant answer
|
||||
question(request: QuestionRequest): Promise<QuestionResponse> {
|
||||
return this.client.call(
|
||||
"answer",
|
||||
"Question",
|
||||
request
|
||||
) as Promise<QuestionResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface QuestionRequest {
|
||||
// the question to answer
|
||||
query?: string;
|
||||
}
|
||||
|
||||
export interface QuestionResponse {
|
||||
// the answer to your question
|
||||
answer?: string;
|
||||
// any related image
|
||||
image?: string;
|
||||
// a related url
|
||||
url?: string;
|
||||
}
|
||||
107
clients/ts/cache/index.ts
vendored
Executable file
107
clients/ts/cache/index.ts
vendored
Executable file
@@ -0,0 +1,107 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class CacheService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Decrement a value (if it's a number)
|
||||
decrement(request: DecrementRequest): Promise<DecrementResponse> {
|
||||
return this.client.call(
|
||||
"cache",
|
||||
"Decrement",
|
||||
request
|
||||
) as Promise<DecrementResponse>;
|
||||
}
|
||||
// Delete a value from the cache
|
||||
delete(request: DeleteRequest): Promise<DeleteResponse> {
|
||||
return this.client.call(
|
||||
"cache",
|
||||
"Delete",
|
||||
request
|
||||
) as Promise<DeleteResponse>;
|
||||
}
|
||||
// Get an item from the cache by key
|
||||
get(request: GetRequest): Promise<GetResponse> {
|
||||
return this.client.call("cache", "Get", request) as Promise<GetResponse>;
|
||||
}
|
||||
// Increment a value (if it's a number)
|
||||
increment(request: IncrementRequest): Promise<IncrementResponse> {
|
||||
return this.client.call(
|
||||
"cache",
|
||||
"Increment",
|
||||
request
|
||||
) as Promise<IncrementResponse>;
|
||||
}
|
||||
// Set an item in the cache. Overwrites any existing value already set.
|
||||
set(request: SetRequest): Promise<SetResponse> {
|
||||
return this.client.call("cache", "Set", request) as Promise<SetResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface DecrementRequest {
|
||||
// The key to decrement
|
||||
key?: string;
|
||||
// The amount to decrement the value by
|
||||
value?: number;
|
||||
}
|
||||
|
||||
export interface DecrementResponse {
|
||||
// The key decremented
|
||||
key?: string;
|
||||
// The new value
|
||||
value?: number;
|
||||
}
|
||||
|
||||
export interface DeleteRequest {
|
||||
// The key to delete
|
||||
key?: string;
|
||||
}
|
||||
|
||||
export interface DeleteResponse {
|
||||
// Returns "ok" if successful
|
||||
status?: string;
|
||||
}
|
||||
|
||||
export interface GetRequest {
|
||||
// The key to retrieve
|
||||
key?: string;
|
||||
}
|
||||
|
||||
export interface GetResponse {
|
||||
// The key
|
||||
key?: string;
|
||||
// Time to live in seconds
|
||||
ttl?: number;
|
||||
// The value
|
||||
value?: string;
|
||||
}
|
||||
|
||||
export interface IncrementRequest {
|
||||
// The key to increment
|
||||
key?: string;
|
||||
// The amount to increment the value by
|
||||
value?: number;
|
||||
}
|
||||
|
||||
export interface IncrementResponse {
|
||||
// The key incremented
|
||||
key?: string;
|
||||
// The new value
|
||||
value?: number;
|
||||
}
|
||||
|
||||
export interface SetRequest {
|
||||
// The key to update
|
||||
key?: string;
|
||||
// Time to live in seconds
|
||||
ttl?: number;
|
||||
// The value to set
|
||||
value?: string;
|
||||
}
|
||||
|
||||
export interface SetResponse {
|
||||
// Returns "ok" if successful
|
||||
status?: string;
|
||||
}
|
||||
116
clients/ts/crypto/index.ts
Executable file
116
clients/ts/crypto/index.ts
Executable file
@@ -0,0 +1,116 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class CryptoService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Returns the history for the previous close
|
||||
history(request: HistoryRequest): Promise<HistoryResponse> {
|
||||
return this.client.call(
|
||||
"crypto",
|
||||
"History",
|
||||
request
|
||||
) as Promise<HistoryResponse>;
|
||||
}
|
||||
// Get news related to a currency
|
||||
news(request: NewsRequest): Promise<NewsResponse> {
|
||||
return this.client.call("crypto", "News", request) as Promise<NewsResponse>;
|
||||
}
|
||||
// Get the last price for a given crypto ticker
|
||||
price(request: PriceRequest): Promise<PriceResponse> {
|
||||
return this.client.call(
|
||||
"crypto",
|
||||
"Price",
|
||||
request
|
||||
) as Promise<PriceResponse>;
|
||||
}
|
||||
// Get the last quote for a given crypto ticker
|
||||
quote(request: QuoteRequest): Promise<QuoteResponse> {
|
||||
return this.client.call(
|
||||
"crypto",
|
||||
"Quote",
|
||||
request
|
||||
) as Promise<QuoteResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Article {
|
||||
// the date published
|
||||
date?: string;
|
||||
// its description
|
||||
description?: string;
|
||||
// the source
|
||||
source?: string;
|
||||
// title of the article
|
||||
title?: string;
|
||||
// the source url
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export interface HistoryRequest {
|
||||
// the crypto symbol e.g BTCUSD
|
||||
symbol?: string;
|
||||
}
|
||||
|
||||
export interface HistoryResponse {
|
||||
// the close price
|
||||
close?: number;
|
||||
// the date
|
||||
date?: string;
|
||||
// the peak price
|
||||
high?: number;
|
||||
// the low price
|
||||
low?: number;
|
||||
// the open price
|
||||
open?: number;
|
||||
// the crypto symbol
|
||||
symbol?: string;
|
||||
// the volume
|
||||
volume?: number;
|
||||
}
|
||||
|
||||
export interface NewsRequest {
|
||||
// cryptocurrency ticker to request news for e.g BTC
|
||||
symbol?: string;
|
||||
}
|
||||
|
||||
export interface NewsResponse {
|
||||
// list of articles
|
||||
articles?: Article[];
|
||||
// symbol requested for
|
||||
symbol?: string;
|
||||
}
|
||||
|
||||
export interface PriceRequest {
|
||||
// the crypto symbol e.g BTCUSD
|
||||
symbol?: string;
|
||||
}
|
||||
|
||||
export interface PriceResponse {
|
||||
// the last price
|
||||
price?: number;
|
||||
// the crypto symbol e.g BTCUSD
|
||||
symbol?: string;
|
||||
}
|
||||
|
||||
export interface QuoteRequest {
|
||||
// the crypto symbol e.g BTCUSD
|
||||
symbol?: string;
|
||||
}
|
||||
|
||||
export interface QuoteResponse {
|
||||
// the asking price
|
||||
askPrice?: number;
|
||||
// the ask size
|
||||
askSize?: number;
|
||||
// the bidding price
|
||||
bidPrice?: number;
|
||||
// the bid size
|
||||
bidSize?: number;
|
||||
// the crypto symbol
|
||||
symbol?: string;
|
||||
// the UTC timestamp of the quote
|
||||
timestamp?: string;
|
||||
}
|
||||
102
clients/ts/currency/index.ts
Executable file
102
clients/ts/currency/index.ts
Executable file
@@ -0,0 +1,102 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class CurrencyService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Codes returns the supported currency codes for the API
|
||||
codes(request: CodesRequest): Promise<CodesResponse> {
|
||||
return this.client.call(
|
||||
"currency",
|
||||
"Codes",
|
||||
request
|
||||
) as Promise<CodesResponse>;
|
||||
}
|
||||
// Convert returns the currency conversion rate between two pairs e.g USD/GBP
|
||||
convert(request: ConvertRequest): Promise<ConvertResponse> {
|
||||
return this.client.call(
|
||||
"currency",
|
||||
"Convert",
|
||||
request
|
||||
) as Promise<ConvertResponse>;
|
||||
}
|
||||
// Returns the historic rates for a currency on a given date
|
||||
history(request: HistoryRequest): Promise<HistoryResponse> {
|
||||
return this.client.call(
|
||||
"currency",
|
||||
"History",
|
||||
request
|
||||
) as Promise<HistoryResponse>;
|
||||
}
|
||||
// Rates returns the currency rates for a given code e.g USD
|
||||
rates(request: RatesRequest): Promise<RatesResponse> {
|
||||
return this.client.call(
|
||||
"currency",
|
||||
"Rates",
|
||||
request
|
||||
) as Promise<RatesResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Code {
|
||||
// e.g United States Dollar
|
||||
currency?: string;
|
||||
// e.g USD
|
||||
name?: string;
|
||||
}
|
||||
|
||||
export interface CodesRequest {}
|
||||
|
||||
export interface CodesResponse {
|
||||
codes?: Code[];
|
||||
}
|
||||
|
||||
export interface ConvertRequest {
|
||||
// optional amount to convert e.g 10.0
|
||||
amount?: number;
|
||||
// base code to convert from e.g USD
|
||||
from?: string;
|
||||
// target code to convert to e.g GBP
|
||||
to?: string;
|
||||
}
|
||||
|
||||
export interface ConvertResponse {
|
||||
// converted amount e.g 7.10
|
||||
amount?: number;
|
||||
// the base code e.g USD
|
||||
from?: string;
|
||||
// conversion rate e.g 0.71
|
||||
rate?: number;
|
||||
// the target code e.g GBP
|
||||
to?: string;
|
||||
}
|
||||
|
||||
export interface HistoryRequest {
|
||||
// currency code e.g USD
|
||||
code?: string;
|
||||
// date formatted as YYYY-MM-DD
|
||||
date?: string;
|
||||
}
|
||||
|
||||
export interface HistoryResponse {
|
||||
// The code of the request
|
||||
code?: string;
|
||||
// The date requested
|
||||
date?: string;
|
||||
// The rate for the day as code:rate
|
||||
rates?: { [key: string]: number };
|
||||
}
|
||||
|
||||
export interface RatesRequest {
|
||||
// The currency code to get rates for e.g USD
|
||||
code?: string;
|
||||
}
|
||||
|
||||
export interface RatesResponse {
|
||||
// The code requested e.g USD
|
||||
code?: string;
|
||||
// The rates for the given code as key-value pairs code:rate
|
||||
rates?: { [key: string]: number };
|
||||
}
|
||||
101
clients/ts/db/index.ts
Executable file
101
clients/ts/db/index.ts
Executable file
@@ -0,0 +1,101 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class DbService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
||||
create(request: CreateRequest): Promise<CreateResponse> {
|
||||
return this.client.call("db", "Create", request) as Promise<CreateResponse>;
|
||||
}
|
||||
// Delete a record in the database by id.
|
||||
delete(request: DeleteRequest): Promise<DeleteResponse> {
|
||||
return this.client.call("db", "Delete", request) as Promise<DeleteResponse>;
|
||||
}
|
||||
// Read data from a table. Lookup can be by ID or via querying any field in the record.
|
||||
read(request: ReadRequest): Promise<ReadResponse> {
|
||||
return this.client.call("db", "Read", request) as Promise<ReadResponse>;
|
||||
}
|
||||
// Truncate the records in a table
|
||||
truncate(request: TruncateRequest): Promise<TruncateResponse> {
|
||||
return this.client.call(
|
||||
"db",
|
||||
"Truncate",
|
||||
request
|
||||
) as Promise<TruncateResponse>;
|
||||
}
|
||||
// Update a record in the database. Include an "id" in the record to update.
|
||||
update(request: UpdateRequest): Promise<UpdateResponse> {
|
||||
return this.client.call("db", "Update", request) as Promise<UpdateResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface CreateRequest {
|
||||
// JSON encoded record or records (can be array or object)
|
||||
record?: { [key: string]: any };
|
||||
// Optional table name. Defaults to 'default'
|
||||
table?: string;
|
||||
}
|
||||
|
||||
export interface CreateResponse {
|
||||
// The id of the record (either specified or automatically created)
|
||||
id?: string;
|
||||
}
|
||||
|
||||
export interface DeleteRequest {
|
||||
// id of the record
|
||||
id?: string;
|
||||
// Optional table name. Defaults to 'default'
|
||||
table?: string;
|
||||
}
|
||||
|
||||
export interface DeleteResponse {}
|
||||
|
||||
export interface ReadRequest {
|
||||
// Read by id. Equivalent to 'id == "your-id"'
|
||||
id?: string;
|
||||
// Maximum number of records to return. Default limit is 25.
|
||||
// Maximum limit is 1000. Anything higher will return an error.
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
// 'asc' (default), 'desc'
|
||||
order?: string;
|
||||
// field name to order by
|
||||
orderBy?: string;
|
||||
// Examples: 'age >= 18', 'age >= 18 and verified == true'
|
||||
// Comparison operators: '==', '!=', '<', '>', '<=', '>='
|
||||
// Logical operator: 'and'
|
||||
// Dot access is supported, eg: 'user.age == 11'
|
||||
// Accessing list elements is not supported yet.
|
||||
query?: string;
|
||||
// Optional table name. Defaults to 'default'
|
||||
table?: string;
|
||||
}
|
||||
|
||||
export interface ReadResponse {
|
||||
// JSON encoded records
|
||||
records?: { [key: string]: any }[];
|
||||
}
|
||||
|
||||
export interface TruncateRequest {
|
||||
// Optional table name. Defaults to 'default'
|
||||
table?: string;
|
||||
}
|
||||
|
||||
export interface TruncateResponse {
|
||||
// The table truncated
|
||||
table?: string;
|
||||
}
|
||||
|
||||
export interface UpdateRequest {
|
||||
// The id of the record. If not specified it is inferred from the 'id' field of the record
|
||||
id?: string;
|
||||
// record, JSON object
|
||||
record?: { [key: string]: any };
|
||||
// Optional table name. Defaults to 'default'
|
||||
table?: string;
|
||||
}
|
||||
|
||||
export interface UpdateResponse {}
|
||||
30
clients/ts/email/index.ts
Executable file
30
clients/ts/email/index.ts
Executable file
@@ -0,0 +1,30 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class EmailService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Send an email by passing in from, to, subject, and a text or html body
|
||||
send(request: SendRequest): Promise<SendResponse> {
|
||||
return this.client.call("email", "Send", request) as Promise<SendResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface SendRequest {
|
||||
// the display name of the sender
|
||||
from?: string;
|
||||
// the html body
|
||||
htmlBody?: string;
|
||||
// an optional reply to email address
|
||||
replyTo?: string;
|
||||
// the email subject
|
||||
subject?: string;
|
||||
// the text body
|
||||
textBody?: string;
|
||||
// the email address of the recipient
|
||||
to?: string;
|
||||
}
|
||||
|
||||
export interface SendResponse {}
|
||||
74
clients/ts/emoji/index.ts
Executable file
74
clients/ts/emoji/index.ts
Executable file
@@ -0,0 +1,74 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class EmojiService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Find an emoji by its alias e.g :beer:
|
||||
find(request: FindRequest): Promise<FindResponse> {
|
||||
return this.client.call("emoji", "Find", request) as Promise<FindResponse>;
|
||||
}
|
||||
// Get the flag for a country. Requires country code e.g GB for great britain
|
||||
flag(request: FlagRequest): Promise<FlagResponse> {
|
||||
return this.client.call("emoji", "Flag", request) as Promise<FlagResponse>;
|
||||
}
|
||||
// Print text and renders the emojis with aliases e.g
|
||||
// let's grab a :beer: becomes let's grab a 🍺
|
||||
print(request: PrintRequest): Promise<PrintResponse> {
|
||||
return this.client.call(
|
||||
"emoji",
|
||||
"Print",
|
||||
request
|
||||
) as Promise<PrintResponse>;
|
||||
}
|
||||
// Send an emoji to anyone via SMS. Messages are sent in the form '<message> Sent from <from>'
|
||||
send(request: SendRequest): Promise<SendResponse> {
|
||||
return this.client.call("emoji", "Send", request) as Promise<SendResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface FindRequest {
|
||||
// the alias code e.g :beer:
|
||||
alias?: string;
|
||||
}
|
||||
|
||||
export interface FindResponse {
|
||||
// the unicode emoji 🍺
|
||||
emoji?: string;
|
||||
}
|
||||
|
||||
export interface FlagRequest {
|
||||
// country code e.g GB
|
||||
code?: string;
|
||||
}
|
||||
|
||||
export interface FlagResponse {
|
||||
// the emoji flag
|
||||
flag?: string;
|
||||
}
|
||||
|
||||
export interface PrintRequest {
|
||||
// text including any alias e.g let's grab a :beer:
|
||||
text?: string;
|
||||
}
|
||||
|
||||
export interface PrintResponse {
|
||||
// text with rendered emojis
|
||||
text?: string;
|
||||
}
|
||||
|
||||
export interface SendRequest {
|
||||
// the name of the sender from e.g Alice
|
||||
from?: string;
|
||||
// message to send including emoji aliases
|
||||
message?: string;
|
||||
// phone number to send to (including international dialing code)
|
||||
to?: string;
|
||||
}
|
||||
|
||||
export interface SendResponse {
|
||||
// whether or not it succeeded
|
||||
success?: boolean;
|
||||
}
|
||||
92
clients/ts/file/index.ts
Executable file
92
clients/ts/file/index.ts
Executable file
@@ -0,0 +1,92 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class FileService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Delete a file by project name/path
|
||||
delete(request: DeleteRequest): Promise<DeleteResponse> {
|
||||
return this.client.call(
|
||||
"file",
|
||||
"Delete",
|
||||
request
|
||||
) as Promise<DeleteResponse>;
|
||||
}
|
||||
// List files by their project and optionally a path.
|
||||
list(request: ListRequest): Promise<ListResponse> {
|
||||
return this.client.call("file", "List", request) as Promise<ListResponse>;
|
||||
}
|
||||
// Read a file by path
|
||||
read(request: ReadRequest): Promise<ReadResponse> {
|
||||
return this.client.call("file", "Read", request) as Promise<ReadResponse>;
|
||||
}
|
||||
// Save a file
|
||||
save(request: SaveRequest): Promise<SaveResponse> {
|
||||
return this.client.call("file", "Save", request) as Promise<SaveResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface BatchSaveRequest {
|
||||
files?: Record[];
|
||||
}
|
||||
|
||||
export interface BatchSaveResponse {}
|
||||
|
||||
export interface DeleteRequest {
|
||||
// Path to the file
|
||||
path?: string;
|
||||
// The project name
|
||||
project?: string;
|
||||
}
|
||||
|
||||
export interface DeleteResponse {}
|
||||
|
||||
export interface ListRequest {
|
||||
// Defaults to '/', ie. lists all files in a project.
|
||||
// Supply path to a folder if you want to list
|
||||
// files inside that folder
|
||||
// eg. '/docs'
|
||||
path?: string;
|
||||
// Project, required for listing.
|
||||
project?: string;
|
||||
}
|
||||
|
||||
export interface ListResponse {
|
||||
files?: Record[];
|
||||
}
|
||||
|
||||
export interface ReadRequest {
|
||||
// Path to the file
|
||||
path?: string;
|
||||
// Project name
|
||||
project?: string;
|
||||
}
|
||||
|
||||
export interface ReadResponse {
|
||||
// Returns the file
|
||||
file?: Record;
|
||||
}
|
||||
|
||||
export interface Record {
|
||||
// File contents
|
||||
content?: string;
|
||||
// Time the file was created e.g 2021-05-20T13:37:21Z
|
||||
created?: string;
|
||||
// Any other associated metadata as a map of key-value pairs
|
||||
metadata?: { [key: string]: string };
|
||||
// Path to file or folder eg. '/documents/text-files/file.txt'.
|
||||
path?: string;
|
||||
// A custom project to group files
|
||||
// eg. file-of-mywebsite.com
|
||||
project?: string;
|
||||
// Time the file was updated e.g 2021-05-20T13:37:21Z
|
||||
updated?: string;
|
||||
}
|
||||
|
||||
export interface SaveRequest {
|
||||
file?: Record;
|
||||
}
|
||||
|
||||
export interface SaveResponse {}
|
||||
83
clients/ts/forex/index.ts
Executable file
83
clients/ts/forex/index.ts
Executable file
@@ -0,0 +1,83 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class ForexService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Returns the data for the previous close
|
||||
history(request: HistoryRequest): Promise<HistoryResponse> {
|
||||
return this.client.call(
|
||||
"forex",
|
||||
"History",
|
||||
request
|
||||
) as Promise<HistoryResponse>;
|
||||
}
|
||||
// Get the latest price for a given forex ticker
|
||||
price(request: PriceRequest): Promise<PriceResponse> {
|
||||
return this.client.call(
|
||||
"forex",
|
||||
"Price",
|
||||
request
|
||||
) as Promise<PriceResponse>;
|
||||
}
|
||||
// Get the latest quote for the forex
|
||||
quote(request: QuoteRequest): Promise<QuoteResponse> {
|
||||
return this.client.call(
|
||||
"forex",
|
||||
"Quote",
|
||||
request
|
||||
) as Promise<QuoteResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface HistoryRequest {
|
||||
// the forex symbol e.g GBPUSD
|
||||
symbol?: string;
|
||||
}
|
||||
|
||||
export interface HistoryResponse {
|
||||
// the close price
|
||||
close?: number;
|
||||
// the date
|
||||
date?: string;
|
||||
// the peak price
|
||||
high?: number;
|
||||
// the low price
|
||||
low?: number;
|
||||
// the open price
|
||||
open?: number;
|
||||
// the forex symbol
|
||||
symbol?: string;
|
||||
// the volume
|
||||
volume?: number;
|
||||
}
|
||||
|
||||
export interface PriceRequest {
|
||||
// forex symbol e.g GBPUSD
|
||||
symbol?: string;
|
||||
}
|
||||
|
||||
export interface PriceResponse {
|
||||
// the last price
|
||||
price?: number;
|
||||
// the forex symbol e.g GBPUSD
|
||||
symbol?: string;
|
||||
}
|
||||
|
||||
export interface QuoteRequest {
|
||||
// the forex symbol e.g GBPUSD
|
||||
symbol?: string;
|
||||
}
|
||||
|
||||
export interface QuoteResponse {
|
||||
// the asking price
|
||||
askPrice?: number;
|
||||
// the bidding price
|
||||
bidPrice?: number;
|
||||
// the forex symbol
|
||||
symbol?: string;
|
||||
// the UTC timestamp of the quote
|
||||
timestamp?: string;
|
||||
}
|
||||
60
clients/ts/geocoding/index.ts
Executable file
60
clients/ts/geocoding/index.ts
Executable file
@@ -0,0 +1,60 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class GeocodingService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Lookup returns a geocoded address including normalized address and gps coordinates. All fields are optional, provide more to get more accurate results
|
||||
lookup(request: LookupRequest): Promise<LookupResponse> {
|
||||
return this.client.call(
|
||||
"geocoding",
|
||||
"Lookup",
|
||||
request
|
||||
) as Promise<LookupResponse>;
|
||||
}
|
||||
// Reverse lookup an address from gps coordinates
|
||||
reverse(request: ReverseRequest): Promise<ReverseResponse> {
|
||||
return this.client.call(
|
||||
"geocoding",
|
||||
"Reverse",
|
||||
request
|
||||
) as Promise<ReverseResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Address {
|
||||
city?: string;
|
||||
country?: string;
|
||||
lineOne?: string;
|
||||
lineTwo?: string;
|
||||
postcode?: string;
|
||||
}
|
||||
|
||||
export interface Location {
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
}
|
||||
|
||||
export interface LookupRequest {
|
||||
address?: string;
|
||||
city?: string;
|
||||
country?: string;
|
||||
postcode?: string;
|
||||
}
|
||||
|
||||
export interface LookupResponse {
|
||||
address?: { [key: string]: any };
|
||||
location?: { [key: string]: any };
|
||||
}
|
||||
|
||||
export interface ReverseRequest {
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
}
|
||||
|
||||
export interface ReverseResponse {
|
||||
address?: { [key: string]: any };
|
||||
location?: { [key: string]: any };
|
||||
}
|
||||
43
clients/ts/helloworld/index.ts
Executable file
43
clients/ts/helloworld/index.ts
Executable file
@@ -0,0 +1,43 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class HelloworldService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Call returns a personalised "Hello $name" response
|
||||
call(request: CallRequest): Promise<CallResponse> {
|
||||
return this.client.call(
|
||||
"helloworld",
|
||||
"Call",
|
||||
request
|
||||
) as Promise<CallResponse>;
|
||||
}
|
||||
// Stream returns a stream of "Hello $name" responses
|
||||
stream(request: StreamRequest): Promise<StreamResponse> {
|
||||
return this.client.call(
|
||||
"helloworld",
|
||||
"Stream",
|
||||
request
|
||||
) as Promise<StreamResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface CallRequest {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
export interface CallResponse {
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface StreamRequest {
|
||||
// the number of messages to send back
|
||||
messages?: number;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
export interface StreamResponse {
|
||||
message?: string;
|
||||
}
|
||||
39
clients/ts/id/index.ts
Executable file
39
clients/ts/id/index.ts
Executable file
@@ -0,0 +1,39 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class IdService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Generate a unique ID. Defaults to uuid.
|
||||
generate(request: GenerateRequest): Promise<GenerateResponse> {
|
||||
return this.client.call(
|
||||
"id",
|
||||
"Generate",
|
||||
request
|
||||
) as Promise<GenerateResponse>;
|
||||
}
|
||||
// List the types of IDs available. No query params needed.
|
||||
types(request: TypesRequest): Promise<TypesResponse> {
|
||||
return this.client.call("id", "Types", request) as Promise<TypesResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface GenerateRequest {
|
||||
// type of id e.g uuid, shortid, snowflake (64 bit), bigflake (128 bit)
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export interface GenerateResponse {
|
||||
// the unique id generated
|
||||
id?: string;
|
||||
// the type of id generated
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export interface TypesRequest {}
|
||||
|
||||
export interface TypesResponse {
|
||||
types?: string[];
|
||||
}
|
||||
113
clients/ts/image/index.ts
Executable file
113
clients/ts/image/index.ts
Executable file
@@ -0,0 +1,113 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class ImageService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// 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.
|
||||
convert(request: ConvertRequest): Promise<ConvertResponse> {
|
||||
return this.client.call(
|
||||
"image",
|
||||
"Convert",
|
||||
request
|
||||
) as Promise<ConvertResponse>;
|
||||
}
|
||||
// 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.
|
||||
resize(request: ResizeRequest): Promise<ResizeResponse> {
|
||||
return this.client.call(
|
||||
"image",
|
||||
"Resize",
|
||||
request
|
||||
) as Promise<ResizeResponse>;
|
||||
}
|
||||
// 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.
|
||||
upload(request: UploadRequest): Promise<UploadResponse> {
|
||||
return this.client.call(
|
||||
"image",
|
||||
"Upload",
|
||||
request
|
||||
) as Promise<UploadResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface ConvertRequest {
|
||||
// base64 encoded image to resize,
|
||||
// ie. "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
|
||||
base64?: string;
|
||||
// output name of the image including extension, ie. "cat.png"
|
||||
name?: string;
|
||||
// make output a URL and not a base64 response
|
||||
outputURL?: boolean;
|
||||
// url of the image to resize
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export interface ConvertResponse {
|
||||
base64?: string;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export interface CropOptions {
|
||||
// Crop anchor point: "top", "top left", "top right",
|
||||
// "left", "center", "right"
|
||||
// "bottom left", "bottom", "bottom right".
|
||||
// Optional. Defaults to center.
|
||||
anchor?: string;
|
||||
// height to crop to
|
||||
height?: number;
|
||||
// width to crop to
|
||||
width?: number;
|
||||
}
|
||||
|
||||
export interface Point {
|
||||
x?: number;
|
||||
y?: number;
|
||||
}
|
||||
|
||||
export interface Rectangle {
|
||||
max?: Point;
|
||||
min?: Point;
|
||||
}
|
||||
|
||||
export interface ResizeRequest {
|
||||
// base64 encoded image to resize,
|
||||
// ie. "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
|
||||
base64?: string;
|
||||
// optional crop options
|
||||
// if provided, after resize, the image
|
||||
// will be cropped
|
||||
cropOptions?: CropOptions;
|
||||
height?: number;
|
||||
// output name of the image including extension, ie. "cat.png"
|
||||
name?: string;
|
||||
// make output a URL and not a base64 response
|
||||
outputURL?: boolean;
|
||||
// url of the image to resize
|
||||
url?: string;
|
||||
width?: number;
|
||||
}
|
||||
|
||||
export interface ResizeResponse {
|
||||
base64?: string;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export interface UploadRequest {
|
||||
// Base64 encoded image to upload,
|
||||
// ie. "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
|
||||
base64?: string;
|
||||
// Output name of the image including extension, ie. "cat.png"
|
||||
name?: string;
|
||||
// URL of the image to upload
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export interface UploadResponse {
|
||||
url?: string;
|
||||
}
|
||||
96
clients/ts/index.ts
Executable file
96
clients/ts/index.ts
Executable file
@@ -0,0 +1,96 @@
|
||||
import * as address from "./address";
|
||||
import * as answer from "./answer";
|
||||
import * as cache from "./cache";
|
||||
import * as crypto from "./crypto";
|
||||
import * as currency from "./currency";
|
||||
import * as db from "./db";
|
||||
import * as email from "./email";
|
||||
import * as emoji from "./emoji";
|
||||
import * as file from "./file";
|
||||
import * as forex from "./forex";
|
||||
import * as geocoding from "./geocoding";
|
||||
import * as helloworld from "./helloworld";
|
||||
import * as id from "./id";
|
||||
import * as image from "./image";
|
||||
import * as ip from "./ip";
|
||||
import * as location from "./location";
|
||||
import * as otp from "./otp";
|
||||
import * as postcode from "./postcode";
|
||||
import * as quran from "./quran";
|
||||
import * as routing from "./routing";
|
||||
import * as rss from "./rss";
|
||||
import * as sentiment from "./sentiment";
|
||||
import * as sms from "./sms";
|
||||
import * as stock from "./stock";
|
||||
import * as stream from "./stream";
|
||||
import * as thumbnail from "./thumbnail";
|
||||
import * as time from "./time";
|
||||
import * as url from "./url";
|
||||
import * as user from "./user";
|
||||
import * as weather from "./weather";
|
||||
|
||||
export class Client {
|
||||
constructor(token: string) {
|
||||
this.addressService = new address.AddressService(token);
|
||||
this.answerService = new answer.AnswerService(token);
|
||||
this.cacheService = new cache.CacheService(token);
|
||||
this.cryptoService = new crypto.CryptoService(token);
|
||||
this.currencyService = new currency.CurrencyService(token);
|
||||
this.dbService = new db.DbService(token);
|
||||
this.emailService = new email.EmailService(token);
|
||||
this.emojiService = new emoji.EmojiService(token);
|
||||
this.fileService = new file.FileService(token);
|
||||
this.forexService = new forex.ForexService(token);
|
||||
this.geocodingService = new geocoding.GeocodingService(token);
|
||||
this.helloworldService = new helloworld.HelloworldService(token);
|
||||
this.idService = new id.IdService(token);
|
||||
this.imageService = new image.ImageService(token);
|
||||
this.ipService = new ip.IpService(token);
|
||||
this.locationService = new location.LocationService(token);
|
||||
this.otpService = new otp.OtpService(token);
|
||||
this.postcodeService = new postcode.PostcodeService(token);
|
||||
this.quranService = new quran.QuranService(token);
|
||||
this.routingService = new routing.RoutingService(token);
|
||||
this.rssService = new rss.RssService(token);
|
||||
this.sentimentService = new sentiment.SentimentService(token);
|
||||
this.smsService = new sms.SmsService(token);
|
||||
this.stockService = new stock.StockService(token);
|
||||
this.streamService = new stream.StreamService(token);
|
||||
this.thumbnailService = new thumbnail.ThumbnailService(token);
|
||||
this.timeService = new time.TimeService(token);
|
||||
this.urlService = new url.UrlService(token);
|
||||
this.userService = new user.UserService(token);
|
||||
this.weatherService = new weather.WeatherService(token);
|
||||
}
|
||||
|
||||
addressService: address.AddressService;
|
||||
answerService: answer.AnswerService;
|
||||
cacheService: cache.CacheService;
|
||||
cryptoService: crypto.CryptoService;
|
||||
currencyService: currency.CurrencyService;
|
||||
dbService: db.DbService;
|
||||
emailService: email.EmailService;
|
||||
emojiService: emoji.EmojiService;
|
||||
fileService: file.FileService;
|
||||
forexService: forex.ForexService;
|
||||
geocodingService: geocoding.GeocodingService;
|
||||
helloworldService: helloworld.HelloworldService;
|
||||
idService: id.IdService;
|
||||
imageService: image.ImageService;
|
||||
ipService: ip.IpService;
|
||||
locationService: location.LocationService;
|
||||
otpService: otp.OtpService;
|
||||
postcodeService: postcode.PostcodeService;
|
||||
quranService: quran.QuranService;
|
||||
routingService: routing.RoutingService;
|
||||
rssService: rss.RssService;
|
||||
sentimentService: sentiment.SentimentService;
|
||||
smsService: sms.SmsService;
|
||||
stockService: stock.StockService;
|
||||
streamService: stream.StreamService;
|
||||
thumbnailService: thumbnail.ThumbnailService;
|
||||
timeService: time.TimeService;
|
||||
urlService: url.UrlService;
|
||||
userService: user.UserService;
|
||||
weatherService: weather.WeatherService;
|
||||
}
|
||||
37
clients/ts/ip/index.ts
Executable file
37
clients/ts/ip/index.ts
Executable file
@@ -0,0 +1,37 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class IpService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Lookup the geolocation information for an IP address
|
||||
lookup(request: LookupRequest): Promise<LookupResponse> {
|
||||
return this.client.call("ip", "Lookup", request) as Promise<LookupResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface LookupRequest {
|
||||
// IP to lookup
|
||||
ip?: string;
|
||||
}
|
||||
|
||||
export interface LookupResponse {
|
||||
// Autonomous system number
|
||||
asn?: number;
|
||||
// Name of the city
|
||||
city?: string;
|
||||
// Name of the continent
|
||||
continent?: string;
|
||||
// Name of the country
|
||||
country?: string;
|
||||
// IP of the query
|
||||
ip?: string;
|
||||
// Latitude e.g 52.523219
|
||||
latitude?: number;
|
||||
// Longitude e.g 13.428555
|
||||
longitude?: number;
|
||||
// Timezone e.g Europe/Rome
|
||||
timezone?: string;
|
||||
}
|
||||
75
clients/ts/location/index.ts
Executable file
75
clients/ts/location/index.ts
Executable file
@@ -0,0 +1,75 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class LocationService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Read an entity by its ID
|
||||
read(request: ReadRequest): Promise<ReadResponse> {
|
||||
return this.client.call(
|
||||
"location",
|
||||
"Read",
|
||||
request
|
||||
) as Promise<ReadResponse>;
|
||||
}
|
||||
// Save an entity's current position
|
||||
save(request: SaveRequest): Promise<SaveResponse> {
|
||||
return this.client.call(
|
||||
"location",
|
||||
"Save",
|
||||
request
|
||||
) as Promise<SaveResponse>;
|
||||
}
|
||||
// Search for entities in a given radius
|
||||
search(request: SearchRequest): Promise<SearchResponse> {
|
||||
return this.client.call(
|
||||
"location",
|
||||
"Search",
|
||||
request
|
||||
) as Promise<SearchResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Entity {
|
||||
id?: string;
|
||||
location?: Point;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export interface Point {
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
timestamp?: number;
|
||||
}
|
||||
|
||||
export interface ReadRequest {
|
||||
// the entity id
|
||||
id?: string;
|
||||
}
|
||||
|
||||
export interface ReadResponse {
|
||||
entity?: { [key: string]: any };
|
||||
}
|
||||
|
||||
export interface SaveRequest {
|
||||
entity?: { [key: string]: any };
|
||||
}
|
||||
|
||||
export interface SaveResponse {}
|
||||
|
||||
export interface SearchRequest {
|
||||
// Central position to search from
|
||||
center?: Point;
|
||||
// Maximum number of entities to return
|
||||
numEntities?: number;
|
||||
// radius in meters
|
||||
radius?: number;
|
||||
// type of entities to filter
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export interface SearchResponse {
|
||||
entities?: Entity[];
|
||||
}
|
||||
51
clients/ts/otp/index.ts
Executable file
51
clients/ts/otp/index.ts
Executable file
@@ -0,0 +1,51 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class OtpService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Generate an OTP (one time pass) code
|
||||
generate(request: GenerateRequest): Promise<GenerateResponse> {
|
||||
return this.client.call(
|
||||
"otp",
|
||||
"Generate",
|
||||
request
|
||||
) as Promise<GenerateResponse>;
|
||||
}
|
||||
// Validate the OTP code
|
||||
validate(request: ValidateRequest): Promise<ValidateResponse> {
|
||||
return this.client.call(
|
||||
"otp",
|
||||
"Validate",
|
||||
request
|
||||
) as Promise<ValidateResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface GenerateRequest {
|
||||
// expiration in seconds (default: 60)
|
||||
expiry?: number;
|
||||
// unique id, email or user to generate an OTP for
|
||||
id?: string;
|
||||
// number of characters (default: 6)
|
||||
size?: number;
|
||||
}
|
||||
|
||||
export interface GenerateResponse {
|
||||
// one time pass code
|
||||
code?: string;
|
||||
}
|
||||
|
||||
export interface ValidateRequest {
|
||||
// one time pass code to validate
|
||||
code?: string;
|
||||
// unique id, email or user for which the code was generated
|
||||
id?: string;
|
||||
}
|
||||
|
||||
export interface ValidateResponse {
|
||||
// returns true if the code is valid for the ID
|
||||
success?: boolean;
|
||||
}
|
||||
566
clients/ts/package-lock.json
generated
Normal file
566
clients/ts/package-lock.json
generated
Normal file
@@ -0,0 +1,566 @@
|
||||
{
|
||||
"name": "@micro/services",
|
||||
"version": "1.0.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@micro/services",
|
||||
"version": "1.0.1",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@m3o/m3o-node": "^0.0.24"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^3.5.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@m3o/m3o-node": {
|
||||
"version": "0.0.24",
|
||||
"resolved": "https://registry.npmjs.org/@m3o/m3o-node/-/m3o-node-0.0.24.tgz",
|
||||
"integrity": "sha512-W6VqmZUTFodwBUai5uQ9nO4ylIztUXKYPFfZg2qqTv1lHkOYQ0XiJgFVn+SEOlp4GU/JI9OzCt4k1Ui5XaXGdw==",
|
||||
"dependencies": {
|
||||
"@types/ws": "^7.2.2",
|
||||
"axios": "^0.21.1",
|
||||
"body-parser": "^1.19.0",
|
||||
"dotenv": "^10.0.0",
|
||||
"jsonfile": "^6.1.0",
|
||||
"ws": "^7.2.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "16.7.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.10.tgz",
|
||||
"integrity": "sha512-S63Dlv4zIPb8x6MMTgDq5WWRJQe56iBEY0O3SOFA9JrRienkOVDXSXBjjJw6HTNQYSE2JI6GMCR6LVbIMHJVvA=="
|
||||
},
|
||||
"node_modules/@types/ws": {
|
||||
"version": "7.4.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz",
|
||||
"integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "0.21.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
|
||||
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/body-parser": {
|
||||
"version": "1.19.0",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
|
||||
"integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
|
||||
"dependencies": {
|
||||
"bytes": "3.1.0",
|
||||
"content-type": "~1.0.4",
|
||||
"debug": "2.6.9",
|
||||
"depd": "~1.1.2",
|
||||
"http-errors": "1.7.2",
|
||||
"iconv-lite": "0.4.24",
|
||||
"on-finished": "~2.3.0",
|
||||
"qs": "6.7.0",
|
||||
"raw-body": "2.4.0",
|
||||
"type-is": "~1.6.17"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/bytes": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
|
||||
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/content-type": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
|
||||
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"dependencies": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/depd": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
|
||||
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/dotenv": {
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
|
||||
"integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.14.3",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.3.tgz",
|
||||
"integrity": "sha512-3MkHxknWMUtb23apkgz/83fDoe+y+qr0TdgacGIA7bew+QLBo3vdgEN2xEsuXNivpFy4CyDhBBZnNZOtalmenw==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"debug": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/graceful-fs": {
|
||||
"version": "4.2.8",
|
||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
|
||||
"integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/http-errors": {
|
||||
"version": "1.7.2",
|
||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
|
||||
"integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
|
||||
"dependencies": {
|
||||
"depd": "~1.1.2",
|
||||
"inherits": "2.0.3",
|
||||
"setprototypeof": "1.1.1",
|
||||
"statuses": ">= 1.5.0 < 2",
|
||||
"toidentifier": "1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
||||
},
|
||||
"node_modules/jsonfile": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
|
||||
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
|
||||
"dependencies": {
|
||||
"universalify": "^2.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"graceful-fs": "^4.1.6"
|
||||
}
|
||||
},
|
||||
"node_modules/media-typer": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.49.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.49.0.tgz",
|
||||
"integrity": "sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "2.1.32",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.32.tgz",
|
||||
"integrity": "sha512-hJGaVS4G4c9TSMYh2n6SQAGrC4RnfU+daP8G7cSCmaqNjiOoUY0VHCMS42pxnQmVF1GWwFhbHWn3RIxCqTmZ9A==",
|
||||
"dependencies": {
|
||||
"mime-db": "1.49.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
},
|
||||
"node_modules/on-finished": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
|
||||
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
|
||||
"dependencies": {
|
||||
"ee-first": "1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.7.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
|
||||
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==",
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/raw-body": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
|
||||
"integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
|
||||
"dependencies": {
|
||||
"bytes": "3.1.0",
|
||||
"http-errors": "1.7.2",
|
||||
"iconv-lite": "0.4.24",
|
||||
"unpipe": "1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"node_modules/setprototypeof": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
|
||||
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
|
||||
},
|
||||
"node_modules/statuses": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
|
||||
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/toidentifier": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
|
||||
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==",
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/type-is": {
|
||||
"version": "1.6.18",
|
||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
||||
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
||||
"dependencies": {
|
||||
"media-typer": "0.3.0",
|
||||
"mime-types": "~2.1.24"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "3.9.10",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz",
|
||||
"integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/universalify": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
|
||||
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "7.5.4",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.4.tgz",
|
||||
"integrity": "sha512-zP9z6GXm6zC27YtspwH99T3qTG7bBFv2VIkeHstMLrLlDJuzA7tQ5ls3OJ1hOGGCzTQPniNJoHXIAOS0Jljohg==",
|
||||
"engines": {
|
||||
"node": ">=8.3.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": "^5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@m3o/m3o-node": {
|
||||
"version": "0.0.24",
|
||||
"resolved": "https://registry.npmjs.org/@m3o/m3o-node/-/m3o-node-0.0.24.tgz",
|
||||
"integrity": "sha512-W6VqmZUTFodwBUai5uQ9nO4ylIztUXKYPFfZg2qqTv1lHkOYQ0XiJgFVn+SEOlp4GU/JI9OzCt4k1Ui5XaXGdw==",
|
||||
"requires": {
|
||||
"@types/ws": "^7.2.2",
|
||||
"axios": "^0.21.1",
|
||||
"body-parser": "^1.19.0",
|
||||
"dotenv": "^10.0.0",
|
||||
"jsonfile": "^6.1.0",
|
||||
"ws": "^7.2.3"
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "16.7.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.10.tgz",
|
||||
"integrity": "sha512-S63Dlv4zIPb8x6MMTgDq5WWRJQe56iBEY0O3SOFA9JrRienkOVDXSXBjjJw6HTNQYSE2JI6GMCR6LVbIMHJVvA=="
|
||||
},
|
||||
"@types/ws": {
|
||||
"version": "7.4.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz",
|
||||
"integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==",
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"axios": {
|
||||
"version": "0.21.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
|
||||
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
|
||||
"requires": {
|
||||
"follow-redirects": "^1.10.0"
|
||||
}
|
||||
},
|
||||
"body-parser": {
|
||||
"version": "1.19.0",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
|
||||
"integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
|
||||
"requires": {
|
||||
"bytes": "3.1.0",
|
||||
"content-type": "~1.0.4",
|
||||
"debug": "2.6.9",
|
||||
"depd": "~1.1.2",
|
||||
"http-errors": "1.7.2",
|
||||
"iconv-lite": "0.4.24",
|
||||
"on-finished": "~2.3.0",
|
||||
"qs": "6.7.0",
|
||||
"raw-body": "2.4.0",
|
||||
"type-is": "~1.6.17"
|
||||
}
|
||||
},
|
||||
"bytes": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
|
||||
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
|
||||
},
|
||||
"content-type": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
|
||||
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
|
||||
},
|
||||
"debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"depd": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
|
||||
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
|
||||
},
|
||||
"dotenv": {
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
|
||||
"integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q=="
|
||||
},
|
||||
"ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.14.3",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.3.tgz",
|
||||
"integrity": "sha512-3MkHxknWMUtb23apkgz/83fDoe+y+qr0TdgacGIA7bew+QLBo3vdgEN2xEsuXNivpFy4CyDhBBZnNZOtalmenw=="
|
||||
},
|
||||
"graceful-fs": {
|
||||
"version": "4.2.8",
|
||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
|
||||
"integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==",
|
||||
"optional": true
|
||||
},
|
||||
"http-errors": {
|
||||
"version": "1.7.2",
|
||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
|
||||
"integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
|
||||
"requires": {
|
||||
"depd": "~1.1.2",
|
||||
"inherits": "2.0.3",
|
||||
"setprototypeof": "1.1.1",
|
||||
"statuses": ">= 1.5.0 < 2",
|
||||
"toidentifier": "1.0.0"
|
||||
}
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
||||
"requires": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
}
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
||||
},
|
||||
"jsonfile": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
|
||||
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.6",
|
||||
"universalify": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"media-typer": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.49.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.49.0.tgz",
|
||||
"integrity": "sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA=="
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.32",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.32.tgz",
|
||||
"integrity": "sha512-hJGaVS4G4c9TSMYh2n6SQAGrC4RnfU+daP8G7cSCmaqNjiOoUY0VHCMS42pxnQmVF1GWwFhbHWn3RIxCqTmZ9A==",
|
||||
"requires": {
|
||||
"mime-db": "1.49.0"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
},
|
||||
"on-finished": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
|
||||
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
|
||||
"requires": {
|
||||
"ee-first": "1.1.1"
|
||||
}
|
||||
},
|
||||
"qs": {
|
||||
"version": "6.7.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
|
||||
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
|
||||
},
|
||||
"raw-body": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
|
||||
"integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
|
||||
"requires": {
|
||||
"bytes": "3.1.0",
|
||||
"http-errors": "1.7.2",
|
||||
"iconv-lite": "0.4.24",
|
||||
"unpipe": "1.0.0"
|
||||
}
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"setprototypeof": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
|
||||
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
|
||||
},
|
||||
"statuses": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
|
||||
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
|
||||
},
|
||||
"toidentifier": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
|
||||
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
|
||||
},
|
||||
"type-is": {
|
||||
"version": "1.6.18",
|
||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
||||
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
||||
"requires": {
|
||||
"media-typer": "0.3.0",
|
||||
"mime-types": "~2.1.24"
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.9.10",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz",
|
||||
"integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==",
|
||||
"dev": true
|
||||
},
|
||||
"universalify": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
|
||||
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ=="
|
||||
},
|
||||
"unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
|
||||
},
|
||||
"ws": {
|
||||
"version": "7.5.4",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.4.tgz",
|
||||
"integrity": "sha512-zP9z6GXm6zC27YtspwH99T3qTG7bBFv2VIkeHstMLrLlDJuzA7tQ5ls3OJ1hOGGCzTQPniNJoHXIAOS0Jljohg==",
|
||||
"requires": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
60
clients/ts/package.json
Normal file
60
clients/ts/package.json
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"author": "",
|
||||
"dependencies": {
|
||||
"@m3o/m3o-node": "^0.0.24"
|
||||
},
|
||||
"description": "",
|
||||
"devDependencies": {
|
||||
"typescript": "^3.5.1"
|
||||
},
|
||||
"exports": {
|
||||
"./address": "./dist/address/index.js",
|
||||
"./answer": "./dist/answer/index.js",
|
||||
"./cache": "./dist/cache/index.js",
|
||||
"./cmd": "./dist/cmd/index.js",
|
||||
"./crypto": "./dist/crypto/index.js",
|
||||
"./currency": "./dist/currency/index.js",
|
||||
"./db": "./dist/db/index.js",
|
||||
"./email": "./dist/email/index.js",
|
||||
"./emoji": "./dist/emoji/index.js",
|
||||
"./file": "./dist/file/index.js",
|
||||
"./forex": "./dist/forex/index.js",
|
||||
"./geocoding": "./dist/geocoding/index.js",
|
||||
"./helloworld": "./dist/helloworld/index.js",
|
||||
"./id": "./dist/id/index.js",
|
||||
"./image": "./dist/image/index.js",
|
||||
"./ip": "./dist/ip/index.js",
|
||||
"./location": "./dist/location/index.js",
|
||||
"./otp": "./dist/otp/index.js",
|
||||
"./pkg": "./dist/pkg/index.js",
|
||||
"./postcode": "./dist/postcode/index.js",
|
||||
"./quran": "./dist/quran/index.js",
|
||||
"./routing": "./dist/routing/index.js",
|
||||
"./rss": "./dist/rss/index.js",
|
||||
"./sentiment": "./dist/sentiment/index.js",
|
||||
"./sms": "./dist/sms/index.js",
|
||||
"./stock": "./dist/stock/index.js",
|
||||
"./stream": "./dist/stream/index.js",
|
||||
"./test": "./dist/test/index.js",
|
||||
"./thumbnail": "./dist/thumbnail/index.js",
|
||||
"./time": "./dist/time/index.js",
|
||||
"./url": "./dist/url/index.js",
|
||||
"./user": "./dist/user/index.js",
|
||||
"./weather": "./dist/weather/index.js"
|
||||
},
|
||||
"license": "ISC",
|
||||
"main": "dist/index.js",
|
||||
"name": "m3o",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/micro/services"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"prepare": "npm run build",
|
||||
"test": "echo \"Error: no test specified\" \u0026\u0026 exit 1"
|
||||
},
|
||||
"type": "module",
|
||||
"types": "dist/index.d.ts",
|
||||
"version": "1.0.509"
|
||||
}
|
||||
84
clients/ts/postcode/index.ts
Executable file
84
clients/ts/postcode/index.ts
Executable file
@@ -0,0 +1,84 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class PostcodeService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Lookup a postcode to retrieve the related region, county, etc
|
||||
lookup(request: LookupRequest): Promise<LookupResponse> {
|
||||
return this.client.call(
|
||||
"postcode",
|
||||
"Lookup",
|
||||
request
|
||||
) as Promise<LookupResponse>;
|
||||
}
|
||||
// Return a random postcode and its related info
|
||||
random(request: RandomRequest): Promise<RandomResponse> {
|
||||
return this.client.call(
|
||||
"postcode",
|
||||
"Random",
|
||||
request
|
||||
) as Promise<RandomResponse>;
|
||||
}
|
||||
// Validate a postcode.
|
||||
validate(request: ValidateRequest): Promise<ValidateResponse> {
|
||||
return this.client.call(
|
||||
"postcode",
|
||||
"Validate",
|
||||
request
|
||||
) as Promise<ValidateResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface LookupRequest {
|
||||
// UK postcode e.g SW1A 2AA
|
||||
postcode?: string;
|
||||
}
|
||||
|
||||
export interface LookupResponse {
|
||||
// country e.g United Kingdom
|
||||
country?: string;
|
||||
// e.g Westminster
|
||||
district?: string;
|
||||
// e.g 51.50354
|
||||
latitude?: number;
|
||||
// e.g -0.127695
|
||||
longitude?: number;
|
||||
// UK postcode e.g SW1A 2AA
|
||||
postcode?: string;
|
||||
// related region e.g London
|
||||
region?: string;
|
||||
// e.g St James's
|
||||
ward?: string;
|
||||
}
|
||||
|
||||
export interface RandomRequest {}
|
||||
|
||||
export interface RandomResponse {
|
||||
// country e.g United Kingdom
|
||||
country?: string;
|
||||
// e.g Westminster
|
||||
district?: string;
|
||||
// e.g 51.50354
|
||||
latitude?: number;
|
||||
// e.g -0.127695
|
||||
longitude?: number;
|
||||
// UK postcode e.g SW1A 2AA
|
||||
postcode?: string;
|
||||
// related region e.g London
|
||||
region?: string;
|
||||
// e.g St James's
|
||||
ward?: string;
|
||||
}
|
||||
|
||||
export interface ValidateRequest {
|
||||
// UK postcode e.g SW1A 2AA
|
||||
postcode?: string;
|
||||
}
|
||||
|
||||
export interface ValidateResponse {
|
||||
// Is the postcode valid (true) or not (false)
|
||||
valid?: boolean;
|
||||
}
|
||||
216
clients/ts/quran/index.ts
Executable file
216
clients/ts/quran/index.ts
Executable file
@@ -0,0 +1,216 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class QuranService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// List the Chapters (surahs) of the Quran
|
||||
chapters(request: ChaptersRequest): Promise<ChaptersResponse> {
|
||||
return this.client.call(
|
||||
"quran",
|
||||
"Chapters",
|
||||
request
|
||||
) as Promise<ChaptersResponse>;
|
||||
}
|
||||
// Search the Quran for any form of query or questions
|
||||
search(request: SearchRequest): Promise<SearchResponse> {
|
||||
return this.client.call(
|
||||
"quran",
|
||||
"Search",
|
||||
request
|
||||
) as Promise<SearchResponse>;
|
||||
}
|
||||
// Get a summary for a given chapter (surah)
|
||||
summary(request: SummaryRequest): Promise<SummaryResponse> {
|
||||
return this.client.call(
|
||||
"quran",
|
||||
"Summary",
|
||||
request
|
||||
) as Promise<SummaryResponse>;
|
||||
}
|
||||
// Lookup the verses (ayahs) for a chapter
|
||||
verses(request: VersesRequest): Promise<VersesResponse> {
|
||||
return this.client.call(
|
||||
"quran",
|
||||
"Verses",
|
||||
request
|
||||
) as Promise<VersesResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Chapter {
|
||||
// The arabic name of the chapter
|
||||
arabicName?: string;
|
||||
// The complex name of the chapter
|
||||
complexName?: string;
|
||||
// The id of the chapter as a number e.g 1
|
||||
id?: number;
|
||||
// The simple name of the chapter
|
||||
name?: string;
|
||||
// The pages from and to e.g 1, 1
|
||||
pages?: number[];
|
||||
// Should the chapter start with bismillah
|
||||
prefixBismillah?: boolean;
|
||||
// The order in which it was revealed
|
||||
revelationOrder?: number;
|
||||
// The place of revelation
|
||||
revelationPlace?: string;
|
||||
// The translated name
|
||||
translatedName?: string;
|
||||
// The number of verses in the chapter
|
||||
verses?: number;
|
||||
}
|
||||
|
||||
export interface ChaptersRequest {
|
||||
// Specify the language e.g en
|
||||
language?: string;
|
||||
}
|
||||
|
||||
export interface ChaptersResponse {
|
||||
chapters?: Chapter[];
|
||||
}
|
||||
|
||||
export interface Interpretation {
|
||||
// The unique id of the interpretation
|
||||
id?: number;
|
||||
// The source of the interpretation
|
||||
source?: string;
|
||||
// The translated text
|
||||
text?: string;
|
||||
}
|
||||
|
||||
export interface Result {
|
||||
// The associated arabic text
|
||||
text?: string;
|
||||
// The related translations to the text
|
||||
translations?: Interpretation[];
|
||||
// The unique verse id across the Quran
|
||||
verseId?: number;
|
||||
// The verse key e.g 1:1
|
||||
verseKey?: string;
|
||||
}
|
||||
|
||||
export interface SearchRequest {
|
||||
// The language for translation
|
||||
language?: string;
|
||||
// The number of results to return
|
||||
limit?: number;
|
||||
// The pagination number
|
||||
page?: number;
|
||||
// The query to ask
|
||||
query?: string;
|
||||
}
|
||||
|
||||
export interface SearchResponse {
|
||||
// The current page
|
||||
page?: number;
|
||||
// The question asked
|
||||
query?: string;
|
||||
// The results for the query
|
||||
results?: Result[];
|
||||
// The total pages
|
||||
totalPages?: number;
|
||||
// The total results returned
|
||||
totalResults?: number;
|
||||
}
|
||||
|
||||
export interface SummaryRequest {
|
||||
// The chapter id e.g 1
|
||||
chapter?: number;
|
||||
// Specify the language e.g en
|
||||
language?: string;
|
||||
}
|
||||
|
||||
export interface SummaryResponse {
|
||||
// The chapter id
|
||||
chapter?: number;
|
||||
// The source of the summary
|
||||
source?: string;
|
||||
// The short summary for the chapter
|
||||
summary?: string;
|
||||
// The full description for the chapter
|
||||
text?: string;
|
||||
}
|
||||
|
||||
export interface Translation {
|
||||
// The unique id of the translation
|
||||
id?: number;
|
||||
// The source of the translation
|
||||
source?: string;
|
||||
// The translated text
|
||||
text?: string;
|
||||
}
|
||||
|
||||
export interface Verse {
|
||||
// The unique id of the verse in the whole book
|
||||
id?: number;
|
||||
// The interpretations of the verse
|
||||
interpretations?: Translation[];
|
||||
// The key of this verse (chapter:verse) e.g 1:1
|
||||
key?: string;
|
||||
// The verse number in this chapter
|
||||
number?: number;
|
||||
// The page of the Quran this verse is on
|
||||
page?: number;
|
||||
// The arabic text for this verse
|
||||
text?: string;
|
||||
// The basic translation of the verse
|
||||
translatedText?: string;
|
||||
// The alternative translations for the verse
|
||||
translations?: Translation[];
|
||||
// The phonetic transliteration from arabic
|
||||
transliteration?: string;
|
||||
// The individual words within the verse (Ayah)
|
||||
words?: Word[];
|
||||
}
|
||||
|
||||
export interface VersesRequest {
|
||||
// The chapter id to retrieve
|
||||
chapter?: number;
|
||||
// Return the interpretation (tafsir)
|
||||
interpret?: boolean;
|
||||
// The language of translation
|
||||
language?: string;
|
||||
// The verses per page
|
||||
limit?: number;
|
||||
// The page number to request
|
||||
page?: number;
|
||||
// Return alternate translations
|
||||
translate?: boolean;
|
||||
// Return the individual words with the verses
|
||||
words?: boolean;
|
||||
}
|
||||
|
||||
export interface VersesResponse {
|
||||
// The chapter requested
|
||||
chapter?: number;
|
||||
// The page requested
|
||||
page?: number;
|
||||
// The total pages
|
||||
totalPages?: number;
|
||||
// The verses on the page
|
||||
verses?: Verse[];
|
||||
}
|
||||
|
||||
export interface Word {
|
||||
// The character type e.g word, end
|
||||
charType?: string;
|
||||
// The QCF v2 font code
|
||||
code?: string;
|
||||
// The id of the word within the verse
|
||||
id?: number;
|
||||
// The line number
|
||||
line?: number;
|
||||
// The page number
|
||||
page?: number;
|
||||
// The position of the word
|
||||
position?: number;
|
||||
// The arabic text for this word
|
||||
text?: string;
|
||||
// The translated text
|
||||
translation?: string;
|
||||
// The transliteration text
|
||||
transliteration?: string;
|
||||
}
|
||||
123
clients/ts/routing/index.ts
Executable file
123
clients/ts/routing/index.ts
Executable file
@@ -0,0 +1,123 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class RoutingService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Turn by turn directions from a start point to an end point including maneuvers and bearings
|
||||
directions(request: DirectionsRequest): Promise<DirectionsResponse> {
|
||||
return this.client.call(
|
||||
"routing",
|
||||
"Directions",
|
||||
request
|
||||
) as Promise<DirectionsResponse>;
|
||||
}
|
||||
// Get the eta for a route from origin to destination. The eta is an estimated time based on car routes
|
||||
eta(request: EtaRequest): Promise<EtaResponse> {
|
||||
return this.client.call("routing", "Eta", request) as Promise<EtaResponse>;
|
||||
}
|
||||
// Retrieve a route as a simple list of gps points along with total distance and estimated duration
|
||||
route(request: RouteRequest): Promise<RouteResponse> {
|
||||
return this.client.call(
|
||||
"routing",
|
||||
"Route",
|
||||
request
|
||||
) as Promise<RouteResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Direction {
|
||||
// distance to travel in meters
|
||||
distance?: number;
|
||||
// duration to travel in seconds
|
||||
duration?: number;
|
||||
// human readable instruction
|
||||
instruction?: string;
|
||||
// intersections on route
|
||||
intersections?: Intersection[];
|
||||
// maneuver to take
|
||||
maneuver?: { [key: string]: any };
|
||||
// street name or location
|
||||
name?: string;
|
||||
// alternative reference
|
||||
reference?: string;
|
||||
}
|
||||
|
||||
export interface DirectionsRequest {
|
||||
// The destination of the journey
|
||||
destination?: Point;
|
||||
// The staring point for the journey
|
||||
origin?: Point;
|
||||
}
|
||||
|
||||
export interface DirectionsResponse {
|
||||
// Turn by turn directions
|
||||
directions?: Direction[];
|
||||
// Estimated distance of the route in meters
|
||||
distance?: number;
|
||||
// Estimated duration of the route in seconds
|
||||
duration?: number;
|
||||
// The waypoints on the route
|
||||
waypoints?: Waypoint[];
|
||||
}
|
||||
|
||||
export interface EtaRequest {
|
||||
// The end point for the eta calculation
|
||||
destination?: Point;
|
||||
// The starting point for the eta calculation
|
||||
origin?: Point;
|
||||
// speed in kilometers
|
||||
speed?: number;
|
||||
// type of transport. Only "car" is supported currently.
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export interface EtaResponse {
|
||||
// eta in seconds
|
||||
duration?: number;
|
||||
}
|
||||
|
||||
export interface Intersection {
|
||||
bearings?: number[];
|
||||
location?: Point;
|
||||
}
|
||||
|
||||
export interface Maneuver {
|
||||
action?: string;
|
||||
bearingAfter?: number;
|
||||
bearingBefore?: number;
|
||||
direction?: string;
|
||||
location?: Point;
|
||||
}
|
||||
|
||||
export interface Point {
|
||||
// Lat e.g 52.523219
|
||||
latitude?: number;
|
||||
// Long e.g 13.428555
|
||||
longitude?: number;
|
||||
}
|
||||
|
||||
export interface RouteRequest {
|
||||
// Point of destination for the trip
|
||||
destination?: Point;
|
||||
// Point of origin for the trip
|
||||
origin?: Point;
|
||||
}
|
||||
|
||||
export interface RouteResponse {
|
||||
// estimated distance in meters
|
||||
distance?: number;
|
||||
// estimated duration in seconds
|
||||
duration?: number;
|
||||
// waypoints on the route
|
||||
waypoints?: Waypoint[];
|
||||
}
|
||||
|
||||
export interface Waypoint {
|
||||
// gps point coordinates
|
||||
location?: Point;
|
||||
// street name or related reference
|
||||
name?: string;
|
||||
}
|
||||
99
clients/ts/rss/index.ts
Executable file
99
clients/ts/rss/index.ts
Executable file
@@ -0,0 +1,99 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class RssService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Add a new RSS feed with a name, url, and category
|
||||
add(request: AddRequest): Promise<AddResponse> {
|
||||
return this.client.call("rss", "Add", request) as Promise<AddResponse>;
|
||||
}
|
||||
// Get an RSS feed by name. If no name is given, all feeds are returned. Default limit is 25 entries.
|
||||
feed(request: FeedRequest): Promise<FeedResponse> {
|
||||
return this.client.call("rss", "Feed", request) as Promise<FeedResponse>;
|
||||
}
|
||||
// List the saved RSS fields
|
||||
list(request: ListRequest): Promise<ListResponse> {
|
||||
return this.client.call("rss", "List", request) as Promise<ListResponse>;
|
||||
}
|
||||
// Remove an RSS feed by name
|
||||
remove(request: RemoveRequest): Promise<RemoveResponse> {
|
||||
return this.client.call(
|
||||
"rss",
|
||||
"Remove",
|
||||
request
|
||||
) as Promise<RemoveResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface AddRequest {
|
||||
// category to add e.g news
|
||||
category?: string;
|
||||
// rss feed name
|
||||
// eg. a16z
|
||||
name?: string;
|
||||
// rss feed url
|
||||
// eg. http://a16z.com/feed/
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export interface AddResponse {}
|
||||
|
||||
export interface Entry {
|
||||
// article content
|
||||
content?: string;
|
||||
// data of the entry
|
||||
date?: string;
|
||||
// the rss feed where it came from
|
||||
feed?: string;
|
||||
// unique id of the entry
|
||||
id?: string;
|
||||
// rss feed url of the entry
|
||||
link?: string;
|
||||
// article summary
|
||||
summary?: string;
|
||||
// title of the entry
|
||||
title?: string;
|
||||
}
|
||||
|
||||
export interface Feed {
|
||||
// category of the feed e.g news
|
||||
category?: string;
|
||||
// unique id
|
||||
id?: string;
|
||||
// rss feed name
|
||||
// eg. a16z
|
||||
name?: string;
|
||||
// rss feed url
|
||||
// eg. http://a16z.com/feed/
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export interface FeedRequest {
|
||||
// limit entries returned
|
||||
limit?: number;
|
||||
// rss feed name
|
||||
name?: string;
|
||||
// offset entries
|
||||
offset?: number;
|
||||
}
|
||||
|
||||
export interface FeedResponse {
|
||||
entries?: Entry[];
|
||||
}
|
||||
|
||||
export interface ListRequest {}
|
||||
|
||||
export interface ListResponse {
|
||||
feeds?: Feed[];
|
||||
}
|
||||
|
||||
export interface RemoveRequest {
|
||||
// rss feed name
|
||||
// eg. a16z
|
||||
name?: string;
|
||||
}
|
||||
|
||||
export interface RemoveResponse {}
|
||||
29
clients/ts/sentiment/index.ts
Executable file
29
clients/ts/sentiment/index.ts
Executable file
@@ -0,0 +1,29 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class SentimentService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Analyze and score a piece of text
|
||||
analyze(request: AnalyzeRequest): Promise<AnalyzeResponse> {
|
||||
return this.client.call(
|
||||
"sentiment",
|
||||
"Analyze",
|
||||
request
|
||||
) as Promise<AnalyzeResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface AnalyzeRequest {
|
||||
// The language. Defaults to english.
|
||||
lang?: string;
|
||||
// The text to analyze
|
||||
text?: string;
|
||||
}
|
||||
|
||||
export interface AnalyzeResponse {
|
||||
// The score of the text {positive is 1, negative is 0}
|
||||
score?: number;
|
||||
}
|
||||
29
clients/ts/sms/index.ts
Executable file
29
clients/ts/sms/index.ts
Executable file
@@ -0,0 +1,29 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class SmsService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Send an SMS.
|
||||
send(request: SendRequest): Promise<SendResponse> {
|
||||
return this.client.call("sms", "Send", request) as Promise<SendResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface SendRequest {
|
||||
// who is the message from? The message will be suffixed with "Sent from <from>"
|
||||
from?: string;
|
||||
// the main body of the message to send
|
||||
message?: string;
|
||||
// the destination phone number including the international dialling code (e.g. +44)
|
||||
to?: string;
|
||||
}
|
||||
|
||||
export interface SendResponse {
|
||||
// any additional info
|
||||
info?: string;
|
||||
// will return "ok" if successful
|
||||
status?: string;
|
||||
}
|
||||
132
clients/ts/stock/index.ts
Executable file
132
clients/ts/stock/index.ts
Executable file
@@ -0,0 +1,132 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class StockService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Get the historic open-close for a given day
|
||||
history(request: HistoryRequest): Promise<HistoryResponse> {
|
||||
return this.client.call(
|
||||
"stock",
|
||||
"History",
|
||||
request
|
||||
) as Promise<HistoryResponse>;
|
||||
}
|
||||
// Get the historic order book and each trade by timestamp
|
||||
orderBook(request: OrderBookRequest): Promise<OrderBookResponse> {
|
||||
return this.client.call(
|
||||
"stock",
|
||||
"OrderBook",
|
||||
request
|
||||
) as Promise<OrderBookResponse>;
|
||||
}
|
||||
// Get the last price for a given stock ticker
|
||||
price(request: PriceRequest): Promise<PriceResponse> {
|
||||
return this.client.call(
|
||||
"stock",
|
||||
"Price",
|
||||
request
|
||||
) as Promise<PriceResponse>;
|
||||
}
|
||||
// Get the last quote for the stock
|
||||
quote(request: QuoteRequest): Promise<QuoteResponse> {
|
||||
return this.client.call(
|
||||
"stock",
|
||||
"Quote",
|
||||
request
|
||||
) as Promise<QuoteResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface HistoryRequest {
|
||||
// date to retrieve as YYYY-MM-DD
|
||||
date?: string;
|
||||
// the stock symbol e.g AAPL
|
||||
stock?: string;
|
||||
}
|
||||
|
||||
export interface HistoryResponse {
|
||||
// the close price
|
||||
close?: number;
|
||||
// the date
|
||||
date?: string;
|
||||
// the peak price
|
||||
high?: number;
|
||||
// the low price
|
||||
low?: number;
|
||||
// the open price
|
||||
open?: number;
|
||||
// the stock symbol
|
||||
symbol?: string;
|
||||
// the volume
|
||||
volume?: number;
|
||||
}
|
||||
|
||||
export interface Order {
|
||||
// the asking price
|
||||
askPrice?: number;
|
||||
// the ask size
|
||||
askSize?: number;
|
||||
// the bidding price
|
||||
bidPrice?: number;
|
||||
// the bid size
|
||||
bidSize?: number;
|
||||
// the UTC timestamp of the quote
|
||||
timestamp?: string;
|
||||
}
|
||||
|
||||
export interface OrderBookRequest {
|
||||
// the date in format YYYY-MM-dd
|
||||
date?: string;
|
||||
// optional RFC3339Nano end time e.g 2006-01-02T15:04:05.999999999Z07:00
|
||||
end?: string;
|
||||
// limit number of prices
|
||||
limit?: number;
|
||||
// optional RFC3339Nano start time e.g 2006-01-02T15:04:05.999999999Z07:00
|
||||
start?: string;
|
||||
// stock to retrieve e.g AAPL
|
||||
stock?: string;
|
||||
}
|
||||
|
||||
export interface OrderBookResponse {
|
||||
// date of the request
|
||||
date?: string;
|
||||
// list of orders
|
||||
orders?: Order[];
|
||||
// the stock symbol
|
||||
symbol?: string;
|
||||
}
|
||||
|
||||
export interface PriceRequest {
|
||||
// stock symbol e.g AAPL
|
||||
symbol?: string;
|
||||
}
|
||||
|
||||
export interface PriceResponse {
|
||||
// the last price
|
||||
price?: number;
|
||||
// the stock symbol e.g AAPL
|
||||
symbol?: string;
|
||||
}
|
||||
|
||||
export interface QuoteRequest {
|
||||
// the stock symbol e.g AAPL
|
||||
symbol?: string;
|
||||
}
|
||||
|
||||
export interface QuoteResponse {
|
||||
// the asking price
|
||||
askPrice?: number;
|
||||
// the ask size
|
||||
askSize?: number;
|
||||
// the bidding price
|
||||
bidPrice?: number;
|
||||
// the bid size
|
||||
bidSize?: number;
|
||||
// the stock symbol
|
||||
symbol?: string;
|
||||
// the UTC timestamp of the quote
|
||||
timestamp?: string;
|
||||
}
|
||||
46
clients/ts/stream/index.ts
Executable file
46
clients/ts/stream/index.ts
Executable file
@@ -0,0 +1,46 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class StreamService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Publish a message to the stream. Specify a topic to group messages for a specific topic.
|
||||
publish(request: PublishRequest): Promise<PublishResponse> {
|
||||
return this.client.call(
|
||||
"stream",
|
||||
"Publish",
|
||||
request
|
||||
) as Promise<PublishResponse>;
|
||||
}
|
||||
// Subscribe to messages for a given topic.
|
||||
subscribe(request: SubscribeRequest): Promise<SubscribeResponse> {
|
||||
return this.client.call(
|
||||
"stream",
|
||||
"Subscribe",
|
||||
request
|
||||
) as Promise<SubscribeResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface PublishRequest {
|
||||
// The json message to publish
|
||||
message?: { [key: string]: any };
|
||||
// The topic to publish to
|
||||
topic?: string;
|
||||
}
|
||||
|
||||
export interface PublishResponse {}
|
||||
|
||||
export interface SubscribeRequest {
|
||||
// The topic to subscribe to
|
||||
topic?: string;
|
||||
}
|
||||
|
||||
export interface SubscribeResponse {
|
||||
// The next json message on the topic
|
||||
message?: { [key: string]: any };
|
||||
// The topic subscribed to
|
||||
topic?: string;
|
||||
}
|
||||
29
clients/ts/thumbnail/index.ts
Executable file
29
clients/ts/thumbnail/index.ts
Executable file
@@ -0,0 +1,29 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class ThumbnailService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Create a thumbnail screenshot by passing in a url, height and width
|
||||
screenshot(request: ScreenshotRequest): Promise<ScreenshotResponse> {
|
||||
return this.client.call(
|
||||
"thumbnail",
|
||||
"Screenshot",
|
||||
request
|
||||
) as Promise<ScreenshotResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface ScreenshotRequest {
|
||||
// height of the browser window, optional
|
||||
height?: number;
|
||||
url?: string;
|
||||
// width of the browser window. optional
|
||||
width?: number;
|
||||
}
|
||||
|
||||
export interface ScreenshotResponse {
|
||||
imageURL?: string;
|
||||
}
|
||||
61
clients/ts/time/index.ts
Executable file
61
clients/ts/time/index.ts
Executable file
@@ -0,0 +1,61 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class TimeService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Get the current time
|
||||
now(request: NowRequest): Promise<NowResponse> {
|
||||
return this.client.call("time", "Now", request) as Promise<NowResponse>;
|
||||
}
|
||||
// Get the timezone info for a specific location
|
||||
zone(request: ZoneRequest): Promise<ZoneResponse> {
|
||||
return this.client.call("time", "Zone", request) as Promise<ZoneResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface NowRequest {
|
||||
// optional location, otherwise returns UTC
|
||||
location?: string;
|
||||
}
|
||||
|
||||
export interface NowResponse {
|
||||
// the current time as HH:MM:SS
|
||||
localtime?: string;
|
||||
// the location as Europe/London
|
||||
location?: string;
|
||||
// timestamp as 2006-01-02T15:04:05.999999999Z07:00
|
||||
timestamp?: string;
|
||||
// the timezone as BST
|
||||
timezone?: string;
|
||||
// the unix timestamp
|
||||
unix?: number;
|
||||
}
|
||||
|
||||
export interface ZoneRequest {
|
||||
// location to lookup e.g postcode, city, ip address
|
||||
location?: string;
|
||||
}
|
||||
|
||||
export interface ZoneResponse {
|
||||
// the abbreviated code e.g BST
|
||||
abbreviation?: string;
|
||||
// country of the timezone
|
||||
country?: string;
|
||||
// is daylight savings
|
||||
dst?: boolean;
|
||||
// e.g 51.42
|
||||
latitude?: number;
|
||||
// the local time
|
||||
localtime?: string;
|
||||
// location requested
|
||||
location?: string;
|
||||
// e.g -0.37
|
||||
longitude?: number;
|
||||
// region of timezone
|
||||
region?: string;
|
||||
// the timezone e.g Europe/London
|
||||
timezone?: string;
|
||||
}
|
||||
16
clients/ts/tsconfig.json
Normal file
16
clients/ts/tsconfig.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "es6",
|
||||
"target": "es5",
|
||||
"declaration": true,
|
||||
"lib": ["es2015", "dom"],
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"outDir": "./dist",
|
||||
"strict": true,
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"include": ["index.ts", "./*"],
|
||||
"exclude": ["src/**/*.spec.*", "./dist", "./node_modules"]
|
||||
}
|
||||
63
clients/ts/url/index.ts
Executable file
63
clients/ts/url/index.ts
Executable file
@@ -0,0 +1,63 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class UrlService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// List information on all the shortened URLs that you have created
|
||||
list(request: ListRequest): Promise<ListResponse> {
|
||||
return this.client.call("url", "List", request) as Promise<ListResponse>;
|
||||
}
|
||||
// Proxy returns the destination URL of a short URL.
|
||||
proxy(request: ProxyRequest): Promise<ProxyResponse> {
|
||||
return this.client.call("url", "Proxy", request) as Promise<ProxyResponse>;
|
||||
}
|
||||
// Shortens a destination URL and returns a full short URL.
|
||||
shorten(request: ShortenRequest): Promise<ShortenResponse> {
|
||||
return this.client.call(
|
||||
"url",
|
||||
"Shorten",
|
||||
request
|
||||
) as Promise<ShortenResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface ListRequest {
|
||||
// filter by short URL, optional
|
||||
shortURL?: string;
|
||||
}
|
||||
|
||||
export interface ListResponse {
|
||||
urlPairs?: URLPair;
|
||||
}
|
||||
|
||||
export interface ProxyRequest {
|
||||
// short url ID, without the domain, eg. if your short URL is
|
||||
// `m3o.one/u/someshorturlid` then pass in `someshorturlid`
|
||||
shortURL?: string;
|
||||
}
|
||||
|
||||
export interface ProxyResponse {
|
||||
destinationURL?: string;
|
||||
}
|
||||
|
||||
export interface ShortenRequest {
|
||||
destinationURL?: string;
|
||||
}
|
||||
|
||||
export interface ShortenResponse {
|
||||
shortURL?: string;
|
||||
}
|
||||
|
||||
export interface URLPair {
|
||||
created?: number;
|
||||
destinationURL?: string;
|
||||
// HitCount keeps track many times the short URL has been resolved.
|
||||
// Hitcount only gets saved to disk (database) after every 10th hit, so
|
||||
// its not intended to be 100% accurate, more like an almost correct estimate.
|
||||
hitCount?: number;
|
||||
owner?: string;
|
||||
shortURL?: string;
|
||||
}
|
||||
233
clients/ts/user/index.ts
Executable file
233
clients/ts/user/index.ts
Executable file
@@ -0,0 +1,233 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class UserService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Create a new user account. The email address and username for the account must be unique.
|
||||
create(request: CreateRequest): Promise<CreateResponse> {
|
||||
return this.client.call(
|
||||
"user",
|
||||
"Create",
|
||||
request
|
||||
) as Promise<CreateResponse>;
|
||||
}
|
||||
// Delete an account by id
|
||||
delete(request: DeleteRequest): Promise<DeleteResponse> {
|
||||
return this.client.call(
|
||||
"user",
|
||||
"Delete",
|
||||
request
|
||||
) as Promise<DeleteResponse>;
|
||||
}
|
||||
// Login using username or email. The response will return a new session for successful login,
|
||||
// 401 in the case of login failure and 500 for any other error
|
||||
login(request: LoginRequest): Promise<LoginResponse> {
|
||||
return this.client.call("user", "Login", request) as Promise<LoginResponse>;
|
||||
}
|
||||
// Logout a user account
|
||||
logout(request: LogoutRequest): Promise<LogoutResponse> {
|
||||
return this.client.call(
|
||||
"user",
|
||||
"Logout",
|
||||
request
|
||||
) as Promise<LogoutResponse>;
|
||||
}
|
||||
// Read an account by id, username or email. Only one need to be specified.
|
||||
read(request: ReadRequest): Promise<ReadResponse> {
|
||||
return this.client.call("user", "Read", request) as Promise<ReadResponse>;
|
||||
}
|
||||
// Read a session by the session id. In the event it has expired or is not found and error is returned.
|
||||
readSession(request: ReadSessionRequest): Promise<ReadSessionResponse> {
|
||||
return this.client.call(
|
||||
"user",
|
||||
"ReadSession",
|
||||
request
|
||||
) as Promise<ReadSessionResponse>;
|
||||
}
|
||||
// Send a verification email
|
||||
// to the user being signed up. Email from will be from 'support@m3o.com',
|
||||
// but you can provide the title and contents.
|
||||
// The verification link will be injected in to the email as a template variable, $micro_verification_link.
|
||||
// Example: 'Hi there, welcome onboard! Use the link below to verify your email: $micro_verification_link'
|
||||
// The variable will be replaced with an actual url that will look similar to this:
|
||||
// 'https://user.m3o.com/user/verify?token=a-verification-token&rediretUrl=your-redir-url'
|
||||
sendVerificationEmail(
|
||||
request: SendVerificationEmailRequest
|
||||
): Promise<SendVerificationEmailResponse> {
|
||||
return this.client.call(
|
||||
"user",
|
||||
"SendVerificationEmail",
|
||||
request
|
||||
) as Promise<SendVerificationEmailResponse>;
|
||||
}
|
||||
// Update the account password
|
||||
updatePassword(
|
||||
request: UpdatePasswordRequest
|
||||
): Promise<UpdatePasswordResponse> {
|
||||
return this.client.call(
|
||||
"user",
|
||||
"UpdatePassword",
|
||||
request
|
||||
) as Promise<UpdatePasswordResponse>;
|
||||
}
|
||||
// Update the account username or email
|
||||
update(request: UpdateRequest): Promise<UpdateResponse> {
|
||||
return this.client.call(
|
||||
"user",
|
||||
"Update",
|
||||
request
|
||||
) as Promise<UpdateResponse>;
|
||||
}
|
||||
// Verify the email address of an account from a token sent in an email to the user.
|
||||
verifyEmail(request: VerifyEmailRequest): Promise<VerifyEmailResponse> {
|
||||
return this.client.call(
|
||||
"user",
|
||||
"VerifyEmail",
|
||||
request
|
||||
) as Promise<VerifyEmailResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Account {
|
||||
// unix timestamp
|
||||
created?: number;
|
||||
// an email address
|
||||
email?: string;
|
||||
// unique account id
|
||||
id?: string;
|
||||
// Store any custom data you want about your users in this fields.
|
||||
profile?: { [key: string]: string };
|
||||
// unix timestamp
|
||||
updated?: number;
|
||||
// alphanumeric username
|
||||
username?: string;
|
||||
verificationDate?: number;
|
||||
verified?: boolean;
|
||||
}
|
||||
|
||||
export interface CreateRequest {
|
||||
// the email address
|
||||
email?: string;
|
||||
// optional account id
|
||||
id?: string;
|
||||
// the user password
|
||||
password?: string;
|
||||
// optional user profile as map<string,string>
|
||||
profile?: { [key: string]: string };
|
||||
// the username
|
||||
username?: string;
|
||||
}
|
||||
|
||||
export interface CreateResponse {
|
||||
account?: { [key: string]: any };
|
||||
}
|
||||
|
||||
export interface DeleteRequest {
|
||||
// the account id
|
||||
id?: string;
|
||||
}
|
||||
|
||||
export interface DeleteResponse {}
|
||||
|
||||
export interface LoginRequest {
|
||||
// The email address of the user
|
||||
email?: string;
|
||||
// The password of the user
|
||||
password?: string;
|
||||
// The username of the user
|
||||
username?: string;
|
||||
}
|
||||
|
||||
export interface LoginResponse {
|
||||
// The session of the logged in user
|
||||
session?: { [key: string]: any };
|
||||
}
|
||||
|
||||
export interface LogoutRequest {
|
||||
sessionId?: string;
|
||||
}
|
||||
|
||||
export interface LogoutResponse {}
|
||||
|
||||
export interface ReadRequest {
|
||||
// the account email
|
||||
email?: string;
|
||||
// the account id
|
||||
id?: string;
|
||||
// the account username
|
||||
username?: string;
|
||||
}
|
||||
|
||||
export interface ReadResponse {
|
||||
account?: { [key: string]: any };
|
||||
}
|
||||
|
||||
export interface ReadSessionRequest {
|
||||
// The unique session id
|
||||
sessionId?: string;
|
||||
}
|
||||
|
||||
export interface ReadSessionResponse {
|
||||
session?: { [key: string]: any };
|
||||
}
|
||||
|
||||
export interface SendVerificationEmailRequest {
|
||||
email?: string;
|
||||
failureRedirectUrl?: string;
|
||||
// Display name of the sender for the email. Note: the email address will still be 'support@m3o.com'
|
||||
fromName?: string;
|
||||
redirectUrl?: string;
|
||||
subject?: string;
|
||||
// Text content of the email. Don't forget to include the string '$micro_verification_link' which will be replaced by the real verification link
|
||||
// HTML emails are not available currently.
|
||||
textContent?: string;
|
||||
}
|
||||
|
||||
export interface SendVerificationEmailResponse {}
|
||||
|
||||
export interface Session {
|
||||
// unix timestamp
|
||||
created?: number;
|
||||
// unix timestamp
|
||||
expires?: number;
|
||||
// the session id
|
||||
id?: string;
|
||||
// the associated user id
|
||||
userId?: string;
|
||||
}
|
||||
|
||||
export interface UpdatePasswordRequest {
|
||||
// confirm new password
|
||||
confirmPassword?: string;
|
||||
// the new password
|
||||
newPassword?: string;
|
||||
// the old password
|
||||
oldPassword?: string;
|
||||
// the account id
|
||||
userId?: string;
|
||||
}
|
||||
|
||||
export interface UpdatePasswordResponse {}
|
||||
|
||||
export interface UpdateRequest {
|
||||
// the new email address
|
||||
email?: string;
|
||||
// the account id
|
||||
id?: string;
|
||||
// the user profile as map<string,string>
|
||||
profile?: { [key: string]: string };
|
||||
// the new username
|
||||
username?: string;
|
||||
}
|
||||
|
||||
export interface UpdateResponse {}
|
||||
|
||||
export interface VerifyEmailRequest {
|
||||
// The token from the verification email
|
||||
token?: string;
|
||||
}
|
||||
|
||||
export interface VerifyEmailResponse {}
|
||||
124
clients/ts/weather/index.ts
Executable file
124
clients/ts/weather/index.ts
Executable file
@@ -0,0 +1,124 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class WeatherService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Get the weather forecast for the next 1-10 days
|
||||
forecast(request: ForecastRequest): Promise<ForecastResponse> {
|
||||
return this.client.call(
|
||||
"weather",
|
||||
"Forecast",
|
||||
request
|
||||
) as Promise<ForecastResponse>;
|
||||
}
|
||||
// Get the current weather report for a location by postcode, city, zip code, ip address
|
||||
now(request: NowRequest): Promise<NowResponse> {
|
||||
return this.client.call("weather", "Now", request) as Promise<NowResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Forecast {
|
||||
// the average temp in celsius
|
||||
avgTempC?: number;
|
||||
// the average temp in fahrenheit
|
||||
avgTempF?: number;
|
||||
// chance of rain (percentage)
|
||||
chanceOfRain?: number;
|
||||
// forecast condition
|
||||
condition?: string;
|
||||
// date of the forecast
|
||||
date?: string;
|
||||
// the URL of forecast condition icon. Simply prefix with either http or https to use it
|
||||
iconUrl?: string;
|
||||
// max temp in celsius
|
||||
maxTempC?: number;
|
||||
// max temp in fahrenheit
|
||||
maxTempF?: number;
|
||||
// minimum temp in celsius
|
||||
minTempC?: number;
|
||||
// minimum temp in fahrenheit
|
||||
minTempF?: number;
|
||||
// time of sunrise
|
||||
sunrise?: string;
|
||||
// time of sunset
|
||||
sunset?: string;
|
||||
// will it rain
|
||||
willItRain?: boolean;
|
||||
}
|
||||
|
||||
export interface ForecastRequest {
|
||||
// number of days. default 1, max 10
|
||||
days?: number;
|
||||
// location of the forecase
|
||||
location?: string;
|
||||
}
|
||||
|
||||
export interface ForecastResponse {
|
||||
// country of the request
|
||||
country?: string;
|
||||
// forecast for the next number of days
|
||||
forecast?: { [key: string]: any }[];
|
||||
// e.g 37.55
|
||||
latitude?: number;
|
||||
// the local time
|
||||
localTime?: string;
|
||||
// location of the request
|
||||
location?: string;
|
||||
// e.g -77.46
|
||||
longitude?: number;
|
||||
// region related to the location
|
||||
region?: string;
|
||||
// timezone of the location
|
||||
timezone?: string;
|
||||
}
|
||||
|
||||
export interface NowRequest {
|
||||
// location to get weather e.g postcode, city
|
||||
location?: string;
|
||||
}
|
||||
|
||||
export interface NowResponse {
|
||||
// cloud cover percentage
|
||||
cloud?: number;
|
||||
// the weather condition
|
||||
condition?: string;
|
||||
// country of the request
|
||||
country?: string;
|
||||
// whether its daytime
|
||||
daytime?: boolean;
|
||||
// feels like in celsius
|
||||
feelsLikeC?: number;
|
||||
// feels like in fahrenheit
|
||||
feelsLikeF?: number;
|
||||
// the humidity percentage
|
||||
humidity?: number;
|
||||
// the URL of the related icon. Simply prefix with either http or https to use it
|
||||
iconUrl?: string;
|
||||
// e.g 37.55
|
||||
latitude?: number;
|
||||
// the local time
|
||||
localTime?: string;
|
||||
// location of the request
|
||||
location?: string;
|
||||
// e.g -77.46
|
||||
longitude?: number;
|
||||
// region related to the location
|
||||
region?: string;
|
||||
// temperature in celsius
|
||||
tempC?: number;
|
||||
// temperature in fahrenheit
|
||||
tempF?: number;
|
||||
// timezone of the location
|
||||
timezone?: string;
|
||||
// wind degree
|
||||
windDegree?: number;
|
||||
// wind direction
|
||||
windDirection?: string;
|
||||
// wind in kph
|
||||
windKph?: number;
|
||||
// wind in mph
|
||||
windMph?: number;
|
||||
}
|
||||
Reference in New Issue
Block a user