Generate clients (#206)

This commit is contained in:
Janos Dobronszki
2021-09-16 12:52:36 +01:00
committed by GitHub
parent 552c321dd7
commit d4d9c1c176
334 changed files with 9334 additions and 45 deletions

60
clients/ts/geocoding/index.ts Executable file
View 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 };
}