Skip to main content
Use Onedrive through Corsair: one client, typed API calls, optional local DB sync, and incoming webhooks documented below. What you get:
  • 61 typed API operations
  • 2 database entities synced for fast .search() / .list() queries
  • 2 incoming webhook event types

Setup

1

Install

pnpm install @corsair-dev/onedrive
2

Add the plugin

corsair.ts
import { createCorsair } from 'corsair';
import { onedrive } from '@corsair-dev/onedrive';

export const corsair = createCorsair({
	// ... other config options,
	multiTenancy: false,
    plugins: [onedrive()],
});
3

Get credentials

Follow Get Credentials if you need help getting keys.
4

Store credentials

pnpm corsair setup --plugin=onedrive
Use the key names documented in Get Credentials (for example api_key=, bot_token=, or OAuth client fields).

Authentication

Each tab shows how to register the plugin for that authentication method. The default authType from the plugin does not need to appear in the factory call.
corsair.ts
onedrive()
Store credentials with pnpm corsair setup --plugin=onedrive (see Get Credentials for field names). For OAuth, you typically store integration keys at the provider level and tokens per account or tenant.More: OAuth 2.0

Webhooks

This plugin registers 2 webhook handler(s). Configure your provider to POST events to your Corsair HTTP endpoint, then use webhookHooks in the plugin factory for custom logic. See Webhooks for every event path and payload shape, and Webhooks concept for how to set up routing.

Query synced data

Synced entities support corsair.onedrive.db.<entity>.search() and .list(). See Database for filters and operators.

Example API calls

Read-style (read): drive.get
await corsair.onedrive.api.drive.get({});
Write-style (write): files.createFolder
await corsair.onedrive.api.files.createFolder({});
See the full list on the API page. Use pnpm corsair list --plugin=onedrive and pnpm corsair schema <path> locally to inspect schemas.

Hooks

Use hooks on API calls and webhookHooks on incoming events to add logging, approvals, or side effects. See Hooks and the Webhooks page for payload types.

Reference

TopicLink
APIAPI
DatabaseDatabase
WebhooksWebhooks
CredentialsGet credentials