From f4fe3027335a210cf8f2df2a692988cd112d2dd7 Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Fri, 10 Nov 2023 09:01:57 -0300 Subject: [PATCH 1/6] fix: passando get params mesmo no post --- src/lhisp-oauth-client.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lhisp-oauth-client.ts b/src/lhisp-oauth-client.ts index cd0a8ef..4ff61be 100644 --- a/src/lhisp-oauth-client.ts +++ b/src/lhisp-oauth-client.ts @@ -207,11 +207,12 @@ export class LhispOauthClient { }); } - async post({ path, data, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) { + async post({ path, data, params, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) { return this.executarRequest({ method: "POST", path, data, + params, contentType, }); } From 85e0dd6e6a8f63459741414c7a661b35998003e8 Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Fri, 10 Nov 2023 09:02:22 -0300 Subject: [PATCH 2/6] fix: passando get params mesmo no patch e puth --- src/lhisp-oauth-client.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lhisp-oauth-client.ts b/src/lhisp-oauth-client.ts index 4ff61be..32a9f44 100644 --- a/src/lhisp-oauth-client.ts +++ b/src/lhisp-oauth-client.ts @@ -189,20 +189,22 @@ export class LhispOauthClient { }); } - async put({ path, data, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) { + async put({ path, data, params, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) { return this.executarRequest({ method: "PUT", path, data, + params, contentType, }); } - async patch({ path, data, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) { + async patch({ path, data, params, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) { return this.executarRequest({ method: "PATCH", path, data, + params, contentType, }); } From c2feb1c8e17a36f2c660d77c6716e077197a658b Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Fri, 10 Nov 2023 09:02:36 -0300 Subject: [PATCH 3/6] fix: passando get params mesmo no delete --- src/lhisp-oauth-client.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lhisp-oauth-client.ts b/src/lhisp-oauth-client.ts index 32a9f44..c250258 100644 --- a/src/lhisp-oauth-client.ts +++ b/src/lhisp-oauth-client.ts @@ -219,10 +219,11 @@ export class LhispOauthClient { }); } - async delete({ path, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) { + async delete({ path, params, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) { return this.executarRequest({ method: "DELETE", path, + params, contentType, }); } From 436b5c5b7f48391cac7069df8ddf0966e9ae768c Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Fri, 10 Nov 2023 09:04:39 -0300 Subject: [PATCH 4/6] feat: passando todos os parametros nas chamadas de metodo --- src/lhisp-oauth-client.ts | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) 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, }); } } From 2d32904a40d6a96fb97cfe96748a40a184410b86 Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Fri, 10 Nov 2023 09:07:36 -0300 Subject: [PATCH 5/6] =?UTF-8?q?refactor:=20delegando=20os=20parametros=20p?= =?UTF-8?q?adr=C3=A3o=20para=20o=20executarRequest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lhisp-oauth-client.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/lhisp-oauth-client.ts b/src/lhisp-oauth-client.ts index 174e00a..dfc7649 100644 --- a/src/lhisp-oauth-client.ts +++ b/src/lhisp-oauth-client.ts @@ -146,6 +146,7 @@ export class LhispOauthClient { data, params, contentType = ContentType.APPLICATION_JSON, + ...opt }: ExecutarRequestParams): Promise { try { await this.getAccessToken(); @@ -163,6 +164,7 @@ export class LhispOauthClient { headers, data, params, + ...opt, }); return response.data; @@ -183,7 +185,6 @@ export class LhispOauthClient { async get(opt: ExecutarRequestParams) { return this.executarRequest({ method: "GET", - contentType: opt.contentType || ContentType.APPLICATION_JSON, ...opt, }); } @@ -191,7 +192,6 @@ export class LhispOauthClient { async put(opt: ExecutarRequestParams) { return this.executarRequest({ method: "PUT", - contentType: opt.contentType || ContentType.APPLICATION_JSON, ...opt, }); } @@ -199,7 +199,6 @@ export class LhispOauthClient { async patch(opt: ExecutarRequestParams) { return this.executarRequest({ method: "PATCH", - contentType: opt.contentType || ContentType.APPLICATION_JSON, ...opt, }); } @@ -207,7 +206,6 @@ export class LhispOauthClient { async post(opt: ExecutarRequestParams) { return this.executarRequest({ method: "POST", - contentType: opt.contentType || ContentType.APPLICATION_JSON, ...opt, }); } @@ -215,7 +213,6 @@ export class LhispOauthClient { async delete(opt: ExecutarRequestParams) { return this.executarRequest({ method: "DELETE", - contentType: opt.contentType || ContentType.APPLICATION_JSON, ...opt, }); } From b6fe7d71071ef6c036a7c1a048557079a59c1283 Mon Sep 17 00:00:00 2001 From: bitbucket-pipelines Date: Fri, 10 Nov 2023 12:08:30 +0000 Subject: [PATCH 6/6] [skip CI] Version 1.0.24 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5cffcfc..45fed98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "lhisp-oauth-client", - "version": "1.0.23", + "version": "1.0.24", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "lhisp-oauth-client", - "version": "1.0.23", + "version": "1.0.24", "license": "MIT", "dependencies": { "axios": "^1.6.1", diff --git a/package.json b/package.json index 37aca59..4f9850c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lhisp-oauth-client", - "version": "1.0.23", + "version": "1.0.24", "main": "src/index", "types": "src/index.d.ts", "repository": "git@bitbucket.org:leandro_costa/lhisp-oauth-client.git",