|
1 | | -## Teamup Client |
| 1 | +## Teamup Calendar Client |
2 | 2 |
|
3 | | -[Teamup API Documentation](https://apidocs.teamup.com/) |
| 3 | +A library for working with [Teamup](https://www.teamup.com/) calendar. |
4 | 4 |
|
5 | 5 | ### Installation |
6 | 6 |
|
7 | 7 | ```bash |
8 | 8 | npm i @sawjan/teamup-client |
9 | 9 | ``` |
10 | 10 |
|
11 | | -OR |
12 | | - |
13 | | -```bash |
14 | | -yarn add @sawjan/teamup-client |
15 | | -``` |
16 | | - |
17 | | -### Example |
| 11 | +### Usage |
18 | 12 |
|
19 | 13 | ```js |
20 | | -const Client = require('@sawjan/teamup-client') |
| 14 | +const TeamupClient = require('@sawjan/teamup-client') |
21 | 15 |
|
22 | | -// create a client instance |
23 | | -const { SubCalendar } = new Client({ |
| 16 | +const client = new TeamupClient({ |
24 | 17 | url: 'https://api.teamup.com', |
25 | | - calToken: '<calendar_token>', |
26 | | - apiKey: '<api_key>', |
27 | | -}) |
28 | | - |
29 | | -// list all the sub-calendars |
30 | | -SubCalendar.listSubCalendars().then(({ data }) => { |
31 | | - console.log(data) |
| 18 | + calendarKey: '<calendar-key>', |
| 19 | + teamupToken: '<teamup-token>', |
| 20 | + bearerToken: '<bearer-token>', |
32 | 21 | }) |
33 | 22 | ``` |
34 | 23 |
|
35 | | -### APIs |
36 | | - |
37 | | -#### **Events** |
| 24 | +### Examples |
38 | 25 |
|
39 | | -1. **listEvents**([options]) |
| 26 | +See example code: [examples](./examples/) |
40 | 27 |
|
41 | | - - `options?` \<Object\> |
| 28 | +### APIs |
42 | 29 |
|
43 | | - - `startDate?`: \<string\> |
| 30 | +#### **Event** |
44 | 31 |
|
45 | | - - `endDate?`: \<string\> |
| 32 | +- .**getEvents**([options]) |
46 | 33 |
|
47 | | - - `subcalendarId?`: \<Array\<number\>\> |
| 34 | + For available options see [Query Parameters](https://apidocs.teamup.com/docs/api/0f9f896800ffe-get-events-collection-get-events-changed-search-events#Query-Parameters) |
48 | 35 |
|
49 | | - - `query?`: \<string\> |
| 36 | +- .**getAllDayEvents**([options]) |
| 37 | +- .**getRecurringEvents**([options]) |
| 38 | +- .**getEvent**(eventId) |
50 | 39 |
|
51 | | - - Returns: \<Promise\<Response\>\> |
| 40 | +#### **SubCalendar** |
52 | 41 |
|
53 | | -1. **listEvent**(eventId) |
| 42 | +- .**getSubCalendars**([options]) |
54 | 43 |
|
55 | | - - `eventId` \<number\> |
56 | | - - Returns: \<Promise\<Response\>\> |
| 44 | + For available options see [Query Parameters](https://apidocs.teamup.com/docs/api/046361930f27a-get-a-collection-of-sub-calendars#Query-Parameters) |
57 | 45 |
|
58 | | -#### **SubCalendar** |
| 46 | +- .**getInactiveSubCalendars**([options]) |
| 47 | +- .**getSubCalendar**(subCalendarId): |
| 48 | +- .**getSubCalendarByName**(subCalendarName) |
59 | 49 |
|
60 | | -1. **listSubCalendars**([options]) |
| 50 | +All APIs will either return Promise\<[SuccessResponse](#successresponse)\> or throw Promise\<[ErrorResponse](#errorresponse)\> |
61 | 51 |
|
62 | | - - `options?` \<Object\> |
| 52 | +## Structs |
63 | 53 |
|
64 | | - - `includeInactive?`: \<boolean\> |
| 54 | +### SuccessResponse |
65 | 55 |
|
66 | | - - Returns: \<Promise\<Response\>\> |
| 56 | +```js |
| 57 | +{ |
| 58 | + status: <number>, |
| 59 | + statusText: <string>, |
| 60 | + data: <array>|<object> |
| 61 | +} |
| 62 | +``` |
67 | 63 |
|
68 | | -1. **listSubCalendar**(subCalendarId) |
| 64 | +### ErrorResponse |
69 | 65 |
|
70 | | - - `subCalendarId` \<number\> |
71 | | - - Returns: \<Promise\<Response\>\> |
| 66 | +```js |
| 67 | +{ |
| 68 | + status: <number>, |
| 69 | + statusText: <string>, |
| 70 | + error: <object> |
| 71 | +} |
| 72 | +``` |
0 commit comments