Skip to content

Commit 3c0c5e7

Browse files
authored
Merge pull request #7 from saw-jan/feat/v2
feat: v2
2 parents 32f6c42 + f57d0c3 commit 3c0c5e7

File tree

17 files changed

+974
-390
lines changed

17 files changed

+974
-390
lines changed

CHANGELOG.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
### Changed
13+
14+
### Removed
15+
16+
## [2.0.0] - 2024-02-28
17+
18+
### Added
19+
20+
- **BREAKING:** APIs return custom data and error responses
21+
- Document latest changes in README docs
22+
- New TeamupClient config options: `bearerToken`
23+
- New APIs:
24+
- Event.`getAllDayEvents()` Gets events occurring for the whole day
25+
- Event.`getRecurringEvents()` Gets recurring events
26+
- SubCalendar.`getInactiveSubCalendars()` Gets inactive sub-calendars
27+
- SubCalendar.`getSubCalendarByName()` Gets a sub-calendar by name
28+
29+
### Changed
30+
31+
- **BREAKING:** TeamupClient config options are renamed
32+
33+
- `calToken` -> `calendarKey`
34+
- `apiKey` -> `teamupToken`
35+
- `calPassword` -> `teamupPassword`
36+
37+
- **BREAKING:** `Events` class is renamed to `Event`
38+
- **BREAKING:** exposed methods are renamed:
39+
- `listEvents` -> `getEvents`
40+
- `listEvent` -> `getEvent`
41+
- `listSubCalendars` -> `getSubCalendars`
42+
- `listSubCalendar` -> `getSubCalendar`
43+
- `Client` is merged to the `Request` class
44+
- Consistent variables naming
45+
- Solidify url joining
46+
- Request `.get()` method now accepts url params as args
47+
48+
### Removed
49+
50+
- Remove `Client` class
51+
52+
## [1.1.0] - 2022-06-10
53+
54+
### Added
55+
56+
- Logger to handle logging
57+
- More validation for options and ids
58+
59+
### Changed
60+
61+
- Refactor internal usage of API classes
62+
63+
## [1.0.0] - 2022-06-07
64+
65+
### Added
66+
67+
- `Events`, `Client`, `SubCalendar`, `API` and `Request` classes
68+
- APIs for listing events: listEvents and listEvent
69+
- APIs for listing sub-calendars: listSubCalendars and listSubCalendar

README.md

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,72 @@
1-
## Teamup Client
1+
## Teamup Calendar Client
22

3-
[Teamup API Documentation](https://apidocs.teamup.com/)
3+
A library for working with [Teamup](https://www.teamup.com/) calendar.
44

55
### Installation
66

77
```bash
88
npm i @sawjan/teamup-client
99
```
1010

11-
OR
12-
13-
```bash
14-
yarn add @sawjan/teamup-client
15-
```
16-
17-
### Example
11+
### Usage
1812

1913
```js
20-
const Client = require('@sawjan/teamup-client')
14+
const TeamupClient = require('@sawjan/teamup-client')
2115

22-
// create a client instance
23-
const { SubCalendar } = new Client({
16+
const client = new TeamupClient({
2417
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>',
3221
})
3322
```
3423

35-
### APIs
36-
37-
#### **Events**
24+
### Examples
3825

39-
1. **listEvents**([options])
26+
See example code: [examples](./examples/)
4027

41-
- `options?` \<Object\>
28+
### APIs
4229

43-
- `startDate?`: \<string\>
30+
#### **Event**
4431

45-
- `endDate?`: \<string\>
32+
- .**getEvents**([options])
4633

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)
4835

49-
- `query?`: \<string\>
36+
- .**getAllDayEvents**([options])
37+
- .**getRecurringEvents**([options])
38+
- .**getEvent**(eventId)
5039

51-
- Returns: \<Promise\<Response\>\>
40+
#### **SubCalendar**
5241

53-
1. **listEvent**(eventId)
42+
- .**getSubCalendars**([options])
5443

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)
5745

58-
#### **SubCalendar**
46+
- .**getInactiveSubCalendars**([options])
47+
- .**getSubCalendar**(subCalendarId):
48+
- .**getSubCalendarByName**(subCalendarName)
5949

60-
1. **listSubCalendars**([options])
50+
All APIs will either return Promise\<[SuccessResponse](#successresponse)\> or throw Promise\<[ErrorResponse](#errorresponse)\>
6151

62-
- `options?` \<Object\>
52+
## Structs
6353

64-
- `includeInactive?`: \<boolean\>
54+
### SuccessResponse
6555

66-
- Returns: \<Promise\<Response\>\>
56+
```js
57+
{
58+
status: <number>,
59+
statusText: <string>,
60+
data: <array>|<object>
61+
}
62+
```
6763

68-
1. **listSubCalendar**(subCalendarId)
64+
### ErrorResponse
6965

70-
- `subCalendarId` \<number\>
71-
- Returns: \<Promise\<Response\>\>
66+
```js
67+
{
68+
status: <number>,
69+
statusText: <string>,
70+
error: <object>
71+
}
72+
```

0 commit comments

Comments
 (0)