1.0.14 • Published 10 months ago

7x-sdk v1.0.14

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

A JavaScript SDK for 7x APIs

To use this SDK, you will need an API Key. Sign up on https://7x.ax to get started.

Install

npm i 7x-sdk

Usage

Timezone API

const Timezone = require('7x-sdk').Timezone;

let tz = new Timezone(API_KEY);
let data = tz.get(30.0444, 31.2357);
// data is an instance of the Timezone DTO
console.log(data.timezones);

Distance API

Distance by Coordinates

const Distance = require('7x-sdk').Distance;

let d = new Distance(API_KEY);
let data = d.getByCoordinates(22.22, 33.33, 44.44, 55.55, 'km');
// data is an instance of the Distance DTO.
data.distance;
data.unit; // km if you specified km, or mi if you specified mi. Defaults to km if not specified.

Distance by Address

const Distance = require('7x-sdk').Distance;

let d = new Distance(API_KEY);
let data = d.getByAddress('London, UK', 'Paris, France', 'km');
// data is an instance of the Distance DTO.
$data.distance;
$data.unit; // km if you specified km, or mi if you specified mi. Defaults to km if not specified.

Geocoding API

Geocode by City / Address String

const Geocode = require('7x-sdk').Geocode;

let g = new Geocode(API_KEY);
let data = g.get('Trafalgar Square, London, UK');
// data is an instance of GeocodeCollection. This contains an array of objects.
for (let obj of data.objects) {
    obj.coordinates; // Instance of Coordinates
    obj.location; // Instance of Location}
}

Geocode Search (to build search suggest / autocomplete functionality)

const Geocode = require('7x-sdk').Geocode;

let g = new Geocode(API_KEY);
let data = g.search('Lon');
// data is an instance of the GeocodeCollection DTO. This contains an array of objects.
for (let obj of data.objects) {
    obj.coordinates; // Instance of Coordinates
    obj.location; // Instance of Location
}

Reverse Geocoding by Coordinates

const Geocode = require('7x-sdk').Geocode;

let g = new Geocode(API_KEY);
let data = g.reverse(22.223232, 33.343443);
// data is an instance of the GeocodeCollection DTO. This contains an array of objects.
for (let obj of data.objects) {
    obj.coordinates; // Instance of Coordinates
    obj.location; // Instance of Location
}

Numbers

const Numbers = require('7x-sdk').Numbers;

let g = new Numbers(API_KEY);
let data = g.latinToArabic(22.223232);
// data is an instance of the Arabic DTO. This contains an array of objects.
data.arabic;
data.latin

let data = g.arabicToLatin('١٢٣٤٥٦٧٨٩٠');
// data is an instance of the Arabic DTO. This contains an array of objects.
data.arabic;
data.html

let data = g.arabicToHtml('١٢٣٤٥٦٧٨٩٠');
// data is an instance of the Arabic DTO. This contains an array of objects.
data.arabic;
data.html

Date and Time

const Dt = require('7x-sdk').DateAndTime;

let g = new Dt(API_KEY);
let data = g.byTimezone('Africa/Cairo');
// or 
let data = g.byCoordinates(22.223232, 33.343443);
// or
let data = g.byAddress('Trafalgar Square, London, UK');
// data is an instance of the DateAndTime DTO.
data.time;
data.timezone;
1.0.14

10 months ago

1.0.13

10 months ago

1.0.2

12 months ago

1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.11

12 months ago

1.0.10

12 months ago

1.0.12

11 months ago

1.0.1

12 months ago

1.0.0

12 months ago