feat: passando todos os parametros nas chamadas de metodo

This commit is contained in:
Leandro Costa 2023-11-10 09:04:39 -03:00
parent c2feb1c8e1
commit 436b5c5b7f

View file

@ -180,51 +180,43 @@ 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>({ return this.executarRequest<ResponseType>({
method: "GET", method: "GET",
path, contentType: opt.contentType || ContentType.APPLICATION_JSON,
contentType, ...opt,
params,
}); });
} }
async put<ResponseType>({ path, data, params, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) { async put<ResponseType>(opt: ExecutarRequestParams) {
return this.executarRequest<ResponseType>({ return this.executarRequest<ResponseType>({
method: "PUT", method: "PUT",
path, contentType: opt.contentType || ContentType.APPLICATION_JSON,
data, ...opt,
params,
contentType,
}); });
} }
async patch<ResponseType>({ path, data, params, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) { async patch<ResponseType>(opt: ExecutarRequestParams) {
return this.executarRequest<ResponseType>({ return this.executarRequest<ResponseType>({
method: "PATCH", method: "PATCH",
path, contentType: opt.contentType || ContentType.APPLICATION_JSON,
data, ...opt,
params,
contentType,
}); });
} }
async post<ResponseType>({ path, data, params, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) { async post<ResponseType>(opt: ExecutarRequestParams) {
return this.executarRequest<ResponseType>({ return this.executarRequest<ResponseType>({
method: "POST", method: "POST",
path, contentType: opt.contentType || ContentType.APPLICATION_JSON,
data, ...opt,
params,
contentType,
}); });
} }
async delete<ResponseType>({ path, params, contentType = ContentType.APPLICATION_JSON }: ExecutarRequestParams) { async delete<ResponseType>(opt: ExecutarRequestParams) {
return this.executarRequest<ResponseType>({ return this.executarRequest<ResponseType>({
method: "DELETE", method: "DELETE",
path, contentType: opt.contentType || ContentType.APPLICATION_JSON,
params, ...opt,
contentType,
}); });
} }
} }