Skip to content

Commit

Permalink
Merge pull request #7 from saw-jan/feat/v2
Browse files Browse the repository at this point in the history
feat: v2
  • Loading branch information
saw-jan authored May 23, 2024
2 parents 32f6c42 + f57d0c3 commit 3c0c5e7
Show file tree
Hide file tree
Showing 17 changed files with 974 additions and 390 deletions.
69 changes: 69 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

### Changed

### Removed

## [2.0.0] - 2024-02-28

### Added

- **BREAKING:** APIs return custom data and error responses
- Document latest changes in README docs
- New TeamupClient config options: `bearerToken`
- New APIs:
- Event.`getAllDayEvents()` Gets events occurring for the whole day
- Event.`getRecurringEvents()` Gets recurring events
- SubCalendar.`getInactiveSubCalendars()` Gets inactive sub-calendars
- SubCalendar.`getSubCalendarByName()` Gets a sub-calendar by name

### Changed

- **BREAKING:** TeamupClient config options are renamed

- `calToken` -> `calendarKey`
- `apiKey` -> `teamupToken`
- `calPassword` -> `teamupPassword`

- **BREAKING:** `Events` class is renamed to `Event`
- **BREAKING:** exposed methods are renamed:
- `listEvents` -> `getEvents`
- `listEvent` -> `getEvent`
- `listSubCalendars` -> `getSubCalendars`
- `listSubCalendar` -> `getSubCalendar`
- `Client` is merged to the `Request` class
- Consistent variables naming
- Solidify url joining
- Request `.get()` method now accepts url params as args

### Removed

- Remove `Client` class

## [1.1.0] - 2022-06-10

### Added

- Logger to handle logging
- More validation for options and ids

### Changed

- Refactor internal usage of API classes

## [1.0.0] - 2022-06-07

### Added

- `Events`, `Client`, `SubCalendar`, `API` and `Request` classes
- APIs for listing events: listEvents and listEvent
- APIs for listing sub-calendars: listSubCalendars and listSubCalendar
81 changes: 41 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,71 +1,72 @@
## Teamup Client
## Teamup Calendar Client

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

### Installation

```bash
npm i @sawjan/teamup-client
```

OR

```bash
yarn add @sawjan/teamup-client
```

### Example
### Usage

```js
const Client = require('@sawjan/teamup-client')
const TeamupClient = require('@sawjan/teamup-client')

// create a client instance
const { SubCalendar } = new Client({
const client = new TeamupClient({
url: 'https://api.teamup.com',
calToken: '<calendar_token>',
apiKey: '<api_key>',
})

// list all the sub-calendars
SubCalendar.listSubCalendars().then(({ data }) => {
console.log(data)
calendarKey: '<calendar-key>',
teamupToken: '<teamup-token>',
bearerToken: '<bearer-token>',
})
```

### APIs

#### **Events**
### Examples

1. **listEvents**([options])
See example code: [examples](./examples/)

- `options?` \<Object\>
### APIs

- `startDate?`: \<string\>
#### **Event**

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

- `subcalendarId?`: \<Array\<number\>\>
For available options see [Query Parameters](https://apidocs.teamup.com/docs/api/0f9f896800ffe-get-events-collection-get-events-changed-search-events#Query-Parameters)

- `query?`: \<string\>
- .**getAllDayEvents**([options])
- .**getRecurringEvents**([options])
- .**getEvent**(eventId)

- Returns: \<Promise\<Response\>\>
#### **SubCalendar**

1. **listEvent**(eventId)
- .**getSubCalendars**([options])

- `eventId` \<number\>
- Returns: \<Promise\<Response\>\>
For available options see [Query Parameters](https://apidocs.teamup.com/docs/api/046361930f27a-get-a-collection-of-sub-calendars#Query-Parameters)

#### **SubCalendar**
- .**getInactiveSubCalendars**([options])
- .**getSubCalendar**(subCalendarId):
- .**getSubCalendarByName**(subCalendarName)

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

- `options?` \<Object\>
## Structs

- `includeInactive?`: \<boolean\>
### SuccessResponse

- Returns: \<Promise\<Response\>\>
```js
{
status: <number>,
statusText: <string>,
data: <array>|<object>
}
```

1. **listSubCalendar**(subCalendarId)
### ErrorResponse

- `subCalendarId` \<number\>
- Returns: \<Promise\<Response\>\>
```js
{
status: <number>,
statusText: <string>,
error: <object>
}
```
Loading

0 comments on commit 3c0c5e7

Please sign in to comment.