diff --git a/src/lhisp-oauth-client.ts b/src/lhisp-oauth-client.ts index c250258..174e00a 100644 --- a/src/lhisp-oauth-client.ts +++ b/src/lhisp-oauth-client.ts @@ -180,51 +180,43 @@ export class LhispOauthClient { } } - async get({ path, contentType = ContentType.APPLICATION_JSON, params }: ExecutarRequestParams) { + async get(opt: ExecutarRequestParams) { return this.executarRequest({ method: "GET", - path, - contentType, - params, + contentType: opt.contentType || ContentType.APPLICATION_JSON, + ...opt, }); } - async put({ path, data, params, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) { + async put(opt: ExecutarRequestParams) { return this.executarRequest({ method: "PUT", - path, - data, - params, - contentType, + contentType: opt.contentType || ContentType.APPLICATION_JSON, + ...opt, }); } - async patch({ path, data, params, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) { + async patch(opt: ExecutarRequestParams) { return this.executarRequest({ method: "PATCH", - path, - data, - params, - contentType, + contentType: opt.contentType || ContentType.APPLICATION_JSON, + ...opt, }); } - async post({ path, data, params, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) { + async post(opt: ExecutarRequestParams) { return this.executarRequest({ method: "POST", - path, - data, - params, - contentType, + contentType: opt.contentType || ContentType.APPLICATION_JSON, + ...opt, }); } - async delete({ path, params, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) { + async delete(opt: ExecutarRequestParams) { return this.executarRequest({ method: "DELETE", - path, - params, - contentType, + contentType: opt.contentType || ContentType.APPLICATION_JSON, + ...opt, }); } }