Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stroeer/wecantrack
Abstraction of WeCanTrack API
https://github.com/stroeer/wecantrack
Last synced: about 1 month ago
JSON representation
Abstraction of WeCanTrack API
- Host: GitHub
- URL: https://github.com/stroeer/wecantrack
- Owner: stroeer
- Created: 2021-09-30T06:38:21.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-06T12:26:26.000Z (almost 2 years ago)
- Last Synced: 2024-04-20T00:46:46.285Z (9 months ago)
- Language: TypeScript
- Size: 240 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: ReadMe.md
Awesome Lists containing this project
README
# WeCanTrack
[WeCanTrack](https://wecantrack.com) is a solution for affiliate partners to track their revenues.
They provide an [API](https://docs.wecantrack.com/#/?id=we-can-track) which is made typed and made more accessible via this node module.## Installation
You can install the repository via
```sh
npm install --save @stroeer/wecantrack
```## Usage
The central object which holds your personal api key is the `WeCanTrack` object.
It gets constructed via```ts
import { WeCanTrack } from '@stroeer/wecantrack';
const api = new WeCanTrack(myKey) // which you can inject via e.g. an environment variable
```To create request objects the module provides `RequestBuilder`.
Here an example for the `transactions` api.
```ts
import {
TransactionRequestBuilder,
WeCanTrack,
} from '@stroeer/wecantrack';const API = new WeCanTrack(process.env.WCT_KEY);
const request = new TransactionRequestBuilder();
request
.start(new Date('2021-09-20'))
.end(new Date())
.dateType('order_date');const result = await API.transactionsTotal(request.build());
```For convenience reason the WeCanTrack Object provides a function to get results pagewise or in total.