Merged in development (pull request #15)

Development
This commit is contained in:
Leandro Costa 2023-11-10 12:09:41 +00:00
commit 5fe65798d8
3 changed files with 15 additions and 22 deletions

4
package-lock.json generated
View file

@ -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",

View file

@ -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",

View file

@ -146,6 +146,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
data,
params,
contentType = ContentType.APPLICATION_JSON,
...opt
}: ExecutarRequestParams): Promise<ResponseType> {
try {
await this.getAccessToken();
@ -163,6 +164,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
headers,
data,
params,
...opt,
});
return response.data;
@ -180,47 +182,38 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
}
}
async get<ResponseType>({ path, contentType = ContentType.APPLICATION_JSON, params }: ExecutarRequestParams) {
async get<ResponseType>(opt: ExecutarRequestParams) {
return this.executarRequest<ResponseType>({
method: "GET",
path,
contentType,
params,
...opt,
});
}
async put<ResponseType>({ path, data, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) {
async put<ResponseType>(opt: ExecutarRequestParams) {
return this.executarRequest<ResponseType>({
method: "PUT",
path,
data,
contentType,
...opt,
});
}
async patch<ResponseType>({ path, data, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) {
async patch<ResponseType>(opt: ExecutarRequestParams) {
return this.executarRequest<ResponseType>({
method: "PATCH",
path,
data,
contentType,
...opt,
});
}
async post<ResponseType>({ path, data, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) {
async post<ResponseType>(opt: ExecutarRequestParams) {
return this.executarRequest<ResponseType>({
method: "POST",
path,
data,
contentType,
...opt,
});
}
async delete<ResponseType>({ path, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) {
async delete<ResponseType>(opt: ExecutarRequestParams) {
return this.executarRequest<ResponseType>({
method: "DELETE",
path,
contentType,
...opt,
});
}
}