@bundleup/sdk 0.0.2 → 0.0.4

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.
package/dist/index.d.mts CHANGED
@@ -1,11 +1,11 @@
1
1
  declare abstract class Base<T> {
2
+ private apiKey;
2
3
  protected abstract path: string;
3
- protected apiKey: string;
4
- protected baseUrl: string;
5
- protected version: string;
4
+ private baseUrl;
5
+ private version;
6
6
  constructor(apiKey: string);
7
- protected get apiUrl(): string;
8
- protected get headers(): Record<string, string>;
7
+ private get apiUrl();
8
+ private get headers();
9
9
  list<K extends Record<string, any>>(params?: K): Promise<T[]>;
10
10
  create<K extends Record<string, any>>(body: K): Promise<T>;
11
11
  retrieve(id: string): Promise<T>;
@@ -53,23 +53,37 @@ declare class Webhooks extends Base<Webhook> {
53
53
  declare class Request {
54
54
  private apiKey;
55
55
  private connectionId;
56
+ private baseUrl;
57
+ private get headers();
58
+ constructor(apiKey: string, connectionId: string);
59
+ private buildUrl;
60
+ get(path: string, searchParams?: Record<string, any>, headers?: Record<string, string>): Promise<Response>;
61
+ post(path: string, body?: Record<string, any>, headers?: Record<string, string>): Promise<Response>;
62
+ put(path: string, body?: Record<string, any>, headers?: Record<string, string>): Promise<Response>;
63
+ patch(path: string, body?: Record<string, any>, headers?: Record<string, string>): Promise<Response>;
64
+ delete(path: string, headers?: Record<string, string>): Promise<Response>;
65
+ }
66
+
67
+ type ChatMessageRequest = {
68
+ channelId: string;
69
+ content: string;
70
+ };
71
+ declare class Chat {
72
+ private req;
56
73
  constructor(apiKey: string, connectionId: string);
57
- protected get baseUrl(): string;
58
- protected get headers(): Record<string, string>;
59
- get(path: string, params?: Record<string, any>): Promise<Response>;
60
- post(path: string, body?: Record<string, any>): Promise<Response>;
61
- put(path: string, body?: Record<string, any>): Promise<Response>;
62
- patch(path: string, body?: Record<string, any>): Promise<Response>;
63
- delete(path: string): Promise<Response>;
74
+ message({ channelId, content }: ChatMessageRequest): Promise<Response>;
64
75
  }
65
76
 
66
77
  declare class BundleUp {
67
78
  private apiKey;
68
79
  constructor(apiKey: string);
69
- connections(): Connections;
70
- integrations(): Integrations;
71
- webhooks(): Webhooks;
72
- request(connectionId: string): Request;
80
+ get connections(): Connections;
81
+ get integrations(): Integrations;
82
+ get webhooks(): Webhooks;
83
+ connect(connectionId: string): {
84
+ req: Request;
85
+ chat: Chat;
86
+ };
73
87
  }
74
88
 
75
89
  export { BundleUp };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  declare abstract class Base<T> {
2
+ private apiKey;
2
3
  protected abstract path: string;
3
- protected apiKey: string;
4
- protected baseUrl: string;
5
- protected version: string;
4
+ private baseUrl;
5
+ private version;
6
6
  constructor(apiKey: string);
7
- protected get apiUrl(): string;
8
- protected get headers(): Record<string, string>;
7
+ private get apiUrl();
8
+ private get headers();
9
9
  list<K extends Record<string, any>>(params?: K): Promise<T[]>;
10
10
  create<K extends Record<string, any>>(body: K): Promise<T>;
11
11
  retrieve(id: string): Promise<T>;
@@ -53,23 +53,37 @@ declare class Webhooks extends Base<Webhook> {
53
53
  declare class Request {
54
54
  private apiKey;
55
55
  private connectionId;
56
+ private baseUrl;
57
+ private get headers();
58
+ constructor(apiKey: string, connectionId: string);
59
+ private buildUrl;
60
+ get(path: string, searchParams?: Record<string, any>, headers?: Record<string, string>): Promise<Response>;
61
+ post(path: string, body?: Record<string, any>, headers?: Record<string, string>): Promise<Response>;
62
+ put(path: string, body?: Record<string, any>, headers?: Record<string, string>): Promise<Response>;
63
+ patch(path: string, body?: Record<string, any>, headers?: Record<string, string>): Promise<Response>;
64
+ delete(path: string, headers?: Record<string, string>): Promise<Response>;
65
+ }
66
+
67
+ type ChatMessageRequest = {
68
+ channelId: string;
69
+ content: string;
70
+ };
71
+ declare class Chat {
72
+ private req;
56
73
  constructor(apiKey: string, connectionId: string);
57
- protected get baseUrl(): string;
58
- protected get headers(): Record<string, string>;
59
- get(path: string, params?: Record<string, any>): Promise<Response>;
60
- post(path: string, body?: Record<string, any>): Promise<Response>;
61
- put(path: string, body?: Record<string, any>): Promise<Response>;
62
- patch(path: string, body?: Record<string, any>): Promise<Response>;
63
- delete(path: string): Promise<Response>;
74
+ message({ channelId, content }: ChatMessageRequest): Promise<Response>;
64
75
  }
65
76
 
66
77
  declare class BundleUp {
67
78
  private apiKey;
68
79
  constructor(apiKey: string);
69
- connections(): Connections;
70
- integrations(): Integrations;
71
- webhooks(): Webhooks;
72
- request(connectionId: string): Request;
80
+ get connections(): Connections;
81
+ get integrations(): Integrations;
82
+ get webhooks(): Webhooks;
83
+ connect(connectionId: string): {
84
+ req: Request;
85
+ chat: Chat;
86
+ };
73
87
  }
74
88
 
75
89
  export { BundleUp };
package/dist/index.js CHANGED
@@ -24,12 +24,17 @@ __export(src_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(src_exports);
26
26
 
27
+ // src/utils.ts
28
+ function isObject(value) {
29
+ return value !== null && typeof value === "object" && !Array.isArray(value);
30
+ }
31
+
27
32
  // src/base.ts
28
33
  var Base = class {
29
34
  constructor(apiKey) {
35
+ this.apiKey = apiKey;
30
36
  this.baseUrl = "https://api.bundleup.io";
31
37
  this.version = "v1";
32
- this.apiKey = apiKey;
33
38
  }
34
39
  get apiUrl() {
35
40
  return `${this.baseUrl}/${this.version}`;
@@ -41,6 +46,9 @@ var Base = class {
41
46
  };
42
47
  }
43
48
  async list(params = {}) {
49
+ if (!isObject(params)) {
50
+ throw new Error("List parameters must be an object.");
51
+ }
44
52
  const response = await fetch(`${this.apiUrl}${this.path}`, {
45
53
  method: "GET",
46
54
  headers: this.headers,
@@ -55,6 +63,9 @@ var Base = class {
55
63
  return data;
56
64
  }
57
65
  async create(body) {
66
+ if (!isObject(body)) {
67
+ throw new Error("Request body must be an object.");
68
+ }
58
69
  const response = await fetch(`${this.apiUrl}${this.path}`, {
59
70
  method: "POST",
60
71
  headers: this.headers,
@@ -67,35 +78,53 @@ var Base = class {
67
78
  return data;
68
79
  }
69
80
  async retrieve(id) {
81
+ if (!id) {
82
+ throw new Error("ID is required to retrieve a resource.");
83
+ }
70
84
  const response = await fetch(`${this.apiUrl}${this.path}/${id}`, {
71
85
  method: "GET",
72
86
  headers: this.headers
73
87
  });
74
88
  if (!response.ok) {
75
- throw new Error(`Failed to retrieve ${this.path}/${id}: ${response.statusText}`);
89
+ throw new Error(
90
+ `Failed to retrieve ${this.path}/${id}: ${response.statusText}`
91
+ );
76
92
  }
77
93
  const data = await response.json();
78
94
  return data;
79
95
  }
80
96
  async update(id, body) {
97
+ if (!id) {
98
+ throw new Error("ID is required to update a resource.");
99
+ }
100
+ if (!isObject(body)) {
101
+ throw new Error("Request body must be an object.");
102
+ }
81
103
  const response = await fetch(`${this.apiUrl}${this.path}/${id}`, {
82
104
  method: "PATCH",
83
105
  headers: this.headers,
84
106
  body: JSON.stringify(body)
85
107
  });
86
108
  if (!response.ok) {
87
- throw new Error(`Failed to update ${this.path}/${id}: ${response.statusText}`);
109
+ throw new Error(
110
+ `Failed to update ${this.path}/${id}: ${response.statusText}`
111
+ );
88
112
  }
89
113
  const data = await response.json();
90
114
  return data;
91
115
  }
92
116
  async del(id) {
117
+ if (!id) {
118
+ throw new Error("ID is required to delete a resource.");
119
+ }
93
120
  const response = await fetch(`${this.apiUrl}${this.path}/${id}`, {
94
121
  method: "DELETE",
95
122
  headers: this.headers
96
123
  });
97
124
  if (!response.ok) {
98
- throw new Error(`Failed to delete ${this.path}/${id}: ${response.statusText}`);
125
+ throw new Error(
126
+ `Failed to delete ${this.path}/${id}: ${response.statusText}`
127
+ );
99
128
  }
100
129
  }
101
130
  };
@@ -129,9 +158,7 @@ var Request = class {
129
158
  constructor(apiKey, connectionId) {
130
159
  this.apiKey = apiKey;
131
160
  this.connectionId = connectionId;
132
- }
133
- get baseUrl() {
134
- return "https://req.bundleup.io";
161
+ this.baseUrl = "https://api.bundleup.com/v1";
135
162
  }
136
163
  get headers() {
137
164
  return {
@@ -140,62 +167,147 @@ var Request = class {
140
167
  "BU-Connection-Id": this.connectionId
141
168
  };
142
169
  }
143
- get(path, params = {}) {
144
- const queryString = new URLSearchParams(params).toString();
145
- const url = queryString ? `${path}?${queryString}` : path;
146
- return fetch(`${this.baseUrl}${url}`, {
170
+ buildUrl(path, searchParams = {}) {
171
+ if (!path) {
172
+ throw new Error("Path is required to build URL.");
173
+ }
174
+ if (!isObject(searchParams)) {
175
+ throw new Error("URL search params must be an object.");
176
+ }
177
+ if (!path.startsWith("/")) {
178
+ path = `/${path}`;
179
+ }
180
+ const url = new URL(path, this.baseUrl);
181
+ url.search = new URLSearchParams(searchParams).toString();
182
+ return url;
183
+ }
184
+ get(path, searchParams = {}, headers = {}) {
185
+ if (!path) {
186
+ throw new Error("Path is required for GET request.");
187
+ }
188
+ if (!isObject(headers)) {
189
+ throw new Error("Headers must be an object.");
190
+ }
191
+ if (!isObject(searchParams)) {
192
+ throw new Error("URL search params must be an object.");
193
+ }
194
+ const url = this.buildUrl(path, searchParams);
195
+ return fetch(url, {
147
196
  method: "GET",
148
- headers: this.headers
197
+ headers: { ...this.headers, ...headers }
149
198
  });
150
199
  }
151
- post(path, body = {}) {
152
- return fetch(`${this.baseUrl}${path}`, {
200
+ post(path, body = {}, headers = {}) {
201
+ if (!path) {
202
+ throw new Error("Path is required for POST request.");
203
+ }
204
+ if (!isObject(headers)) {
205
+ throw new Error("Headers must be an object.");
206
+ }
207
+ if (!isObject(body)) {
208
+ throw new Error("Request body must be an object.");
209
+ }
210
+ const url = this.buildUrl(path);
211
+ return fetch(url, {
153
212
  method: "POST",
154
- headers: this.headers,
213
+ headers: { ...this.headers, ...headers },
155
214
  body: JSON.stringify(body)
156
215
  });
157
216
  }
158
- put(path, body = {}) {
159
- return fetch(`${this.baseUrl}${path}`, {
217
+ put(path, body = {}, headers = {}) {
218
+ if (!path) {
219
+ throw new Error("Path is required for PUT request.");
220
+ }
221
+ if (!isObject(headers)) {
222
+ throw new Error("Headers must be an object.");
223
+ }
224
+ if (!isObject(body)) {
225
+ throw new Error("Request body must be an object.");
226
+ }
227
+ const url = this.buildUrl(path);
228
+ return fetch(url, {
160
229
  method: "PUT",
161
- headers: this.headers,
230
+ headers: { ...this.headers, ...headers },
162
231
  body: JSON.stringify(body)
163
232
  });
164
233
  }
165
- patch(path, body = {}) {
166
- return fetch(`${this.baseUrl}${path}`, {
234
+ patch(path, body = {}, headers = {}) {
235
+ if (!path) {
236
+ throw new Error("Path is required for PATCH request.");
237
+ }
238
+ if (!isObject(headers)) {
239
+ throw new Error("Headers must be an object.");
240
+ }
241
+ if (!isObject(body)) {
242
+ throw new Error("Request body must be an object.");
243
+ }
244
+ const url = this.buildUrl(path);
245
+ return fetch(url, {
167
246
  method: "PATCH",
168
- headers: this.headers,
247
+ headers: { ...this.headers, ...headers },
169
248
  body: JSON.stringify(body)
170
249
  });
171
250
  }
172
- delete(path) {
173
- return fetch(`${this.baseUrl}${path}`, {
251
+ delete(path, headers = {}) {
252
+ if (!path) {
253
+ throw new Error("Path is required for DELETE request.");
254
+ }
255
+ if (!isObject(headers)) {
256
+ throw new Error("Headers must be an object.");
257
+ }
258
+ const url = this.buildUrl(path);
259
+ return fetch(url, {
174
260
  method: "DELETE",
175
- headers: this.headers
261
+ headers: { ...this.headers, ...headers }
176
262
  });
177
263
  }
178
264
  };
179
265
 
266
+ // src/methods/chat.ts
267
+ var Chat = class {
268
+ constructor(apiKey, connectionId) {
269
+ this.req = new Request(apiKey, connectionId);
270
+ }
271
+ message({ channelId, content }) {
272
+ if (!channelId) {
273
+ throw new Error("Channel ID is required to send a chat message.");
274
+ }
275
+ if (!content) {
276
+ throw new Error("Content is required to send a chat message.");
277
+ }
278
+ return this.req.post(
279
+ "/",
280
+ { channelId, content },
281
+ { "BU-Method": "chat.message" }
282
+ );
283
+ }
284
+ };
285
+
180
286
  // src/index.ts
181
287
  var BundleUp = class {
182
288
  constructor(apiKey) {
289
+ if (!apiKey) {
290
+ throw new Error("API key is required to initialize BundleUp SDK.");
291
+ }
183
292
  this.apiKey = apiKey;
184
293
  }
185
- connections() {
294
+ get connections() {
186
295
  return new Connections(this.apiKey);
187
296
  }
188
- integrations() {
297
+ get integrations() {
189
298
  return new Integrations(this.apiKey);
190
299
  }
191
- webhooks() {
300
+ get webhooks() {
192
301
  return new Webhooks(this.apiKey);
193
302
  }
194
- request(connectionId) {
303
+ connect(connectionId) {
195
304
  if (!connectionId) {
196
305
  throw new Error("Connection ID is required to create a Fetch instance.");
197
306
  }
198
- return new Request(this.apiKey, connectionId);
307
+ return {
308
+ req: new Request(this.apiKey, connectionId),
309
+ chat: new Chat(this.apiKey, connectionId)
310
+ };
199
311
  }
200
312
  };
201
313
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -1,9 +1,14 @@
1
+ // src/utils.ts
2
+ function isObject(value) {
3
+ return value !== null && typeof value === "object" && !Array.isArray(value);
4
+ }
5
+
1
6
  // src/base.ts
2
7
  var Base = class {
3
8
  constructor(apiKey) {
9
+ this.apiKey = apiKey;
4
10
  this.baseUrl = "https://api.bundleup.io";
5
11
  this.version = "v1";
6
- this.apiKey = apiKey;
7
12
  }
8
13
  get apiUrl() {
9
14
  return `${this.baseUrl}/${this.version}`;
@@ -15,6 +20,9 @@ var Base = class {
15
20
  };
16
21
  }
17
22
  async list(params = {}) {
23
+ if (!isObject(params)) {
24
+ throw new Error("List parameters must be an object.");
25
+ }
18
26
  const response = await fetch(`${this.apiUrl}${this.path}`, {
19
27
  method: "GET",
20
28
  headers: this.headers,
@@ -29,6 +37,9 @@ var Base = class {
29
37
  return data;
30
38
  }
31
39
  async create(body) {
40
+ if (!isObject(body)) {
41
+ throw new Error("Request body must be an object.");
42
+ }
32
43
  const response = await fetch(`${this.apiUrl}${this.path}`, {
33
44
  method: "POST",
34
45
  headers: this.headers,
@@ -41,35 +52,53 @@ var Base = class {
41
52
  return data;
42
53
  }
43
54
  async retrieve(id) {
55
+ if (!id) {
56
+ throw new Error("ID is required to retrieve a resource.");
57
+ }
44
58
  const response = await fetch(`${this.apiUrl}${this.path}/${id}`, {
45
59
  method: "GET",
46
60
  headers: this.headers
47
61
  });
48
62
  if (!response.ok) {
49
- throw new Error(`Failed to retrieve ${this.path}/${id}: ${response.statusText}`);
63
+ throw new Error(
64
+ `Failed to retrieve ${this.path}/${id}: ${response.statusText}`
65
+ );
50
66
  }
51
67
  const data = await response.json();
52
68
  return data;
53
69
  }
54
70
  async update(id, body) {
71
+ if (!id) {
72
+ throw new Error("ID is required to update a resource.");
73
+ }
74
+ if (!isObject(body)) {
75
+ throw new Error("Request body must be an object.");
76
+ }
55
77
  const response = await fetch(`${this.apiUrl}${this.path}/${id}`, {
56
78
  method: "PATCH",
57
79
  headers: this.headers,
58
80
  body: JSON.stringify(body)
59
81
  });
60
82
  if (!response.ok) {
61
- throw new Error(`Failed to update ${this.path}/${id}: ${response.statusText}`);
83
+ throw new Error(
84
+ `Failed to update ${this.path}/${id}: ${response.statusText}`
85
+ );
62
86
  }
63
87
  const data = await response.json();
64
88
  return data;
65
89
  }
66
90
  async del(id) {
91
+ if (!id) {
92
+ throw new Error("ID is required to delete a resource.");
93
+ }
67
94
  const response = await fetch(`${this.apiUrl}${this.path}/${id}`, {
68
95
  method: "DELETE",
69
96
  headers: this.headers
70
97
  });
71
98
  if (!response.ok) {
72
- throw new Error(`Failed to delete ${this.path}/${id}: ${response.statusText}`);
99
+ throw new Error(
100
+ `Failed to delete ${this.path}/${id}: ${response.statusText}`
101
+ );
73
102
  }
74
103
  }
75
104
  };
@@ -103,9 +132,7 @@ var Request = class {
103
132
  constructor(apiKey, connectionId) {
104
133
  this.apiKey = apiKey;
105
134
  this.connectionId = connectionId;
106
- }
107
- get baseUrl() {
108
- return "https://req.bundleup.io";
135
+ this.baseUrl = "https://api.bundleup.com/v1";
109
136
  }
110
137
  get headers() {
111
138
  return {
@@ -114,62 +141,147 @@ var Request = class {
114
141
  "BU-Connection-Id": this.connectionId
115
142
  };
116
143
  }
117
- get(path, params = {}) {
118
- const queryString = new URLSearchParams(params).toString();
119
- const url = queryString ? `${path}?${queryString}` : path;
120
- return fetch(`${this.baseUrl}${url}`, {
144
+ buildUrl(path, searchParams = {}) {
145
+ if (!path) {
146
+ throw new Error("Path is required to build URL.");
147
+ }
148
+ if (!isObject(searchParams)) {
149
+ throw new Error("URL search params must be an object.");
150
+ }
151
+ if (!path.startsWith("/")) {
152
+ path = `/${path}`;
153
+ }
154
+ const url = new URL(path, this.baseUrl);
155
+ url.search = new URLSearchParams(searchParams).toString();
156
+ return url;
157
+ }
158
+ get(path, searchParams = {}, headers = {}) {
159
+ if (!path) {
160
+ throw new Error("Path is required for GET request.");
161
+ }
162
+ if (!isObject(headers)) {
163
+ throw new Error("Headers must be an object.");
164
+ }
165
+ if (!isObject(searchParams)) {
166
+ throw new Error("URL search params must be an object.");
167
+ }
168
+ const url = this.buildUrl(path, searchParams);
169
+ return fetch(url, {
121
170
  method: "GET",
122
- headers: this.headers
171
+ headers: { ...this.headers, ...headers }
123
172
  });
124
173
  }
125
- post(path, body = {}) {
126
- return fetch(`${this.baseUrl}${path}`, {
174
+ post(path, body = {}, headers = {}) {
175
+ if (!path) {
176
+ throw new Error("Path is required for POST request.");
177
+ }
178
+ if (!isObject(headers)) {
179
+ throw new Error("Headers must be an object.");
180
+ }
181
+ if (!isObject(body)) {
182
+ throw new Error("Request body must be an object.");
183
+ }
184
+ const url = this.buildUrl(path);
185
+ return fetch(url, {
127
186
  method: "POST",
128
- headers: this.headers,
187
+ headers: { ...this.headers, ...headers },
129
188
  body: JSON.stringify(body)
130
189
  });
131
190
  }
132
- put(path, body = {}) {
133
- return fetch(`${this.baseUrl}${path}`, {
191
+ put(path, body = {}, headers = {}) {
192
+ if (!path) {
193
+ throw new Error("Path is required for PUT request.");
194
+ }
195
+ if (!isObject(headers)) {
196
+ throw new Error("Headers must be an object.");
197
+ }
198
+ if (!isObject(body)) {
199
+ throw new Error("Request body must be an object.");
200
+ }
201
+ const url = this.buildUrl(path);
202
+ return fetch(url, {
134
203
  method: "PUT",
135
- headers: this.headers,
204
+ headers: { ...this.headers, ...headers },
136
205
  body: JSON.stringify(body)
137
206
  });
138
207
  }
139
- patch(path, body = {}) {
140
- return fetch(`${this.baseUrl}${path}`, {
208
+ patch(path, body = {}, headers = {}) {
209
+ if (!path) {
210
+ throw new Error("Path is required for PATCH request.");
211
+ }
212
+ if (!isObject(headers)) {
213
+ throw new Error("Headers must be an object.");
214
+ }
215
+ if (!isObject(body)) {
216
+ throw new Error("Request body must be an object.");
217
+ }
218
+ const url = this.buildUrl(path);
219
+ return fetch(url, {
141
220
  method: "PATCH",
142
- headers: this.headers,
221
+ headers: { ...this.headers, ...headers },
143
222
  body: JSON.stringify(body)
144
223
  });
145
224
  }
146
- delete(path) {
147
- return fetch(`${this.baseUrl}${path}`, {
225
+ delete(path, headers = {}) {
226
+ if (!path) {
227
+ throw new Error("Path is required for DELETE request.");
228
+ }
229
+ if (!isObject(headers)) {
230
+ throw new Error("Headers must be an object.");
231
+ }
232
+ const url = this.buildUrl(path);
233
+ return fetch(url, {
148
234
  method: "DELETE",
149
- headers: this.headers
235
+ headers: { ...this.headers, ...headers }
150
236
  });
151
237
  }
152
238
  };
153
239
 
240
+ // src/methods/chat.ts
241
+ var Chat = class {
242
+ constructor(apiKey, connectionId) {
243
+ this.req = new Request(apiKey, connectionId);
244
+ }
245
+ message({ channelId, content }) {
246
+ if (!channelId) {
247
+ throw new Error("Channel ID is required to send a chat message.");
248
+ }
249
+ if (!content) {
250
+ throw new Error("Content is required to send a chat message.");
251
+ }
252
+ return this.req.post(
253
+ "/",
254
+ { channelId, content },
255
+ { "BU-Method": "chat.message" }
256
+ );
257
+ }
258
+ };
259
+
154
260
  // src/index.ts
155
261
  var BundleUp = class {
156
262
  constructor(apiKey) {
263
+ if (!apiKey) {
264
+ throw new Error("API key is required to initialize BundleUp SDK.");
265
+ }
157
266
  this.apiKey = apiKey;
158
267
  }
159
- connections() {
268
+ get connections() {
160
269
  return new Connections(this.apiKey);
161
270
  }
162
- integrations() {
271
+ get integrations() {
163
272
  return new Integrations(this.apiKey);
164
273
  }
165
- webhooks() {
274
+ get webhooks() {
166
275
  return new Webhooks(this.apiKey);
167
276
  }
168
- request(connectionId) {
277
+ connect(connectionId) {
169
278
  if (!connectionId) {
170
279
  throw new Error("Connection ID is required to create a Fetch instance.");
171
280
  }
172
- return new Request(this.apiKey, connectionId);
281
+ return {
282
+ req: new Request(this.apiKey, connectionId),
283
+ chat: new Chat(this.apiKey, connectionId)
284
+ };
173
285
  }
174
286
  };
175
287
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bundleup/sdk",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "SDK package for BundleUp",
5
5
  "exports": {
6
6
  ".": {