@base44-preview/sdk 0.8.20-pr.136.cbfe0f7 → 0.8.20-pr.136.ee4a41b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -24,7 +24,7 @@ export interface ConnectorAccessTokenResponse {
|
|
|
24
24
|
connection_config: Record<string, string> | null;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* Connection details.
|
|
28
28
|
*/
|
|
29
29
|
export interface ConnectorConnectionResponse {
|
|
30
30
|
/** The OAuth access token for the external service. */
|
|
@@ -44,13 +44,16 @@ export interface ConnectorConnectionResponse {
|
|
|
44
44
|
*
|
|
45
45
|
* ## Available connectors
|
|
46
46
|
*
|
|
47
|
-
* All connectors work through [`
|
|
47
|
+
* All connectors work through [`getConnection()`](#getconnection). Pass the integration type string and use the returned OAuth token to call the external service's API directly.
|
|
48
48
|
*
|
|
49
49
|
* | Service | Type identifier |
|
|
50
50
|
* |---|---|
|
|
51
|
+
* | Box | `box` |
|
|
52
|
+
* | ClickUp | `clickup` |
|
|
51
53
|
* | Discord | `discord` |
|
|
52
54
|
* | GitHub | `github` |
|
|
53
55
|
* | Gmail | `gmail` |
|
|
56
|
+
* | Google Analytics | `google_analytics` |
|
|
54
57
|
* | Google BigQuery | `googlebigquery` |
|
|
55
58
|
* | Google Calendar | `googlecalendar` |
|
|
56
59
|
* | Google Docs | `googledocs` |
|
|
@@ -64,6 +67,7 @@ export interface ConnectorConnectionResponse {
|
|
|
64
67
|
* | Slack User | `slack` |
|
|
65
68
|
* | Slack Bot | `slackbot` |
|
|
66
69
|
* | TikTok | `tiktok` |
|
|
70
|
+
* | Wrike | `wrike` |
|
|
67
71
|
*
|
|
68
72
|
* See the integration guides for more details:
|
|
69
73
|
*
|
|
@@ -82,7 +86,7 @@ export interface ConnectorsModule {
|
|
|
82
86
|
/**
|
|
83
87
|
* Retrieves an OAuth access token for a specific [external integration type](#available-connectors).
|
|
84
88
|
*
|
|
85
|
-
* @deprecated Use {@link getConnection}
|
|
89
|
+
* @deprecated Use {@link getConnection} instead.
|
|
86
90
|
*
|
|
87
91
|
* Returns the OAuth token string for an external service that an app builder
|
|
88
92
|
* has connected to. This token represents the connected app builder's account
|
|
@@ -149,39 +153,61 @@ export interface ConnectorsModule {
|
|
|
149
153
|
*/
|
|
150
154
|
getAccessToken(integrationType: ConnectorIntegrationType): Promise<string>;
|
|
151
155
|
/**
|
|
152
|
-
* Retrieves the OAuth access token and connection configuration for a specific external integration type.
|
|
156
|
+
* Retrieves the OAuth access token and connection configuration for a specific [external integration type](#available-connectors).
|
|
153
157
|
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* extra parameters beyond the access token (e.g., a shop domain, account ID, or API base URL).
|
|
158
|
+
* Some connectors require connection-specific parameters to build API calls.
|
|
159
|
+
* In such cases, the returned `connectionConfig` is an object with the additional parameters. If there are no extra parameters needed for the connection, the `connectionConfig` is `null`.
|
|
157
160
|
*
|
|
158
|
-
*
|
|
161
|
+
* For example, a service might need a subdomain to construct the API URL in
|
|
162
|
+
* the form of `{subdomain}.example.com`. In such a case the subdomain will be available as a property of the `connectionConfig` object.
|
|
163
|
+
*
|
|
164
|
+
* @param integrationType - The type of integration, such as `'googlecalendar'`, `'slack'`, `'slackbot'`, `'github'`, or `'discord'`. See [Available connectors](#available-connectors) for the full list.
|
|
159
165
|
* @returns Promise resolving to a {@link ConnectorConnectionResponse} with `accessToken` and `connectionConfig`.
|
|
160
166
|
*
|
|
161
167
|
* @example
|
|
162
168
|
* ```typescript
|
|
163
|
-
* //
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
169
|
+
* // Google Calendar connection
|
|
170
|
+
* // Get Google Calendar OAuth token and fetch upcoming events
|
|
171
|
+
* const { accessToken } = await base44.asServiceRole.connectors.getConnection('googlecalendar');
|
|
172
|
+
*
|
|
173
|
+
* const timeMin = new Date().toISOString();
|
|
174
|
+
* const url = `https://www.googleapis.com/calendar/v3/calendars/primary/events?maxResults=10&orderBy=startTime&singleEvents=true&timeMin=${timeMin}`;
|
|
175
|
+
*
|
|
176
|
+
* const calendarResponse = await fetch(url, {
|
|
177
|
+
* headers: { Authorization: `Bearer ${accessToken}` }
|
|
178
|
+
* });
|
|
179
|
+
*
|
|
180
|
+
* const events = await calendarResponse.json();
|
|
167
181
|
* ```
|
|
168
182
|
*
|
|
169
183
|
* @example
|
|
170
184
|
* ```typescript
|
|
171
|
-
* //
|
|
172
|
-
*
|
|
173
|
-
* const { accessToken
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
+
* // Slack connection
|
|
186
|
+
* // Get Slack OAuth token and list channels
|
|
187
|
+
* const { accessToken } = await base44.asServiceRole.connectors.getConnection('slack');
|
|
188
|
+
*
|
|
189
|
+
* const url = 'https://slack.com/api/conversations.list?types=public_channel,private_channel&limit=100';
|
|
190
|
+
*
|
|
191
|
+
* const slackResponse = await fetch(url, {
|
|
192
|
+
* headers: { Authorization: `Bearer ${accessToken}` }
|
|
193
|
+
* });
|
|
194
|
+
*
|
|
195
|
+
* const data = await slackResponse.json();
|
|
196
|
+
* ```
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```typescript
|
|
200
|
+
* // Using connectionConfig
|
|
201
|
+
* // Some connectors return a subdomain or other params needed to build the API URL
|
|
202
|
+
* const { accessToken, connectionConfig } = await base44.asServiceRole.connectors.getConnection('myservice');
|
|
203
|
+
*
|
|
204
|
+
* const subdomain = connectionConfig?.subdomain;
|
|
205
|
+
* const response = await fetch(
|
|
206
|
+
* `https://${subdomain}.example.com/api/v1/resources`,
|
|
207
|
+
* { headers: { Authorization: `Bearer ${accessToken}` } }
|
|
208
|
+
* );
|
|
209
|
+
*
|
|
210
|
+
* const data = await response.json();
|
|
185
211
|
* ```
|
|
186
212
|
*/
|
|
187
213
|
getConnection(integrationType: ConnectorIntegrationType): Promise<ConnectorConnectionResponse>;
|