[**Documentation**](index.md) *** [Documentation](packages.md) / Vonage Network Auth # Vonage Server SDK for Node.js ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vonage/vonage-node-sdk/ci.yml?branch=3.x) [![Codecov](https://img.shields.io/codecov/c/github/vonage/vonage-node-sdk?label=Codecov&logo=codecov&style=flat-square)](https://codecov.io/gh/Vonage/vonage-server-sdk) ![Latest Release](https://img.shields.io/npm/v/@vonage/network-client?label=%40vonage%2Fnetwork-client&style=flat-square) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg?style=flat-square)](../../CODE_OF_CONDUCT.md) [![License](https://img.shields.io/npm/l/@vonage/accounts?label=License&style=flat-square)][license] Vonage This is the Vonage Server Client SDK for Node.js used to wrap the authentication headers/signatures for use with [Vonage APIs](https://www.vonage.com/). To use it you will need a Vonage account. Sign up [for free at vonage.com][signup]. For full API documentation refer to [developer.vonage.com](https://developer.vonage.com/). * [Installation](#installation) * [Usage](#usage) * [Options](#options) * [Testing](#testing) ## Installation ### With NPM ```bash npm install @vonage/network-client ``` ### With Yarn ```bash yarn add @vonage/network-client ``` ## Usage To create a client, you will need to pass in a `@vonage/auth` object. ```js const { Auth } = require('@vonage/auth'); const { Client } = require('@vonage/network-client'); const vonageClient = new Client (new Auth({ apiKey: API_KEY, apiSecret: API_SECRET, applicationId: APP_ID, privateKey: PRIVATE_KEY_PATH, }), options, ); ``` ### Options `options` is any option from [`@vonage/server-client`](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/server-client/README.md#options) along with the following that are specific for the network APIs * `msisdn: string` - The MSISDN (phone number) you wish to authenticate to. * `accessToken: string` (optional) - A pre generated Access token for making network API calls * `expiresIn: string` (required if `accessToken` is passed) - Time until the access token expires ## Testing Run: ```bash npm run test ``` [signup]: https://dashboard.nexmo.com/sign-up?utm_source=DEV_REL&utm_medium=github&utm_campaign=node-server-sdk [license]: _media/LICENSE.txt ## Enumerations ### Purpose Defined in: [packages/network-client/lib/enums/purpose.ts:4](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/enums/purpose.ts#L4) Netowrk API purposes for generating the scope #### Enumeration Members | Enumeration Member | Value | Description | Defined in | | ------ | ------ | ------ | ------ | | `FRAUD_PREVENTION_AND_DETECTION` | `"FraudPreventionAndDetection"` | Purpose for Fraud Prevention and Detection | [packages/network-client/lib/enums/purpose.ts:8](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/enums/purpose.ts#L8) | *** ### Scope Defined in: [packages/network-client/lib/enums/scope.ts:4](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/enums/scope.ts#L4) Scopes for the API #### Enumeration Members | Enumeration Member | Value | Description | Defined in | | ------ | ------ | ------ | ------ | | `CHECK_SIM_SWAP` | `"check-sim-swap"` | Check for SIM Swap | [packages/network-client/lib/enums/scope.ts:8](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/enums/scope.ts#L8) | | `NUMBER_VERIFICATION_VERIFY_READ` | `"number-verification-verify-read"` | Number Verification | [packages/network-client/lib/enums/scope.ts:13](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/enums/scope.ts#L13) | ## Classes ### InvalidPurposeError Defined in: [packages/network-client/lib/errors/invalidPurposeError.ts:5](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/errors/invalidPurposeError.ts#L5) Error thrown when purpose is invalid #### Extends - `Error` #### Constructors ##### Constructor ```ts new InvalidPurposeError(): InvalidPurposeError; ``` Defined in: [packages/network-client/lib/errors/invalidPurposeError.ts:6](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/errors/invalidPurposeError.ts#L6) ###### Returns [`InvalidPurposeError`](#invalidpurposeerror) ###### Overrides ```ts Error.constructor ``` #### Properties ##### cause? ```ts optional cause: unknown; ``` Defined in: node\_modules/typescript/lib/lib.es2022.error.d.ts:24 ###### Inherited from ```ts Error.cause ``` ##### message ```ts message: string; ``` Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1077 ###### Inherited from ```ts Error.message ``` ##### name ```ts name: string; ``` Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1076 ###### Inherited from ```ts Error.name ``` ##### stack? ```ts optional stack: string; ``` Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1078 ###### Inherited from ```ts Error.stack ``` ##### stackTraceLimit ```ts static stackTraceLimit: number; ``` Defined in: node\_modules/@types/node/globals.d.ts:161 The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. ###### Inherited from ```ts Error.stackTraceLimit ``` #### Methods ##### captureStackTrace() ```ts static captureStackTrace(targetObject, constructorOpt?): void; ``` Defined in: node\_modules/@types/node/globals.d.ts:145 Creates a `.stack` property on `targetObject`, which when accessed returns a string representing the location in the code at which `Error.captureStackTrace()` was called. ```js const myObject = {}; Error.captureStackTrace(myObject); myObject.stack; // Similar to `new Error().stack` ``` The first line of the trace will be prefixed with `${myObject.name}: ${myObject.message}`. The optional `constructorOpt` argument accepts a function. If given, all frames above `constructorOpt`, including `constructorOpt`, will be omitted from the generated stack trace. The `constructorOpt` argument is useful for hiding implementation details of error generation from the user. For instance: ```js function a() { b(); } function b() { c(); } function c() { // Create an error without stack trace to avoid calculating the stack trace twice. const { stackTraceLimit } = Error; Error.stackTraceLimit = 0; const error = new Error(); Error.stackTraceLimit = stackTraceLimit; // Capture the stack trace above function b Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace throw error; } a(); ``` ###### Parameters ###### targetObject `object` ###### constructorOpt? `Function` ###### Returns `void` ###### Inherited from ```ts Error.captureStackTrace ``` ##### prepareStackTrace() ```ts static prepareStackTrace(err, stackTraces): any; ``` Defined in: node\_modules/@types/node/globals.d.ts:149 ###### Parameters ###### err `Error` ###### stackTraces `CallSite`[] ###### Returns `any` ###### See https://v8.dev/docs/stack-trace-api#customizing-stack-traces ###### Inherited from ```ts Error.prepareStackTrace ``` *** ### InvalidScopeError Defined in: [packages/network-client/lib/errors/invalidScopeError.ts:5](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/errors/invalidScopeError.ts#L5) Error thrown when scope is invalid #### Extends - `Error` #### Constructors ##### Constructor ```ts new InvalidScopeError(): InvalidScopeError; ``` Defined in: [packages/network-client/lib/errors/invalidScopeError.ts:6](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/errors/invalidScopeError.ts#L6) ###### Returns [`InvalidScopeError`](#invalidscopeerror) ###### Overrides ```ts Error.constructor ``` #### Properties ##### cause? ```ts optional cause: unknown; ``` Defined in: node\_modules/typescript/lib/lib.es2022.error.d.ts:24 ###### Inherited from ```ts Error.cause ``` ##### message ```ts message: string; ``` Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1077 ###### Inherited from ```ts Error.message ``` ##### name ```ts name: string; ``` Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1076 ###### Inherited from ```ts Error.name ``` ##### stack? ```ts optional stack: string; ``` Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1078 ###### Inherited from ```ts Error.stack ``` ##### stackTraceLimit ```ts static stackTraceLimit: number; ``` Defined in: node\_modules/@types/node/globals.d.ts:161 The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. ###### Inherited from ```ts Error.stackTraceLimit ``` #### Methods ##### captureStackTrace() ```ts static captureStackTrace(targetObject, constructorOpt?): void; ``` Defined in: node\_modules/@types/node/globals.d.ts:145 Creates a `.stack` property on `targetObject`, which when accessed returns a string representing the location in the code at which `Error.captureStackTrace()` was called. ```js const myObject = {}; Error.captureStackTrace(myObject); myObject.stack; // Similar to `new Error().stack` ``` The first line of the trace will be prefixed with `${myObject.name}: ${myObject.message}`. The optional `constructorOpt` argument accepts a function. If given, all frames above `constructorOpt`, including `constructorOpt`, will be omitted from the generated stack trace. The `constructorOpt` argument is useful for hiding implementation details of error generation from the user. For instance: ```js function a() { b(); } function b() { c(); } function c() { // Create an error without stack trace to avoid calculating the stack trace twice. const { stackTraceLimit } = Error; Error.stackTraceLimit = 0; const error = new Error(); Error.stackTraceLimit = stackTraceLimit; // Capture the stack trace above function b Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace throw error; } a(); ``` ###### Parameters ###### targetObject `object` ###### constructorOpt? `Function` ###### Returns `void` ###### Inherited from ```ts Error.captureStackTrace ``` ##### prepareStackTrace() ```ts static prepareStackTrace(err, stackTraces): any; ``` Defined in: node\_modules/@types/node/globals.d.ts:149 ###### Parameters ###### err `Error` ###### stackTraces `CallSite`[] ###### Returns `any` ###### See https://v8.dev/docs/stack-trace-api#customizing-stack-traces ###### Inherited from ```ts Error.prepareStackTrace ``` *** ### MissingPurposeError Defined in: [packages/network-client/lib/errors/missingPurposeError.ts:5](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/errors/missingPurposeError.ts#L5) Error thrown when purpose is invalid #### Extends - `Error` #### Constructors ##### Constructor ```ts new MissingPurposeError(): MissingPurposeError; ``` Defined in: [packages/network-client/lib/errors/missingPurposeError.ts:6](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/errors/missingPurposeError.ts#L6) ###### Returns [`MissingPurposeError`](#missingpurposeerror) ###### Overrides ```ts Error.constructor ``` #### Properties ##### cause? ```ts optional cause: unknown; ``` Defined in: node\_modules/typescript/lib/lib.es2022.error.d.ts:24 ###### Inherited from ```ts Error.cause ``` ##### message ```ts message: string; ``` Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1077 ###### Inherited from ```ts Error.message ``` ##### name ```ts name: string; ``` Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1076 ###### Inherited from ```ts Error.name ``` ##### stack? ```ts optional stack: string; ``` Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1078 ###### Inherited from ```ts Error.stack ``` ##### stackTraceLimit ```ts static stackTraceLimit: number; ``` Defined in: node\_modules/@types/node/globals.d.ts:161 The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. ###### Inherited from ```ts Error.stackTraceLimit ``` #### Methods ##### captureStackTrace() ```ts static captureStackTrace(targetObject, constructorOpt?): void; ``` Defined in: node\_modules/@types/node/globals.d.ts:145 Creates a `.stack` property on `targetObject`, which when accessed returns a string representing the location in the code at which `Error.captureStackTrace()` was called. ```js const myObject = {}; Error.captureStackTrace(myObject); myObject.stack; // Similar to `new Error().stack` ``` The first line of the trace will be prefixed with `${myObject.name}: ${myObject.message}`. The optional `constructorOpt` argument accepts a function. If given, all frames above `constructorOpt`, including `constructorOpt`, will be omitted from the generated stack trace. The `constructorOpt` argument is useful for hiding implementation details of error generation from the user. For instance: ```js function a() { b(); } function b() { c(); } function c() { // Create an error without stack trace to avoid calculating the stack trace twice. const { stackTraceLimit } = Error; Error.stackTraceLimit = 0; const error = new Error(); Error.stackTraceLimit = stackTraceLimit; // Capture the stack trace above function b Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace throw error; } a(); ``` ###### Parameters ###### targetObject `object` ###### constructorOpt? `Function` ###### Returns `void` ###### Inherited from ```ts Error.captureStackTrace ``` ##### prepareStackTrace() ```ts static prepareStackTrace(err, stackTraces): any; ``` Defined in: node\_modules/@types/node/globals.d.ts:149 ###### Parameters ###### err `Error` ###### stackTraces `CallSite`[] ###### Returns `any` ###### See https://v8.dev/docs/stack-trace-api#customizing-stack-traces ###### Inherited from ```ts Error.prepareStackTrace ``` *** ### MissingScopeError Defined in: [packages/network-client/lib/errors/missingScopeError.ts:5](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/errors/missingScopeError.ts#L5) Error thrown when no scope is set for a request. #### Extends - `Error` #### Constructors ##### Constructor ```ts new MissingScopeError(): MissingScopeError; ``` Defined in: [packages/network-client/lib/errors/missingScopeError.ts:6](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/errors/missingScopeError.ts#L6) ###### Returns [`MissingScopeError`](#missingscopeerror) ###### Overrides ```ts Error.constructor ``` #### Properties ##### cause? ```ts optional cause: unknown; ``` Defined in: node\_modules/typescript/lib/lib.es2022.error.d.ts:24 ###### Inherited from ```ts Error.cause ``` ##### message ```ts message: string; ``` Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1077 ###### Inherited from ```ts Error.message ``` ##### name ```ts name: string; ``` Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1076 ###### Inherited from ```ts Error.name ``` ##### stack? ```ts optional stack: string; ``` Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1078 ###### Inherited from ```ts Error.stack ``` ##### stackTraceLimit ```ts static stackTraceLimit: number; ``` Defined in: node\_modules/@types/node/globals.d.ts:161 The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. ###### Inherited from ```ts Error.stackTraceLimit ``` #### Methods ##### captureStackTrace() ```ts static captureStackTrace(targetObject, constructorOpt?): void; ``` Defined in: node\_modules/@types/node/globals.d.ts:145 Creates a `.stack` property on `targetObject`, which when accessed returns a string representing the location in the code at which `Error.captureStackTrace()` was called. ```js const myObject = {}; Error.captureStackTrace(myObject); myObject.stack; // Similar to `new Error().stack` ``` The first line of the trace will be prefixed with `${myObject.name}: ${myObject.message}`. The optional `constructorOpt` argument accepts a function. If given, all frames above `constructorOpt`, including `constructorOpt`, will be omitted from the generated stack trace. The `constructorOpt` argument is useful for hiding implementation details of error generation from the user. For instance: ```js function a() { b(); } function b() { c(); } function c() { // Create an error without stack trace to avoid calculating the stack trace twice. const { stackTraceLimit } = Error; Error.stackTraceLimit = 0; const error = new Error(); Error.stackTraceLimit = stackTraceLimit; // Capture the stack trace above function b Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace throw error; } a(); ``` ###### Parameters ###### targetObject `object` ###### constructorOpt? `Function` ###### Returns `void` ###### Inherited from ```ts Error.captureStackTrace ``` ##### prepareStackTrace() ```ts static prepareStackTrace(err, stackTraces): any; ``` Defined in: node\_modules/@types/node/globals.d.ts:149 ###### Parameters ###### err `Error` ###### stackTraces `CallSite`[] ###### Returns `any` ###### See https://v8.dev/docs/stack-trace-api#customizing-stack-traces ###### Inherited from ```ts Error.prepareStackTrace ``` *** ### NetworkClient Defined in: [packages/network-client/lib/networkClient.ts:26](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L26) #### Extends - [`Client`](Vonage-Server-Client.md#client) #### Extended by - [`NumberVerificationClient`](Vonage-Network-Number-Verification.md#numberverificationclient) - [`SIMSwap`](Vonage-Network-SIM-Swap.md#simswap) #### Constructors ##### Constructor ```ts new NetworkClient(auth, config?): NetworkClient; ``` Defined in: [packages/network-client/lib/networkClient.ts:62](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L62) ###### Parameters ###### auth [`NetworkAuthParameters`](#networkauthparameters) ###### config? [`NetworkConfigParameters`](#networkconfigparameters) ###### Returns [`NetworkClient`](#networkclient) ###### Overrides [`Client`](Vonage-Server-Client.md#client).[`constructor`](Vonage-Server-Client.md#client#constructor) #### Properties ##### \_msisdn ```ts protected _msisdn: string; ``` Defined in: [packages/network-client/lib/networkClient.ts:45](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L45) The msisdn that will be used for API calls ##### \_purpose? ```ts protected optional _purpose: FRAUD_PREVENTION_AND_DETECTION; ``` Defined in: [packages/network-client/lib/networkClient.ts:50](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L50) The purpose for the scope ##### \_scope? ```ts protected optional _scope: Scope; ``` Defined in: [packages/network-client/lib/networkClient.ts:55](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L55) The scope for the token ##### accessToken? ```ts protected optional accessToken: string; ``` Defined in: [packages/network-client/lib/networkClient.ts:35](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L35) The current token ##### auth ```ts protected auth: AuthInterface; ``` Defined in: packages/server-client/dist/lib/client.d.ts:24 The authentication instance responsible for generating authentication headers and query parameters. ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`auth`](Vonage-Server-Client.md#client#auth) ##### authType? ```ts protected optional authType: AuthenticationType; ``` Defined in: packages/server-client/dist/lib/client.d.ts:20 The type of authentication used for the client's requests. ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`authType`](Vonage-Server-Client.md#client#authtype) ##### config ```ts protected config: NetworkConfigParameters; ``` Defined in: [packages/network-client/lib/networkClient.ts:60](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L60) Configuration settings for the client, including default hosts for various services and other request settings. ###### Overrides [`Client`](Vonage-Server-Client.md#client).[`config`](Vonage-Server-Client.md#client#config) ##### expires ```ts protected expires: number = 0; ``` Defined in: [packages/network-client/lib/networkClient.ts:40](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L40) Timestamp until the token expires ##### gettingToken ```ts protected gettingToken: boolean = false; ``` Defined in: [packages/network-client/lib/networkClient.ts:30](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L30) Flags if we are currently getting a token ##### transformers ```ts static transformers: object; ``` Defined in: packages/server-client/dist/lib/client.d.ts:11 Static property containing utility transformers. ###### camelCaseObjectKeys ```ts camelCaseObjectKeys: PartialTransformFunction; ``` ###### kebabCaseObjectKeys ```ts kebabCaseObjectKeys: PartialTransformFunction; ``` ###### omit() ```ts omit: (keys, obj) => TransformedObject; ``` ###### Parameters ###### keys `string`[] ###### obj [`ObjectToTransform`](Vonage-Server-Client.md#objecttotransform) ###### Returns [`TransformedObject`](Vonage-Server-Client.md#transformedobject) ###### snakeCaseObjectKeys ```ts snakeCaseObjectKeys: PartialTransformFunction; ``` ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`transformers`](Vonage-Server-Client.md#client#transformers) #### Accessors ##### msisdn ###### Get Signature ```ts get msisdn(): string; ``` Defined in: [packages/network-client/lib/networkClient.ts:81](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L81) Get the msisdn ###### Throws If the msisdn is not set ###### Returns `string` The msisdn ##### purpose ###### Get Signature ```ts get purpose(): FRAUD_PREVENTION_AND_DETECTION; ``` Defined in: [packages/network-client/lib/networkClient.ts:96](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L96) Get the purpose ###### Throws If the purpose is not set ###### Throws If the purpose is not valid ###### Returns [`FRAUD_PREVENTION_AND_DETECTION`](#fraud_prevention_and_detection) The purpose ###### Set Signature ```ts set purpose(value): void; ``` Defined in: [packages/network-client/lib/networkClient.ts:112](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L112) Set the purpose ###### Parameters ###### value [`FRAUD_PREVENTION_AND_DETECTION`](#fraud_prevention_and_detection) The purpose ###### Returns `void` ##### scope ###### Get Signature ```ts get scope(): Scope; ``` Defined in: [packages/network-client/lib/networkClient.ts:123](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L123) Get the scope ###### Throws If the scope is not set ###### Throws If the scope is not valid ###### Returns [`Scope`](#scope) The scope ###### Set Signature ```ts set scope(value): void; ``` Defined in: [packages/network-client/lib/networkClient.ts:142](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L142) Set the scope ###### Throws If the scope is not valid ###### Throws If the scope is not set ###### Parameters ###### value [`Scope`](#scope) The scope ###### Returns `void` #### Methods ##### addAuthenticationToRequest() ```ts addAuthenticationToRequest(request): Promise; ``` Defined in: [packages/network-client/lib/networkClient.ts:154](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L154) Add authentication to the auth This will make the calls to get a network token if required. ###### Parameters ###### request [`VetchOptions`](Vonage-Vetch.md#vetchoptions) The request to add authentication to ###### Returns `Promise`\<[`VetchOptions`](Vonage-Vetch.md#vetchoptions)\> The request with authentication added ###### Overrides [`Client`](Vonage-Server-Client.md#client).[`addAuthenticationToRequest`](Vonage-Server-Client.md#client#addauthenticationtorequest) ##### addBasicAuthToRequest() ```ts protected addBasicAuthToRequest(request): Promise; ``` Defined in: packages/server-client/dist/lib/client.d.ts:71 Adds basic authentication headers to the request. ###### Parameters ###### request [`VetchOptions`](Vonage-Vetch.md#vetchoptions) The request options to which authentication needs to be added. ###### Returns `Promise`\<[`VetchOptions`](Vonage-Vetch.md#vetchoptions)\> - The request options with the added authentication. ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`addBasicAuthToRequest`](Vonage-Server-Client.md#client#addbasicauthtorequest) ##### addJWTToRequest() ```ts protected addJWTToRequest(request): Promise; ``` Defined in: packages/server-client/dist/lib/client.d.ts:64 Adds a JWT to the request. ###### Parameters ###### request [`VetchOptions`](Vonage-Vetch.md#vetchoptions) The request options to which authentication needs to be added. ###### Returns `Promise`\<[`VetchOptions`](Vonage-Vetch.md#vetchoptions)\> - The request options with the added authentication. ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`addJWTToRequest`](Vonage-Server-Client.md#client#addjwttorequest) ##### addQueryKeySecretToRequest() ```ts protected addQueryKeySecretToRequest(request): Promise; ``` Defined in: packages/server-client/dist/lib/client.d.ts:57 Adds API key and secret to the request. ###### Parameters ###### request [`VetchOptions`](Vonage-Vetch.md#vetchoptions) The request options to which authentication needs to be added. ###### Returns `Promise`\<[`VetchOptions`](Vonage-Vetch.md#vetchoptions)\> - The request options with the added authentication. ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`addQueryKeySecretToRequest`](Vonage-Server-Client.md#client#addquerykeysecrettorequest) ##### addQueryKeySecretToRequestBody() ```ts protected addQueryKeySecretToRequestBody(request): Promise; ``` Defined in: packages/server-client/dist/lib/client.d.ts:50 Adds API key and secret to the request body. ###### Parameters ###### request [`VetchOptions`](Vonage-Vetch.md#vetchoptions) The request options to which authentication needs to be added. ###### Returns `Promise`\<[`VetchOptions`](Vonage-Vetch.md#vetchoptions)\> - The request options with the added authentication. ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`addQueryKeySecretToRequestBody`](Vonage-Server-Client.md#client#addquerykeysecrettorequestbody) ##### buildOIDCURL() ```ts buildOIDCURL(state): string; ``` Defined in: [packages/network-client/lib/networkClient.ts:191](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L191) Build the URL for the OIDC flow ###### Parameters ###### state `string` = `''` The state to use ###### Returns `string` The URL for the OIDC flow ##### exchangeCodeForToken() ```ts exchangeCodeForToken(code): Promise; ``` Defined in: [packages/network-client/lib/networkClient.ts:224](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L224) Exchange the code for a network token ###### Parameters ###### code `string` The code to exchange ###### Returns `Promise`\<[`NetworkTokenResponse`](#networktokenresponse)\> The network token token ##### getCIBAAccessToken() ```ts protected getCIBAAccessToken(cibaRequestId): Promise; ``` Defined in: [packages/network-client/lib/networkClient.ts:306](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L306) Get a network token ###### Parameters ###### cibaRequestId `string` The CIBA request id ###### Returns `Promise`\<[`NetworkTokenResponse`](#networktokenresponse)\> The network token data ##### getCIBARequestId() ```ts protected getCIBARequestId(): Promise; ``` Defined in: [packages/network-client/lib/networkClient.ts:355](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L355) Get an CIBA request id ###### Returns `Promise`\<`string`\> The CIBA request id ##### getCIBAToken() ```ts protected getCIBAToken(): Promise; ``` Defined in: [packages/network-client/lib/networkClient.ts:283](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/networkClient.ts#L283) Get the access token for the CIBA flow This is a two step process. First we need to get an CIBA request id, then we can use that to get a network token. ###### Returns `Promise`\<`void`\> ##### getConfig() ```ts getConfig(): ConfigParams; ``` Defined in: packages/server-client/dist/lib/client.d.ts:36 ###### Returns [`ConfigParams`](Vonage-Server-Client.md#configparams) ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`getConfig`](Vonage-Server-Client.md#client#getconfig) ##### parseResponse() ```ts protected parseResponse(request, response): Promise>; ``` Defined in: packages/server-client/dist/lib/client.d.ts:168 Parses the response based on its content type. ###### Type Parameters ###### T `T` The expected type of the parsed response data. ###### Parameters ###### request [`VetchOptions`](Vonage-Vetch.md#vetchoptions) The request options. ###### response `Response` The raw response from the request. ###### Returns `Promise`\<[`VetchResponse`](Vonage-Vetch.md#vetchresponse)\<`T`\>\> - The parsed response. ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`parseResponse`](Vonage-Server-Client.md#client#parseresponse) ##### prepareBody() ```ts protected prepareBody(request): undefined | string; ``` Defined in: packages/server-client/dist/lib/client.d.ts:158 Prepares the body for the request based on the content type. ###### Parameters ###### request [`VetchOptions`](Vonage-Vetch.md#vetchoptions) The request options. ###### Returns `undefined` \| `string` - The prepared request body as a string or undefined. ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`prepareBody`](Vonage-Server-Client.md#client#preparebody) ##### prepareRequest() ```ts protected prepareRequest(request): Promise; ``` Defined in: packages/server-client/dist/lib/client.d.ts:151 Prepares the request with necessary headers, authentication, and query parameters. ###### Parameters ###### request [`VetchOptions`](Vonage-Vetch.md#vetchoptions) The initial request options. ###### Returns `Promise`\<[`VetchOptions`](Vonage-Vetch.md#vetchoptions)\> - The modified request options. ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`prepareRequest`](Vonage-Server-Client.md#client#preparerequest) ##### sendDeleteRequest() ```ts sendDeleteRequest(url): Promise>; ``` Defined in: packages/server-client/dist/lib/client.d.ts:78 Sends a DELETE request to the specified URL. ###### Type Parameters ###### T `T` ###### Parameters ###### url `string` The URL endpoint for the DELETE request. ###### Returns `Promise`\<[`VetchResponse`](Vonage-Vetch.md#vetchresponse)\<`T`\>\> - The response from the DELETE request. ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`sendDeleteRequest`](Vonage-Server-Client.md#client#senddeleterequest) ##### sendFormSubmitRequest() ```ts sendFormSubmitRequest(url, payload?): Promise>; ``` Defined in: packages/server-client/dist/lib/client.d.ts:86 Sends a POST request with form data to the specified URL. ###### Type Parameters ###### T `T` ###### Parameters ###### url `string` The URL endpoint for the POST request. ###### payload? `Record`\<`string`, `undefined` \| `string`\> Optional payload containing form data to send with the POST request. ###### Returns `Promise`\<[`VetchResponse`](Vonage-Vetch.md#vetchresponse)\<`T`\>\> - The response from the POST request. ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`sendFormSubmitRequest`](Vonage-Server-Client.md#client#sendformsubmitrequest) ##### sendGetRequest() ```ts sendGetRequest(url, queryParams?): Promise>; ``` Defined in: packages/server-client/dist/lib/client.d.ts:94 Sends a GET request to the specified URL with optional query parameters. ###### Type Parameters ###### T `T` ###### Parameters ###### url `string` The URL endpoint for the GET request. ###### queryParams? Optional query parameters to append to the URL. These should be compatible with Node's URLSearchParams. ###### Returns `Promise`\<[`VetchResponse`](Vonage-Vetch.md#vetchresponse)\<`T`\>\> - The response from the GET request. ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`sendGetRequest`](Vonage-Server-Client.md#client#sendgetrequest) ##### sendPatchRequest() ```ts sendPatchRequest(url, payload?): Promise>; ``` Defined in: packages/server-client/dist/lib/client.d.ts:104 Sends a PATCH request to the specified URL with an optional payload. ###### Type Parameters ###### T `T` ###### Parameters ###### url `string` The URL endpoint for the PATCH request. ###### payload? Optional payload to be sent as the body of the PATCH request. ###### Returns `Promise`\<[`VetchResponse`](Vonage-Vetch.md#vetchresponse)\<`T`\>\> - The response from the PATCH request. ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`sendPatchRequest`](Vonage-Server-Client.md#client#sendpatchrequest) ##### sendPostRequest() ```ts sendPostRequest(url, payload?): Promise>; ``` Defined in: packages/server-client/dist/lib/client.d.ts:114 Sends a POST request to the specified URL with an optional payload. ###### Type Parameters ###### T `T` ###### Parameters ###### url `string` The URL endpoint for the POST request. ###### payload? Optional payload to be sent as the body of the POST request. ###### Returns `Promise`\<[`VetchResponse`](Vonage-Vetch.md#vetchresponse)\<`T`\>\> - The response from the POST request. ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`sendPostRequest`](Vonage-Server-Client.md#client#sendpostrequest) ##### sendPutRequest() ```ts sendPutRequest(url, payload?): Promise>; ``` Defined in: packages/server-client/dist/lib/client.d.ts:124 Sends a PUT request to the specified URL with an optional payload. ###### Type Parameters ###### T `T` ###### Parameters ###### url `string` The URL endpoint for the PUT request. ###### payload? Optional payload to be sent as the body of the PUT request. ###### Returns `Promise`\<[`VetchResponse`](Vonage-Vetch.md#vetchresponse)\<`T`\>\> - The response from the PUT request. ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`sendPutRequest`](Vonage-Server-Client.md#client#sendputrequest) ##### sendRequest() ```ts sendRequest(request): Promise>; ``` Defined in: packages/server-client/dist/lib/client.d.ts:144 Sends a request adding necessary headers, handling authentication, and parsing the response. ###### Type Parameters ###### T `T` ###### Parameters ###### request [`VetchOptions`](Vonage-Vetch.md#vetchoptions) The options defining the request, including URL, method, headers, and data. ###### Returns `Promise`\<[`VetchResponse`](Vonage-Vetch.md#vetchresponse)\<`T`\>\> - The parsed response from the request. ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`sendRequest`](Vonage-Server-Client.md#client#sendrequest) ##### sendRequestWithData() ```ts sendRequestWithData( method, url, payload?): Promise>; ``` Defined in: packages/server-client/dist/lib/client.d.ts:135 Sends a request with JSON-encoded data to the specified URL using the provided HTTP method. ###### Type Parameters ###### T `T` ###### Parameters ###### method The HTTP method to be used for the request (only POST, PATCH, or PUT are acceptable). [`POST`](Vonage-Vetch.md#httpmethods#post) | [`PUT`](Vonage-Vetch.md#httpmethods#put) | [`PATCH`](Vonage-Vetch.md#httpmethods#patch) ###### url `string` The URL endpoint for the request. ###### payload? Optional payload to be sent as the body of the request, JSON-encoded. ###### Returns `Promise`\<[`VetchResponse`](Vonage-Vetch.md#vetchresponse)\<`T`\>\> - The response from the request. ###### Inherited from [`Client`](Vonage-Server-Client.md#client).[`sendRequestWithData`](Vonage-Server-Client.md#client#sendrequestwithdata) ## Type Aliases ### CIBAResponse ```ts type CIBAResponse = object; ``` Defined in: [packages/network-client/lib/types/responses/odicResponse.ts:1](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/types/responses/odicResponse.ts#L1) #### Properties ##### auth\_req\_id ```ts auth_req_id: string; ``` Defined in: [packages/network-client/lib/types/responses/odicResponse.ts:5](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/types/responses/odicResponse.ts#L5) CIBA ODIC token ##### expires\_in ```ts expires_in: number; ``` Defined in: [packages/network-client/lib/types/responses/odicResponse.ts:10](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/types/responses/odicResponse.ts#L10) Seconds until the token expires ##### interval? ```ts optional interval: string; ``` Defined in: [packages/network-client/lib/types/responses/odicResponse.ts:15](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/types/responses/odicResponse.ts#L15) This is the minimum polling interval in seconds *** ### NetworkAuthParameters ```ts type NetworkAuthParameters = AuthParams & object; ``` Defined in: [packages/network-client/lib/types/parameters/networkAuthParameters.ts:3](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/types/parameters/networkAuthParameters.ts#L3) #### Type declaration ##### accessToken? ```ts optional accessToken: string; ``` The access token to use for API calls ##### expiresIn? ```ts optional expiresIn: number; ``` The expiration time of the access token (in seconds) ##### msisdn ```ts msisdn: string; ``` The msisdn that will be used for API calls *** ### NetworkConfigParameters ```ts type NetworkConfigParameters = ConfigParams & object; ``` Defined in: [packages/network-client/lib/types/parameters/networkConfigParameters.ts:3](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/types/parameters/networkConfigParameters.ts#L3) #### Type declaration ##### networkApiHost? ```ts optional networkApiHost: string; ``` URL for making calls to get a network token ##### odicHost? ```ts optional odicHost: string; ``` URL for making calls to get a network token ##### redirectUri? ```ts optional redirectUri: string; ``` The URL to redirect to for the OAuth flow *** ### NetworkTokenResponse ```ts type NetworkTokenResponse = object; ``` Defined in: [packages/network-client/lib/types/responses/networkTokenResponse.ts:1](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/types/responses/networkTokenResponse.ts#L1) #### Properties ##### access\_token ```ts access_token: string; ``` Defined in: [packages/network-client/lib/types/responses/networkTokenResponse.ts:5](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/types/responses/networkTokenResponse.ts#L5) The token ##### expires\_in ```ts expires_in: number; ``` Defined in: [packages/network-client/lib/types/responses/networkTokenResponse.ts:15](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/types/responses/networkTokenResponse.ts#L15) The time in seconds from now that the token expires ##### token\_type ```ts token_type: "Bearer"; ``` Defined in: [packages/network-client/lib/types/responses/networkTokenResponse.ts:10](https://github.com/Vonage/vonage-node-sdk/blob/3846dd78a7cd39b838839d5c93db0b1652c0d168/packages/network-client/lib/types/responses/networkTokenResponse.ts#L10) The type of token