@bundleup/sdk 0.0.1 → 0.0.2
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 +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +14 -37
- package/dist/index.mjs +14 -37
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -50,17 +50,17 @@ declare class Webhooks extends Base<Webhook> {
|
|
|
50
50
|
protected path: string;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
declare class
|
|
53
|
+
declare class Request {
|
|
54
54
|
private apiKey;
|
|
55
55
|
private connectionId;
|
|
56
56
|
constructor(apiKey: string, connectionId: string);
|
|
57
57
|
protected get baseUrl(): string;
|
|
58
58
|
protected get headers(): Record<string, string>;
|
|
59
|
-
get(path: string, params?: Record<string, any>): Promise<
|
|
60
|
-
post(path: string, body?: Record<string, any>): Promise<
|
|
61
|
-
put(path: string, body?: Record<string, any>): Promise<
|
|
62
|
-
patch(path: string, body?: Record<string, any>): Promise<
|
|
63
|
-
delete(path: string): Promise<
|
|
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>;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
declare class BundleUp {
|
|
@@ -69,7 +69,7 @@ declare class BundleUp {
|
|
|
69
69
|
connections(): Connections;
|
|
70
70
|
integrations(): Integrations;
|
|
71
71
|
webhooks(): Webhooks;
|
|
72
|
-
request(connectionId: string):
|
|
72
|
+
request(connectionId: string): Request;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
export { BundleUp };
|
package/dist/index.d.ts
CHANGED
|
@@ -50,17 +50,17 @@ declare class Webhooks extends Base<Webhook> {
|
|
|
50
50
|
protected path: string;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
declare class
|
|
53
|
+
declare class Request {
|
|
54
54
|
private apiKey;
|
|
55
55
|
private connectionId;
|
|
56
56
|
constructor(apiKey: string, connectionId: string);
|
|
57
57
|
protected get baseUrl(): string;
|
|
58
58
|
protected get headers(): Record<string, string>;
|
|
59
|
-
get(path: string, params?: Record<string, any>): Promise<
|
|
60
|
-
post(path: string, body?: Record<string, any>): Promise<
|
|
61
|
-
put(path: string, body?: Record<string, any>): Promise<
|
|
62
|
-
patch(path: string, body?: Record<string, any>): Promise<
|
|
63
|
-
delete(path: string): Promise<
|
|
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>;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
declare class BundleUp {
|
|
@@ -69,7 +69,7 @@ declare class BundleUp {
|
|
|
69
69
|
connections(): Connections;
|
|
70
70
|
integrations(): Integrations;
|
|
71
71
|
webhooks(): Webhooks;
|
|
72
|
-
request(connectionId: string):
|
|
72
|
+
request(connectionId: string): Request;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
export { BundleUp };
|
package/dist/index.js
CHANGED
|
@@ -125,7 +125,7 @@ var Webhooks = class extends Base {
|
|
|
125
125
|
};
|
|
126
126
|
|
|
127
127
|
// src/request.ts
|
|
128
|
-
var
|
|
128
|
+
var Request = class {
|
|
129
129
|
constructor(apiKey, connectionId) {
|
|
130
130
|
this.apiKey = apiKey;
|
|
131
131
|
this.connectionId = connectionId;
|
|
@@ -140,63 +140,40 @@ var BURequest = class {
|
|
|
140
140
|
"BU-Connection-Id": this.connectionId
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
|
-
|
|
143
|
+
get(path, params = {}) {
|
|
144
144
|
const queryString = new URLSearchParams(params).toString();
|
|
145
145
|
const url = queryString ? `${path}?${queryString}` : path;
|
|
146
|
-
|
|
146
|
+
return fetch(`${this.baseUrl}${url}`, {
|
|
147
147
|
method: "GET",
|
|
148
148
|
headers: this.headers
|
|
149
149
|
});
|
|
150
|
-
if (!response.ok) {
|
|
151
|
-
throw new Error(`Failed to fetch ${path}: ${response.statusText}`);
|
|
152
|
-
}
|
|
153
|
-
return response.json();
|
|
154
150
|
}
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
post(path, body = {}) {
|
|
152
|
+
return fetch(`${this.baseUrl}${path}`, {
|
|
157
153
|
method: "POST",
|
|
158
|
-
headers:
|
|
159
|
-
"Content-Type": "application/json",
|
|
160
|
-
Authorization: `Bearer ${this.apiKey}`
|
|
161
|
-
},
|
|
154
|
+
headers: this.headers,
|
|
162
155
|
body: JSON.stringify(body)
|
|
163
156
|
});
|
|
164
|
-
if (!response.ok) {
|
|
165
|
-
throw new Error(`Failed to post to ${path}: ${response.statusText}`);
|
|
166
|
-
}
|
|
167
|
-
return response.json();
|
|
168
157
|
}
|
|
169
|
-
|
|
170
|
-
|
|
158
|
+
put(path, body = {}) {
|
|
159
|
+
return fetch(`${this.baseUrl}${path}`, {
|
|
171
160
|
method: "PUT",
|
|
172
161
|
headers: this.headers,
|
|
173
162
|
body: JSON.stringify(body)
|
|
174
163
|
});
|
|
175
|
-
if (!response.ok) {
|
|
176
|
-
throw new Error(`Failed to put to ${path}: ${response.statusText}`);
|
|
177
|
-
}
|
|
178
|
-
return response.json();
|
|
179
164
|
}
|
|
180
|
-
|
|
181
|
-
|
|
165
|
+
patch(path, body = {}) {
|
|
166
|
+
return fetch(`${this.baseUrl}${path}`, {
|
|
182
167
|
method: "PATCH",
|
|
183
168
|
headers: this.headers,
|
|
184
169
|
body: JSON.stringify(body)
|
|
185
170
|
});
|
|
186
|
-
if (!response.ok) {
|
|
187
|
-
throw new Error(`Failed to patch ${path}: ${response.statusText}`);
|
|
188
|
-
}
|
|
189
|
-
return response.json();
|
|
190
171
|
}
|
|
191
|
-
|
|
192
|
-
|
|
172
|
+
delete(path) {
|
|
173
|
+
return fetch(`${this.baseUrl}${path}`, {
|
|
193
174
|
method: "DELETE",
|
|
194
175
|
headers: this.headers
|
|
195
176
|
});
|
|
196
|
-
if (!response.ok) {
|
|
197
|
-
throw new Error(`Failed to delete ${path}: ${response.statusText}`);
|
|
198
|
-
}
|
|
199
|
-
return response.json();
|
|
200
177
|
}
|
|
201
178
|
};
|
|
202
179
|
|
|
@@ -216,9 +193,9 @@ var BundleUp = class {
|
|
|
216
193
|
}
|
|
217
194
|
request(connectionId) {
|
|
218
195
|
if (!connectionId) {
|
|
219
|
-
throw new Error("Connection ID is required to create a
|
|
196
|
+
throw new Error("Connection ID is required to create a Fetch instance.");
|
|
220
197
|
}
|
|
221
|
-
return new
|
|
198
|
+
return new Request(this.apiKey, connectionId);
|
|
222
199
|
}
|
|
223
200
|
};
|
|
224
201
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -99,7 +99,7 @@ var Webhooks = class extends Base {
|
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
// src/request.ts
|
|
102
|
-
var
|
|
102
|
+
var Request = class {
|
|
103
103
|
constructor(apiKey, connectionId) {
|
|
104
104
|
this.apiKey = apiKey;
|
|
105
105
|
this.connectionId = connectionId;
|
|
@@ -114,63 +114,40 @@ var BURequest = class {
|
|
|
114
114
|
"BU-Connection-Id": this.connectionId
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
|
-
|
|
117
|
+
get(path, params = {}) {
|
|
118
118
|
const queryString = new URLSearchParams(params).toString();
|
|
119
119
|
const url = queryString ? `${path}?${queryString}` : path;
|
|
120
|
-
|
|
120
|
+
return fetch(`${this.baseUrl}${url}`, {
|
|
121
121
|
method: "GET",
|
|
122
122
|
headers: this.headers
|
|
123
123
|
});
|
|
124
|
-
if (!response.ok) {
|
|
125
|
-
throw new Error(`Failed to fetch ${path}: ${response.statusText}`);
|
|
126
|
-
}
|
|
127
|
-
return response.json();
|
|
128
124
|
}
|
|
129
|
-
|
|
130
|
-
|
|
125
|
+
post(path, body = {}) {
|
|
126
|
+
return fetch(`${this.baseUrl}${path}`, {
|
|
131
127
|
method: "POST",
|
|
132
|
-
headers:
|
|
133
|
-
"Content-Type": "application/json",
|
|
134
|
-
Authorization: `Bearer ${this.apiKey}`
|
|
135
|
-
},
|
|
128
|
+
headers: this.headers,
|
|
136
129
|
body: JSON.stringify(body)
|
|
137
130
|
});
|
|
138
|
-
if (!response.ok) {
|
|
139
|
-
throw new Error(`Failed to post to ${path}: ${response.statusText}`);
|
|
140
|
-
}
|
|
141
|
-
return response.json();
|
|
142
131
|
}
|
|
143
|
-
|
|
144
|
-
|
|
132
|
+
put(path, body = {}) {
|
|
133
|
+
return fetch(`${this.baseUrl}${path}`, {
|
|
145
134
|
method: "PUT",
|
|
146
135
|
headers: this.headers,
|
|
147
136
|
body: JSON.stringify(body)
|
|
148
137
|
});
|
|
149
|
-
if (!response.ok) {
|
|
150
|
-
throw new Error(`Failed to put to ${path}: ${response.statusText}`);
|
|
151
|
-
}
|
|
152
|
-
return response.json();
|
|
153
138
|
}
|
|
154
|
-
|
|
155
|
-
|
|
139
|
+
patch(path, body = {}) {
|
|
140
|
+
return fetch(`${this.baseUrl}${path}`, {
|
|
156
141
|
method: "PATCH",
|
|
157
142
|
headers: this.headers,
|
|
158
143
|
body: JSON.stringify(body)
|
|
159
144
|
});
|
|
160
|
-
if (!response.ok) {
|
|
161
|
-
throw new Error(`Failed to patch ${path}: ${response.statusText}`);
|
|
162
|
-
}
|
|
163
|
-
return response.json();
|
|
164
145
|
}
|
|
165
|
-
|
|
166
|
-
|
|
146
|
+
delete(path) {
|
|
147
|
+
return fetch(`${this.baseUrl}${path}`, {
|
|
167
148
|
method: "DELETE",
|
|
168
149
|
headers: this.headers
|
|
169
150
|
});
|
|
170
|
-
if (!response.ok) {
|
|
171
|
-
throw new Error(`Failed to delete ${path}: ${response.statusText}`);
|
|
172
|
-
}
|
|
173
|
-
return response.json();
|
|
174
151
|
}
|
|
175
152
|
};
|
|
176
153
|
|
|
@@ -190,9 +167,9 @@ var BundleUp = class {
|
|
|
190
167
|
}
|
|
191
168
|
request(connectionId) {
|
|
192
169
|
if (!connectionId) {
|
|
193
|
-
throw new Error("Connection ID is required to create a
|
|
170
|
+
throw new Error("Connection ID is required to create a Fetch instance.");
|
|
194
171
|
}
|
|
195
|
-
return new
|
|
172
|
+
return new Request(this.apiKey, connectionId);
|
|
196
173
|
}
|
|
197
174
|
};
|
|
198
175
|
export {
|