@sabuj0338/axios-friday 1.2.1 → 1.4.0

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
@@ -153,6 +153,18 @@ declare class Friday {
153
153
  * and return the result of that handling.
154
154
  */
155
155
  put(url: URL, options?: FridayOptions): Promise<AxiosResponse<any, any> | undefined>;
156
+ /**
157
+ * This TypeScript function sends a PATCH request using Axios with specified options and handles any
158
+ * errors that occur.
159
+ * @param {URL} url - The `url` parameter in the `patch` function is a URL object that represents the
160
+ * URL where the PATCH request will be sent. It is used to specify the destination of the request.
161
+ * @param {FridayOptions} [options] - The `options` parameter in the `patch` function is an optional
162
+ * object that may contain the following properties:
163
+ * @returns The `patch` function is returning the data from the response if the request is successful.
164
+ * If there is an error during the request, it will handle the error using the `handleError` method
165
+ * and return the result of that handling.
166
+ */
167
+ patch(url: URL, options?: FridayOptions): Promise<AxiosResponse<any, any> | undefined>;
156
168
  /**
157
169
  * The `delete` function sends a DELETE request to a specified URL with optional headers and body,
158
170
  * handling errors and returning the response data.
package/dist/index.d.ts CHANGED
@@ -153,6 +153,18 @@ declare class Friday {
153
153
  * and return the result of that handling.
154
154
  */
155
155
  put(url: URL, options?: FridayOptions): Promise<AxiosResponse<any, any> | undefined>;
156
+ /**
157
+ * This TypeScript function sends a PATCH request using Axios with specified options and handles any
158
+ * errors that occur.
159
+ * @param {URL} url - The `url` parameter in the `patch` function is a URL object that represents the
160
+ * URL where the PATCH request will be sent. It is used to specify the destination of the request.
161
+ * @param {FridayOptions} [options] - The `options` parameter in the `patch` function is an optional
162
+ * object that may contain the following properties:
163
+ * @returns The `patch` function is returning the data from the response if the request is successful.
164
+ * If there is an error during the request, it will handle the error using the `handleError` method
165
+ * and return the result of that handling.
166
+ */
167
+ patch(url: URL, options?: FridayOptions): Promise<AxiosResponse<any, any> | undefined>;
156
168
  /**
157
169
  * The `delete` function sends a DELETE request to a specified URL with optional headers and body,
158
170
  * handling errors and returning the response data.
package/dist/index.js CHANGED
@@ -328,6 +328,30 @@ var Friday = class {
328
328
  return this.handleError(error, options);
329
329
  }
330
330
  }
331
+ /**
332
+ * This TypeScript function sends a PATCH request using Axios with specified options and handles any
333
+ * errors that occur.
334
+ * @param {URL} url - The `url` parameter in the `patch` function is a URL object that represents the
335
+ * URL where the PATCH request will be sent. It is used to specify the destination of the request.
336
+ * @param {FridayOptions} [options] - The `options` parameter in the `patch` function is an optional
337
+ * object that may contain the following properties:
338
+ * @returns The `patch` function is returning the data from the response if the request is successful.
339
+ * If there is an error during the request, it will handle the error using the `handleError` method
340
+ * and return the result of that handling.
341
+ */
342
+ async patch(url, options) {
343
+ try {
344
+ return await this.axiosInstance.patch(url.href, options?.body, {
345
+ headers: {
346
+ ...options?.headers,
347
+ ...this.getAuthorizationHeader(),
348
+ "Content-Type": "application/json"
349
+ }
350
+ });
351
+ } catch (error) {
352
+ return this.handleError(error, options);
353
+ }
354
+ }
331
355
  /**
332
356
  * The `delete` function sends a DELETE request to a specified URL with optional headers and body,
333
357
  * handling errors and returning the response data.
package/dist/index.mjs CHANGED
@@ -292,6 +292,30 @@ var Friday = class {
292
292
  return this.handleError(error, options);
293
293
  }
294
294
  }
295
+ /**
296
+ * This TypeScript function sends a PATCH request using Axios with specified options and handles any
297
+ * errors that occur.
298
+ * @param {URL} url - The `url` parameter in the `patch` function is a URL object that represents the
299
+ * URL where the PATCH request will be sent. It is used to specify the destination of the request.
300
+ * @param {FridayOptions} [options] - The `options` parameter in the `patch` function is an optional
301
+ * object that may contain the following properties:
302
+ * @returns The `patch` function is returning the data from the response if the request is successful.
303
+ * If there is an error during the request, it will handle the error using the `handleError` method
304
+ * and return the result of that handling.
305
+ */
306
+ async patch(url, options) {
307
+ try {
308
+ return await this.axiosInstance.patch(url.href, options?.body, {
309
+ headers: {
310
+ ...options?.headers,
311
+ ...this.getAuthorizationHeader(),
312
+ "Content-Type": "application/json"
313
+ }
314
+ });
315
+ } catch (error) {
316
+ return this.handleError(error, options);
317
+ }
318
+ }
295
319
  /**
296
320
  * The `delete` function sends a DELETE request to a specified URL with optional headers and body,
297
321
  * handling errors and returning the response data.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sabuj0338/axios-friday",
3
- "version": "1.2.1",
3
+ "version": "1.4.0",
4
4
  "description": "Friday - a axios based api handling custom class. which has refresh token mechanism configured.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",