@bundleup/sdk 0.0.6 → 0.0.7

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
@@ -6,10 +6,41 @@ declare abstract class Base<T> {
6
6
  constructor(apiKey: string);
7
7
  private get apiUrl();
8
8
  private get headers();
9
+ /**
10
+ * List resources with optional query parameters.
11
+ * @param params - Query parameters for filtering the list.
12
+ * @returns A promise that resolves to an array of resources.
13
+ * @throws If params is not an object or if the fetch request fails.
14
+ */
9
15
  list<K extends Record<string, any>>(params?: K): Promise<T[]>;
16
+ /**
17
+ * Create a new resource.
18
+ * @param body - The request body containing resource details.
19
+ * @returns A promise that resolves to the created resource.
20
+ * @throws If body is not an object or if the fetch request fails.
21
+ */
10
22
  create<K extends Record<string, any>>(body: K): Promise<T>;
23
+ /**
24
+ * Retrieve a specific resource by ID.
25
+ * @param id - The ID of the resource to retrieve.
26
+ * @returns A promise that resolves to the retrieved resource.
27
+ * @throws If id is not provided or if the fetch request fails.
28
+ */
11
29
  retrieve(id: string): Promise<T>;
30
+ /**
31
+ * Update a specific resource by ID.
32
+ * @param id - The ID of the resource to update.
33
+ * @param body - The request body containing updated resource details.
34
+ * @returns A promise that resolves to the updated resource.
35
+ * @throws If id is not provided, if body is not an object, or if the fetch request fails.
36
+ */
12
37
  update<K extends Record<string, any>>(id: string, body: K): Promise<T>;
38
+ /**
39
+ * Delete a specific resource by ID.
40
+ * @param id - The ID of the resource to delete.
41
+ * @returns A promise that resolves when the resource is deleted.
42
+ * @throws If id is not provided or if the fetch request fails.
43
+ */
13
44
  del(id: string): Promise<void>;
14
45
  }
15
46
 
@@ -28,10 +59,10 @@ declare class Connections extends Base<Connection> {
28
59
  }
29
60
 
30
61
  interface Integration {
31
- id: true;
32
- identifier: true;
33
- createdAt: true;
34
- updatedAt: true;
62
+ id: string;
63
+ identifier: string;
64
+ createdAt: Date;
65
+ updatedAt: Date;
35
66
  }
