Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/natelindev/tsdav
WebDAV, CALDAV, and CARDDAV client for Nodejs and the Browser
https://github.com/natelindev/tsdav
addressbook browser caldav calendar calendars carddav contact contacts dav ical nodejs sync typescript vcard webdav
Last synced: 7 days ago
JSON representation
WebDAV, CALDAV, and CARDDAV client for Nodejs and the Browser
- Host: GitHub
- URL: https://github.com/natelindev/tsdav
- Owner: natelindev
- License: mit
- Created: 2020-11-23T10:21:14.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-10-29T14:16:33.000Z (16 days ago)
- Last Synced: 2024-10-29T17:24:22.638Z (16 days ago)
- Topics: addressbook, browser, caldav, calendar, calendars, carddav, contact, contacts, dav, ical, nodejs, sync, typescript, vcard, webdav
- Language: TypeScript
- Homepage: https://tsdav.vercel.app
- Size: 2.8 MB
- Stars: 232
- Watchers: 3
- Forks: 38
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
webdav request made easy### Features
- Easy to use, well documented JSON based WEBDAV API
- Works in both `Browsers` and `Node.js`
- Supports Both `commonjs` and `esm`
- OAuth2 & basic auth helpers built-in
- Native typescript, fully linted and well tested
- Supports WEBDAV, CALDAV, CARDDAV
- Tested with multiple cloud providers### Install
```bash
npm install tsdav
```or
```bash
yarn add tsdav
```### Quickstart
##### Google CALDAV
```ts
import { createDAVClient } from 'tsdav';(async () => {
const client = await createDAVClient({
serverUrl: 'https://apidata.googleusercontent.com/caldav/v2/',
credentials: {
tokenUrl: 'https://accounts.google.com/o/oauth2/token',
username: 'YOUR_EMAIL_ADDRESS',
refreshToken: 'YOUR_REFRESH_TOKEN_WITH_CALDAV_PERMISSION',
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
},
authMethod: 'Oauth',
defaultAccountType: 'caldav',
});const calendars = await client.fetchCalendars();
const calendarObjects = await client.fetchCalendarObjects({
calendar: calendars[0],
});
})();
```##### Apple CARDDAV
```ts
import { createDAVClient } from 'tsdav';(async () => {
const client = await createDAVClient({
serverUrl: 'https://contacts.icloud.com',
credentials: {
username: 'YOUR_APPLE_ID',
password: 'YOUR_APP_SPECIFIC_PASSWORD',
},
authMethod: 'Basic',
defaultAccountType: 'carddav',
});const addressBooks = await client.fetchAddressBooks();
const vcards = await client.fetchVCards({
addressBook: addressBooks[0],
});
})();
```After `v1.1.0`, you have a new way of creating clients.
##### Google CALDAV
```ts
import { DAVClient } from 'tsdav';const client = new DAVClient({
serverUrl: 'https://apidata.googleusercontent.com/caldav/v2/',
credentials: {
tokenUrl: 'https://accounts.google.com/o/oauth2/token',
username: 'YOUR_EMAIL_ADDRESS',
refreshToken: 'YOUR_REFRESH_TOKEN_WITH_CALDAV_PERMISSION',
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
},
authMethod: 'Oauth',
defaultAccountType: 'caldav',
});(async () => {
await client.login();const calendars = await client.fetchCalendars();
const calendarObjects = await client.fetchCalendarObjects({
calendar: calendars[0],
});
})();
```##### Apple CARDDAV
```ts
import { DAVClient } from 'tsdav';const client = new DAVClient({
serverUrl: 'https://contacts.icloud.com',
credentials: {
username: 'YOUR_APPLE_ID',
password: 'YOUR_APP_SPECIFIC_PASSWORD',
},
authMethod: 'Basic',
defaultAccountType: 'carddav',
});(async () => {
await client.login();const addressBooks = await client.fetchAddressBooks();
const vcards = await client.fetchVCards({
addressBook: addressBooks[0],
});
})();
```### Documentation
Check out the [Documentation](https://tsdav.vercel.app/)
### License
[MIT](https://github.com/natelindev/tsdav/blob/master/LICENSE)
### Changelog
refers to [Changelog](./CHANGELOG.md)
### Debugging
this package uses `debug` package,
add `tsdav:*` to `DEBUG` env variable to enable debug logs