BirdSdkApi
The BirdSdkApi
class is the main entry point to interact with Bird's API through the SDK. It provides methods to send authenticated requests to the API.
💡 To send an authenticated request, you first need to identify the contact. The scope of the auth token will be defined by the identification claim.
Example
To access the BirdSdkApi
, you can use the api
property of the SDK instance.
Methods
fetch()
Remarks
The fetch method allows you to send authenticated requests to the Bird API. It can be used in two ways:
By passing a path as the first argument
By passing a callback function that receives the
workspaceId
and thebaseUrl
andauthToken
props
fetch(path, opts)
The path overload can be used to define the request with a path and fetch options. Note that all path requests are scoped to the current workspace.
Type Parameters
• R
Parameters
• path: string
The path of the request
• opts?: FetchOptions
Returns
Promise
<R
>
Example
fetch(callback, options)
The callback overload can be used to define the request with a custom fetch function for more control. The callback will receive the workspaceId
and the baseUrl
and authToken
props.
Type Parameters
• Fn extends Callback
<Fn
>
Parameters
• callback: Fn
The callback function
• options?: undefined
Returns
ReturnType
<Fn
>
Example
Last updated