36
67
  declare class Integrations extends Base<Integration> {
37
68
  protected path: string;
@@ -71,6 +102,14 @@ type ChatMessageRequest = {
71
102
  declare class Chat {
72
103
  private req;
73
104
  constructor(apiKey: string, connectionId: string);
105
+ /**
106
+ * Send a chat message to a specific channel.
107
+ * @param params - The parameters for sending a chat message.
108
+ * @param params.channelId - The ID of the channel to send the message to.
109
+ * @param params.content - The content of the chat message.
110
+ * @returns The response from the API.
111
+ * @throws If channelId or content is missing.
112
+ */
74
113
  message({ channelId, content }: ChatMessageRequest): Promise<Response>;
75
114
  }
76
115
 
package/dist/index.d.ts CHANGED
@@ -6,10 +6,41 @@ declare abstract class Base<T> {
6
6
  constructor(apiKey: string);
7
7
  private get apiUrl();
8
8
  private get headers();
9
+ /**
10
+ * List resources with optional query parameters.
11
+ * @param params - Query parameters for filtering the list.
12
+ * @returns A promise that resolves to an array of resources.
13
+ * @throws If params is not an object or if the fetch request fails.
14
+ */
9
15
  list<K extends Record<string, any>>(params?: K): Promise<T[]>;
16
+ /**
17
+ * Create a new resource.
18
+ * @param body - The request body containing resource details.
19
+ * @returns A promise that resolves to the created resource.
20
+ * @throws If body is not an object or if the fetch request fails.
21
+ */
10
22
  create<K extends Record<string, any>>(body: K): Promise<T>;
23
+ /**
24
+ * Retrieve a specific resource by ID.
25
+ * @param id - The ID of the resource to retrieve.
26
+ * @returns A promise that resolves to the retrieved resource.
27
+ * @throws If id is not provided or if the fetch request fails.
28
+ */
11
29
  retrieve(id: string): Promise<T>;
30
+ /**
31
+ * Update a specific resource by ID.
32
+ * @param id - The ID of the resource to update.
33
+ * @param body - The request body containing updated resource details.
34
+ * @returns A promise that resolves to the updated resource.
35
+ * @throws If id is not provided, if body is not an object, or if the fetch request fails.
36
+ */
12
37
  update<K extends Record<string, any>>(id: string, body: K): Promise<T>;
38
+ /**
39
+ * Delete a specific resource by ID.
40
+ * @param id - The ID of the resource to delete.
41
+ * @returns A promise that resolves when the resource is deleted.
42
+ * @throws If id is not provided or if the fetch request fails.
43
+ */
13
44
  del(id: string): Promise<void>;
14
45
  }
15
46
 
@@ -28,10 +59,10 @@ declare class Connections extends Base<Connection> {
28
59
  }
29
60
 
30
61
  interface Integration {
31
- id: true;
32
- identifier: true;
33
- createdAt: true;
34
- updatedAt: true;
62
+ id: string;
63
+ identifier: string;
64
+ createdAt: Date;
65
+ updatedAt: Date;
35
66
  }
36
67
  declare class Integrations extends Base<Integration> {
37
68
  protected path: string;
@@ -71,6 +102,14 @@ type ChatMessageRequest = {
71
102
  declare class Chat {
72
103
  private req;
73
104
  constructor(apiKey: string, connectionId: string);
105
+ /**
106
+ * Send a chat message to a specific channel.
107
+ * @param params - The parameters for sending a chat message.
108
+ * @param params.channelId - The ID of the channel to send the message to.
109
+ * @param params.content - The content of the chat message.
110
+ * @returns The response from the API.
111
+ * @throws If channelId or content is missing.
112
+ */
74
113
  message({ channelId, content }: ChatMessageRequest): Promise<Response>;
75
114
  }
76
115
 
package/dist/index.js CHANGED
@@ -45,6 +45,12 @@ var Base = class {
45
45
  Authorization: `Bearer ${this.apiKey}`
46
46
  };
47
47
  }
48
+ /**
49
+ * List resources with optional query parameters.
50
+ * @param params - Query parameters for filtering the list.
51
+ * @returns A promise that resolves to an array of resources.
52
+ * @throws If params is not an object or if the fetch request fails.
53
+ */
48
54
  async list(params = {}) {
49
55
  if (!isObject(params)) {
50
56
  throw new Error("List parameters must be an object.");
@@ -62,6 +68,12 @@ var Base = class {
62
68
  const data = await response.json();
63
69
  return data;
64
70
  }
71
+ /**
72
+ * Create a new resource.
73
+ * @param body - The request body containing resource details.
74
+ * @returns A promise that resolves to the created resource.
75
+ * @throws If body is not an object or if the fetch request fails.
76
+ */
65
77
  async create(body) {
66
78
  if (!isObject(body)) {
67
79
  throw new Error("Request body must be an object.");
@@ -77,6 +89,12 @@ var Base = class {
77
89
  const data = await response.json();
78
90
  return data;
79
91
  }
92
+ /**
93
+ * Retrieve a specific resource by ID.
94
+ * @param id - The ID of the resource to retrieve.
95
+ * @returns A promise that resolves to the retrieved resource.
96
+ * @throws If id is not provided or if the fetch request fails.
97
+ */
80
98
  async retrieve(id) {
81
99
  if (!id) {
82
100
  throw new Error("ID is required to retrieve a resource.");
@@ -93,6 +111,13 @@ var Base = class {
93
111
  const data = await response.json();
94
112
  return data;
95
113
  }
114
+ /**
115
+ * Update a specific resource by ID.
116
+ * @param id - The ID of the resource to update.
117
+ * @param body - The request body containing updated resource details.
118
+ * @returns A promise that resolves to the updated resource.
119
+ * @throws If id is not provided, if body is not an object, or if the fetch request fails.
120
+ */
96
121
  async update(id, body) {
97
122
  if (!id) {
98
123
  throw new Error("ID is required to update a resource.");
@@ -113,6 +138,12 @@ var Base = class {
113
138
  const data = await response.json();
114
139
  return data;
115
140
  }
141
+ /**
142
+ * Delete a specific resource by ID.
143
+ * @param id - The ID of the resource to delete.
144
+ * @returns A promise that resolves when the resource is deleted.
145
+ * @throws If id is not provided or if the fetch request fails.
146
+ */
116
147
  async del(id) {
117
148
  if (!id) {
118
149
  throw new Error("ID is required to delete a resource.");
@@ -268,6 +299,14 @@ var Chat = class {
268
299
  constructor(apiKey, connectionId) {
269
300
  this.req = new Request(apiKey, connectionId);
270
301
  }
302
+ /**
303
+ * Send a chat message to a specific channel.
304
+ * @param params - The parameters for sending a chat message.
305
+ * @param params.channelId - The ID of the channel to send the message to.
306
+ * @param params.content - The content of the chat message.
307
+ * @returns The response from the API.
308
+ * @throws If channelId or content is missing.
309
+ */
271
310
  message({ channelId, content }) {
272
311
  if (!channelId) {
273
312
  throw new Error("Channel ID is required to send a chat message.");
package/dist/index.mjs CHANGED
@@ -19,6 +19,12 @@ var Base = class {
19
19
  Authorization: `Bearer ${this.apiKey}`
20
20
  };
21
21
  }
22
+ /**
23
+ * List resources with optional query parameters.
24
+ * @param params - Query parameters for filtering the list.
25
+ * @returns A promise that resolves to an array of resources.
26
+ * @throws If params is not an object or if the fetch request fails.
27
+ */
22
28
  async list(params = {}) {
23
29
  if (!isObject(params)) {
24
30
  throw new Error("List parameters must be an object.");
@@ -36,6 +42,12 @@ var Base = class {
36
42
  const data = await response.json();
37
43
  return data;
38
44
  }
45
+ /**
46
+ * Create a new resource.
47
+ * @param body - The request body containing resource details.
48
+ * @returns A promise that resolves to the created resource.
49
+ * @throws If body is not an object or if the fetch request fails.
50
+ */
39
51
  async create(body) {
40
52
  if (!isObject(body)) {
41
53
  throw new Error("Request body must be an object.");
@@ -51,6 +63,12 @@ var Base = class {
51
63
  const data = await response.json();
52
64
  return data;
53
65
  }
66
+ /**
67
+ * Retrieve a specific resource by ID.
68
+ * @param id - The ID of the resource to retrieve.
69
+ * @returns A promise that resolves to the retrieved resource.
70
+ * @throws If id is not provided or if the fetch request fails.
71
+ */
54
72
  async retrieve(id) {
55
73
  if (!id) {
56
74
  throw new Error("ID is required to retrieve a resource.");
@@ -67,6 +85,13 @@ var Base = class {
67
85
  const data = await response.json();
68
86
  return data;
69
87
  }
88
+ /**
89
+ * Update a specific resource by ID.
90
+ * @param id - The ID of the resource to update.
91
+ * @param body - The request body containing updated resource details.
92
+ * @returns A promise that resolves to the updated resource.
93
+ * @throws If id is not provided, if body is not an object, or if the fetch request fails.
94
+ */
70
95
  async update(id, body) {
71
96
  if (!id) {
72
97
  throw new Error("ID is required to update a resource.");
@@ -87,6 +112,12 @@ var Base = class {
87
112
  const data = await response.json();
88
113
  return data;
89
114
  }
115
+ /**
116
+ * Delete a specific resource by ID.
117
+ * @param id - The ID of the resource to delete.
118
+ * @returns A promise that resolves when the resource is deleted.
119
+ * @throws If id is not provided or if the fetch request fails.
120
+ */
90
121
  async del(id) {
91
122
  if (!id) {
92
123
  throw new Error("ID is required to delete a resource.");
@@ -242,6 +273,14 @@ var Chat = class {
242
273
  constructor(apiKey, connectionId) {
243
274
  this.req = new Request(apiKey, connectionId);
244
275
  }
276
+ /**
277
+ * Send a chat message to a specific channel.
278
+ * @param params - The parameters for sending a chat message.
279
+ * @param params.channelId - The ID of the channel to send the message to.
280
+ * @param params.content - The content of the chat message.
281
+ * @returns The response from the API.
282
+ * @throws If channelId or content is missing.
283
+ */
245
284
  message({ channelId, content }) {
246
285
  if (!channelId) {
247
286
  throw new Error("Channel ID is required to send a chat message.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bundleup/sdk",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "SDK package for BundleUp",
5
5
  "exports": {
6
6
  ".": {