Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mazurwiktor/gratka-api
Queries unofficial gratka APIs.
https://github.com/mazurwiktor/gratka-api
Last synced: about 2 months ago
JSON representation
Queries unofficial gratka APIs.
- Host: GitHub
- URL: https://github.com/mazurwiktor/gratka-api
- Owner: mazurwiktor
- License: mit
- Created: 2017-04-02T15:44:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-06T19:41:17.000Z (over 7 years ago)
- Last Synced: 2024-10-12T13:54:48.221Z (3 months ago)
- Language: TypeScript
- Size: 22.5 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Gratka-api
Queries unofficial gratka APIs.
# Instalation
```bash
npm install gratka-api
```# Usage
Create connection params.
```ts
interface ConnectionParams {
login: String,
password: String,
webapiKey: String
};
const connectionParams: ConnectionParams;
```Create an api object.
```ts
const api = new Gratka.Api.Dom.Nieruchomosci(connectionParams);
```
Handle desired methods (avaible methods list http://pomoc.webapi2.gratka.pl/dokumentacja/dom_dokumentacja)
```js
api.conect().then(() => {
return api.({...params});
}).then(result => {
// handle result
}).catch(reason => {
// handle rejectction
});
```
Call specific methods with params that should give more proper output i.e
```ts
export interface pobierz_kategorie_params {
id_kategoria?: Number,
js_tree?: Boolean
}api.connect().then(() => {
return api.pobierz_kategorie({js_tree: true});
}).then(result => {
// result should be simmilar to presented bellow.
});{ Dom:
{ id: 382,
nazwa: 'Dom',
dane: '0',
id_rodzic: 1,
poziom: 0,
id_prasa: 2,
path: '/Dom',
Pokoje:
{ id: 8251,
nazwa: 'Pokoje',
dane: {},
id_rodzic: 382,
poziom: 1,
id_prasa: 0,
path: '/Dom/Pokoje',
'Rynek wtórny': [Object] }
}
}
```# Contribution
## TestingTo test helper functions simply
```bash
gulp test
```If you want to run api tests, you need to first set proper env variables
```bash
export GRAKTA_LOGIN=
export GRAKTA_PASSWORD=
export GRAKTA_KEY=
```And then
```bash
gulp test
```