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

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