@vonage/server-client
Advanced tools
Comparing version 1.10.3-0 to 1.10.3
@@ -39,30 +39,2 @@ import { Response } from 'node-fetch'; | ||
/** | ||
* Adds API key and secret to the request body. | ||
* | ||
* @param {VetchOptions} request - The request options to which authentication needs to be added. | ||
* @return {VetchOptions} - The request options with the added authentication. | ||
*/ | ||
protected addQueryKeySecretToRequestBody(request: VetchOptions): Promise<VetchOptions>; | ||
/** | ||
* Adds API key and secret to the request. | ||
* | ||
* @param {VetchOptions} request - The request options to which authentication needs to be added. | ||
* @return {VetchOptions} - The request options with the added authentication. | ||
*/ | ||
protected addQueryKeySecretToRequest(request: VetchOptions): Promise<VetchOptions>; | ||
/** | ||
* Adds a JWT to the request. | ||
* | ||
* @param {VetchOptions} request - The request options to which authentication needs to be added. | ||
* @return {VetchOptions} - The request options with the added authentication. | ||
*/ | ||
protected addJWTToRequest(request: VetchOptions): Promise<VetchOptions>; | ||
/** | ||
* Adds basic authentication headers to the request. | ||
* | ||
* @param {VetchOptions} request - The request options to which authentication needs to be added. | ||
* @return {VetchOptions} - The request options with the added authentication. | ||
*/ | ||
protected addBasicAuthToRequest(request: VetchOptions): Promise<VetchOptions>; | ||
/** | ||
* Sends a DELETE request to the specified URL. | ||
@@ -69,0 +41,0 @@ * |
@@ -76,18 +76,20 @@ "use strict"; | ||
case enums_1.AuthenticationType.BASIC: | ||
return this.addBasicAuthToRequest(request); | ||
request.headers = Object.assign({}, request.headers, { | ||
Authorization: await this.auth.createBasicHeader(), | ||
}); | ||
return request; | ||
case enums_1.AuthenticationType.JWT: | ||
return this.addJWTToRequest(request); | ||
case enums_1.AuthenticationType.QUERY_KEY_SECRET: | ||
return this.addQueryKeySecretToRequest(request); | ||
default: | ||
return this.addQueryKeySecretToRequestBody(request); | ||
request.headers = Object.assign({}, request.headers, { | ||
Authorization: await this.auth.createBearerHeader(), | ||
}); | ||
return request; | ||
} | ||
} | ||
/** | ||
* Adds API key and secret to the request body. | ||
* | ||
* @param {VetchOptions} request - The request options to which authentication needs to be added. | ||
* @return {VetchOptions} - The request options with the added authentication. | ||
*/ | ||
async addQueryKeySecretToRequestBody(request) { | ||
if (this.authType === enums_1.AuthenticationType.QUERY_KEY_SECRET) { | ||
log(`adding parameters to query string`); | ||
request.params = { | ||
...(request.params ? request.params : {}), | ||
...(await this.auth.getQueryParams({})), | ||
}; | ||
return request; | ||
} | ||
if (typeof request.data === 'string') { | ||
@@ -107,40 +109,2 @@ throw new Error('Cannot append auth parameters to body'); | ||
/** | ||
* Adds API key and secret to the request. | ||
* | ||
* @param {VetchOptions} request - The request options to which authentication needs to be added. | ||
* @return {VetchOptions} - The request options with the added authentication. | ||
*/ | ||
async addQueryKeySecretToRequest(request) { | ||
log(`adding parameters to query string`); | ||
request.params = { | ||
...(request.params ? request.params : {}), | ||
...(await this.auth.getQueryParams({})), | ||
}; | ||
return request; | ||
} | ||
/** | ||
* Adds a JWT to the request. | ||
* | ||
* @param {VetchOptions} request - The request options to which authentication needs to be added. | ||
* @return {VetchOptions} - The request options with the added authentication. | ||
*/ | ||
async addJWTToRequest(request) { | ||
request.headers = Object.assign({}, request.headers, { | ||
Authorization: await this.auth.createBearerHeader(), | ||
}); | ||
return request; | ||
} | ||
/** | ||
* Adds basic authentication headers to the request. | ||
* | ||
* @param {VetchOptions} request - The request options to which authentication needs to be added. | ||
* @return {VetchOptions} - The request options with the added authentication. | ||
*/ | ||
async addBasicAuthToRequest(request) { | ||
request.headers = Object.assign({}, request.headers, { | ||
Authorization: await this.auth.createBasicHeader(), | ||
}); | ||
return request; | ||
} | ||
/** | ||
* Sends a DELETE request to the specified URL. | ||
@@ -170,2 +134,3 @@ * | ||
type: vetch_1.ContentType.FORM_URLENCODED, | ||
headers: { Accept: 'application/json' }, | ||
...(payload ? { data: payload } : {}), | ||
@@ -172,0 +137,0 @@ }; |
{ | ||
"$schema": "https://json.schemastore.org/package.json", | ||
"name": "@vonage/server-client", | ||
"version": "1.10.3-0", | ||
"version": "1.10.3", | ||
"description": "The Vonage Server Client provides core functionalities for interacting with Vonage APIs, ensuring a standardized response regardless of the underlying HTTP adapter.", | ||
@@ -6,0 +6,0 @@ "homepage": "https://developer.vonage.com", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
54714
1159