@forklaunch/universal-sdk 0.2.3 → 0.2.5

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/lib/index.js CHANGED
@@ -175,24 +175,75 @@ var UniversalSdk = class {
175
175
  headers: response.headers
176
176
  };
177
177
  }
178
+ /**
179
+ * Executes a request with path parameters.
180
+ *
181
+ * @param {string} route - The route path for the request.
182
+ * @param {'GET' | 'DELETE'} method - The HTTP method.
183
+ * @param {RequestType} [request] - The request object.
184
+ * @returns {Promise<ResponseType>} - The response object.
185
+ */
178
186
  async pathParamRequest(route, method, request) {
179
187
  return this.execute(route, method, request);
180
188
  }
189
+ /**
190
+ * Executes a request with a body.
191
+ *
192
+ * @param {string} route - The route path for the request.
193
+ * @param {'POST' | 'PUT' | 'PATCH'} method - The HTTP method.
194
+ * @param {RequestType} [request] - The request object.
195
+ * @returns {Promise<ResponseType>} - The response object.
196
+ */
181
197
  async bodyRequest(route, method, request) {
182
198
  return this.execute(route, method, request);
183
199
  }
200
+ /**
201
+ * Executes a GET request.
202
+ *
203
+ * @param {string} route - The route path for the request.
204
+ * @param {RequestType} [request] - The request object.
205
+ * @returns {Promise<ResponseType>} - The response object.
206
+ */
184
207
  async get(route, request) {
185
208
  return this.pathParamRequest(route, "GET", request);
186
209
  }
210
+ /**
211
+ * Executes a POST request.
212
+ *
213
+ * @param {string} route - The route path for the request.
214
+ * @param {RequestType} [request] - The request object.
215
+ * @returns {Promise<ResponseType>} - The response object.
216
+ */
187
217
  async post(route, request) {
188
218
  return this.bodyRequest(route, "POST", request);
189
219
  }
220
+ /**
221
+ * Executes a PUT request.
222
+ *
223
+ * @param {string} route - The route path for the request.
224
+ * @param {RequestType} [request] - The request object.
225
+ * @returns {Promise<ResponseType>} - The response object.
226
+ */
190
227
  async put(route, request) {
191
228
  return this.bodyRequest(route, "PUT", request);
192
229
  }
230
+ /**
231
+ * Executes a PATCH request.
232
+ *
233
+ * @param {string} route - The route path for the request.
234
+ * @param {RequestType} [request] - The request object.
235
+ * @returns {Promise<ResponseType>} - The response object.
236
+ */
193
237
  async patch(route, request) {
194
238
  return this.bodyRequest(route, "PATCH", request);
195
239
  }
240
+ /**
241
+ * Executes a DELETE request.
242
+ *
243
+ * @param {string} route - The route path for the request.
244
+ * @param {RequestType} [request] - The request object.
245
+ * @returns {Promise<ResponseType>} - The response object.
246
+ */
196
247
  async delete(route, request) {
197
248
  return this.pathParamRequest(route, "DELETE", request);
198
249
  }
package/lib/index.mjs CHANGED
@@ -149,24 +149,75 @@ var UniversalSdk = class {
149
149
  headers: response.headers
150
150
  };
151
151
  }
152
+ /**
153
+ * Executes a request with path parameters.
154
+ *
155
+ * @param {string} route - The route path for the request.
156
+ * @param {'GET' | 'DELETE'} method - The HTTP method.
157
+ * @param {RequestType} [request] - The request object.
158
+ * @returns {Promise<ResponseType>} - The response object.
159
+ */
152
160
  async pathParamRequest(route, method, request) {
153
161
  return this.execute(route, method, request);
154
162
  }
163
+ /**
164
+ * Executes a request with a body.
165
+ *
166
+ * @param {string} route - The route path for the request.
167
+ * @param {'POST' | 'PUT' | 'PATCH'} method - The HTTP method.
168
+ * @param {RequestType} [request] - The request object.
169
+ * @returns {Promise<ResponseType>} - The response object.
170
+ */
155
171
  async bodyRequest(route, method, request) {
156
172
  return this.execute(route, method, request);
157
173
  }
174
+ /**
175
+ * Executes a GET request.
176
+ *
177
+ * @param {string} route - The route path for the request.
178
+ * @param {RequestType} [request] - The request object.
179
+ * @returns {Promise<ResponseType>} - The response object.
180
+ */
158
181
  async get(route, request) {
159
182
  return this.pathParamRequest(route, "GET", request);
160
183
  }
184
+ /**
185
+ * Executes a POST request.
186
+ *
187
+ * @param {string} route - The route path for the request.
188
+ * @param {RequestType} [request] - The request object.
189
+ * @returns {Promise<ResponseType>} - The response object.
190
+ */
161
191
  async post(route, request) {
162
192
  return this.bodyRequest(route, "POST", request);
163
193
  }
194
+ /**
195
+ * Executes a PUT request.
196
+ *
197
+ * @param {string} route - The route path for the request.
198
+ * @param {RequestType} [request] - The request object.
199
+ * @returns {Promise<ResponseType>} - The response object.
200
+ */
164
201
  async put(route, request) {
165
202
  return this.bodyRequest(route, "PUT", request);
166
203
  }
204
+ /**
205
+ * Executes a PATCH request.
206
+ *
207
+ * @param {string} route - The route path for the request.
208
+ * @param {RequestType} [request] - The request object.
209
+ * @returns {Promise<ResponseType>} - The response object.
210
+ */
167
211
  async patch(route, request) {
168
212
  return this.bodyRequest(route, "PATCH", request);
169
213
  }
214
+ /**
215
+ * Executes a DELETE request.
216
+ *
217
+ * @param {string} route - The route path for the request.
218
+ * @param {RequestType} [request] - The request object.
219
+ * @returns {Promise<ResponseType>} - The response object.
220
+ */
170
221
  async delete(route, request) {
171
222
  return this.pathParamRequest(route, "DELETE", request);
172
223
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/universal-sdk",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Cross runtime fetch library for forklaunch router sdks",
5
5
  "keywords": [
6
6
  "fetch",
@@ -33,9 +33,9 @@
33
33
  "devDependencies": {
34
34
  "fetch-mock": "^12.5.2",
35
35
  "jest": "^29.7.0",
36
- "ts-jest": "^29.3.1",
36
+ "ts-jest": "^29.3.2",
37
37
  "tsup": "^8.4.0",
38
- "typedoc": "^0.28.1"
38
+ "typedoc": "^0.28.2"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "tsc --noEmit && tsup index.ts --format cjs,esm --no-splitting --dts --tsconfig tsconfig.json --out-dir lib --clean",