mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-23 15:51:24 +00:00
Generate clients (#206)
This commit is contained in:
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;
|
||||
}
|
||||
Reference in New Issue
Block a user