-
Notifications
You must be signed in to change notification settings - Fork 181
Vonage Users
Vonage Users • Docs
Documentation / Vonage Users
Enum representing the sorting order.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
ASC |
"ASC" |
Ascending order. | users/lib/enums/userSort.ts:8 |
DESC |
"DESC" |
Descending order. | users/lib/enums/userSort.ts:13 |
The Users
class provides methods for managing user data through API requests.
Vonage API responses and requests use snake_case
for property names, but
this class performs the necessary key transformations to work with
camelCase
property names in your application.
new Users(credentials, options?): Users
Creates a new instance of the Client.
• credentials: AuthInterface
| AuthParams
The authentication credentials or an authentication instance.
• options?: ConfigParams
Optional configuration settings for the client.
server-client/dist/lib/client.d.ts:35
protected auth: AuthInterface;
The authentication instance responsible for generating authentication headers and query parameters.
server-client/dist/lib/client.d.ts:24
protected authType: AuthenticationType = AuthenticationType.JWT;
The type of authentication used for the client's requests.
protected config: ConfigParams;
Configuration settings for the client, including default hosts for various services and other request settings.
server-client/dist/lib/client.d.ts:28
static transformers: object;
Static property containing utility transformers.
camelCaseObjectKeys: PartialTransformFunction;
kebabCaseObjectKeys: PartialTransformFunction;
omit: (keys, obj) => TransformedObject;
• keys: string
[]
• obj: ObjectToTransform
snakeCaseObjectKeys: PartialTransformFunction;
server-client/dist/lib/client.d.ts:11
addAuthenticationToRequest(request): Promise<VetchOptions>
Adds the appropriate authentication headers or parameters to the request based on the authentication type.
• request: VetchOptions
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
Client
.addAuthenticationToRequest
server-client/dist/lib/client.d.ts:43
protected addBasicAuthToRequest(request): Promise<VetchOptions>
Adds basic authentication headers to the request.
• request: VetchOptions
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
server-client/dist/lib/client.d.ts:71
protected addJWTToRequest(request): Promise<VetchOptions>
Adds a JWT to the request.
• request: VetchOptions
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
server-client/dist/lib/client.d.ts:64
protected addQueryKeySecretToRequest(request): Promise<VetchOptions>
Adds API key and secret to the request.
• request: VetchOptions
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
Client
.addQueryKeySecretToRequest
server-client/dist/lib/client.d.ts:57
protected addQueryKeySecretToRequestBody(request): Promise<VetchOptions>
Adds API key and secret to the request body.
• request: VetchOptions
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
Client
.addQueryKeySecretToRequestBody
server-client/dist/lib/client.d.ts:50
createUser(user): Promise<UserType>
Creates a new user with the provided user data.
• user: UserType
The user data to create a new user.
Promise
<UserType
>
A Promise that resolves to the newly created user.
If there is an issue with the request or response.
deleteUser(userId): Promise<void>
Deletes the user with the specified user ID.
• userId: string
The unique ID of the user to be deleted.
Promise
<void
>
A Promise that resolves once the user is successfully deleted.
If there is an issue with the request or response, or if the user with the specified ID is not found.
getConfig(): ConfigParams
server-client/dist/lib/client.d.ts:36
getUser(userId): Promise<UserType>
Retrieves user information for the specified user ID.
• userId: string
The unique identifier of the user to retrieve.
Promise
<UserType
>
A Promise that resolves to the user information for the specified user ID.
If there is an issue with the request or response, or if the user with the specified ID is not found.
getUserPage(params?): Promise<UserPageResponse>
Retrieves a page of users based on the provided parameters, such as pagination and filtering.
• params?: UserListParameters
= {}
Optional parameters to filter and paginate the list of users.
Promise
<UserPageResponse
>
A Promise that resolves to a UserPageResponse object containing the user page data.
If there is an issue with the request or response.
listAllUsers(params): AsyncGenerator<UserType, void & UserType, undefined>
Retrieves a list of users, optionally paginated, based on the provided parameters.
• params: UserListParameters
= {}
Optional parameters to filter and paginate the list of users.
AsyncGenerator
<UserType
, undefined
>
An async generator that yields user objects.
protected parseResponse<T>(request, response): Promise<VetchResponse<T>>
Parses the response based on its content type.
• T
The expected type of the parsed response data.
• request: VetchOptions
The request options.
• response: Response
The raw response from the request.
Promise
<VetchResponse
<T
>>
- The parsed response.
server-client/dist/lib/client.d.ts:168
protected prepareBody(request): undefined | string
Prepares the body for the request based on the content type.
• request: VetchOptions
The request options.
undefined
| string
- The prepared request body as a string or undefined.
server-client/dist/lib/client.d.ts:158
protected prepareRequest(request): Promise<VetchOptions>
Prepares the request with necessary headers, authentication, and query parameters.
• request: VetchOptions
The initial request options.
Promise
<VetchOptions
>
- The modified request options.
server-client/dist/lib/client.d.ts:151
sendDeleteRequest<T>(url): Promise<VetchResponse<T>>
Sends a DELETE request to the specified URL.
• T
• url: string
The URL endpoint for the DELETE request.
Promise
<VetchResponse
<T
>>
- The response from the DELETE request.
server-client/dist/lib/client.d.ts:78
sendFormSubmitRequest<T>(url, payload?): Promise<VetchResponse<T>>
Sends a POST request with form data to the specified URL.
• T
• 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.
Promise
<VetchResponse
<T
>>
- The response from the POST request.
server-client/dist/lib/client.d.ts:86
sendGetRequest<T>(url, queryParams?): Promise<VetchResponse<T>>
Sends a GET request to the specified URL with optional query parameters.
• T
• 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.
Promise
<VetchResponse
<T
>>
- The response from the GET request.
server-client/dist/lib/client.d.ts:94
sendPatchRequest<T>(url, payload?): Promise<VetchResponse<T>>
Sends a PATCH request to the specified URL with an optional payload.
• T
• url: string
The URL endpoint for the PATCH request.
• payload?
Optional payload to be sent as the body of the PATCH request.
Promise
<VetchResponse
<T
>>
- The response from the PATCH request.
server-client/dist/lib/client.d.ts:104
sendPostRequest<T>(url, payload?): Promise<VetchResponse<T>>
Sends a POST request to the specified URL with an optional payload.
• T
• url: string
The URL endpoint for the POST request.
• payload?
Optional payload to be sent as the body of the POST request.
Promise
<VetchResponse
<T
>>
- The response from the POST request.
server-client/dist/lib/client.d.ts:114
sendPutRequest<T>(url, payload?): Promise<VetchResponse<T>>
Sends a PUT request to the specified URL with an optional payload.
• T
• url: string
The URL endpoint for the PUT request.
• payload?
Optional payload to be sent as the body of the PUT request.
Promise
<VetchResponse
<T
>>
- The response from the PUT request.
server-client/dist/lib/client.d.ts:124
sendRequest<T>(request): Promise<VetchResponse<T>>
Sends a request adding necessary headers, handling authentication, and parsing the response.
• T
• request: VetchOptions
The options defining the request, including URL, method, headers, and data.
Promise
<VetchResponse
<T
>>
- The parsed response from the request.
server-client/dist/lib/client.d.ts:144
sendRequestWithData<T>(
method,
url,
payload?): Promise<VetchResponse<T>>
Sends a request with JSON-encoded data to the specified URL using the provided HTTP method.
• T
• method: POST
| PUT
| PATCH
The HTTP method to be used for the request (only POST, PATCH, or PUT are acceptable).
• url: string
The URL endpoint for the request.
• payload?
Optional payload to be sent as the body of the request, JSON-encoded.
Promise
<VetchResponse
<T
>>
- The response from the request.
server-client/dist/lib/client.d.ts:135
updateUser(user): Promise<UserType>
Updates the user information for the specified user.
• user: UserType
The user object containing the updated information.
Promise
<UserType
>
A Promise that resolves to the updated user information.
If there is an issue with the request or response, or if the user with the specified ID is not found.
type MessengerChannel: object;
Represents a Messenger channel with an ID.
id: string;
The unique ID associated with the Messenger channel.
users/lib/types/messengerChannel.ts:4
type MmsChannel: object;
Represents an MMS (Multimedia Messaging Service) channel with a phone number.
number: string;
The phone number associated with the MMS channel.
users/lib/types/mmsChannel.ts:4
type PstnChannel: object;
Represents a PSTN (Public Switched Telephone Network) channel with a phone number.
number: number;
The phone number associated with the PSTN channel.
users/lib/types/pstnChannel.ts:4
type SipChannel: object;
Represents a SIP (Session Initiation Protocol) channel with the URI, username, and password.
password: string;
The password for authentication with the SIP channel.
uri: string;
The SIP URI associated with the channel.
username: string;
The username for authentication with the SIP channel.
users/lib/types/sipChannel.ts:4
type SmsChannel: object;
Represents an SMS (Short Message Service) channel with a phone number.
number: string;
The phone number associated with the SMS channel.
users/lib/types/smsChannel.ts:4
type UserChannelsRequest: object & Omit<Pick<UserType, "channels">, "websocket">;
Represents a request to create or update a user's channels.
websocket: WebSocketChannelRequest[];
An array of WebSocket channel requests.
Vonage API's will return information using snake_case
. This represents the
pure response before the client will transform the keys into camelCase
.
users/lib/types/requests/userRequest.ts:27
type UserListParameters: object;
Parameters for listing users.
optional cursor: string;
The cursor to start returning results from. You are not expected to provide this manually, but to follow the URL provided in _links.next.href or _links.prev.href in the response which contains a cursor value.
optional name: string;
Unique name for a user. Example: 'my_user_name'.
optional order: SortOrder;
The sorting order for the records. Must be one of: 'ASC' (Ascending) or 'DESC' (Descending).
optional pageSize: number;
The number of records to return in the response. Minimum: 1, Maximum: 100, Default: 10. Example: 10
users/lib/types/parameters/userListParameters.ts:6
type UserPageResponse: object & APILinks;
Represents a page response containing a list of users.
_embedded: object;
An object containing an array of user responses.
_embedded.users: UserResponse[];
page_size: number;
The number of records returned in this response.
Vonage API's will return information using snake_case
. This represents the
pure response before the client will transform the keys into camelCase
.
users/lib/types/responses/userPageResponse.ts:11
type UserPropertiesRequest: object;
Represents a request to create or update a user's properties.
custom_data: Record<string, string>;
Custom key-value pairs associated with the user.
Data here will not have their properties transformed
Vonage API's will return information using snake_case
. This represents the
pure response before the client will transform the keys into camelCase
.
users/lib/types/requests/userRequest.ts:11
type UserRequest: object & Omit<UserType, "imageUrl" | "properties">;
Represents a request to create or update a user.
channels: UserChannelsRequest;
Channels for communication, specifically WebSocket channels.
image_url: string;
The URL of the user's image.
properties: UserPropertiesRequest;
User properties including custom data.
Vonage API's will return information using snake_case
. This represents the
pure response before the client will transform the keys into camelCase
.
users/lib/types/requests/userRequest.ts:41
type UserResponse: UserRequest & APILinks;
Represents a response containing user information.
Vonage API's will return information using snake_case
. This represents the
pure response before the client will transform the keys into camelCase
.
users/lib/types/responses/userResponse.ts:11
type UserType: object;
Represents a user with various properties and communication channels.
optional channels: object;
Communication channels associated with the user.
optional channels.messenger: MessengerChannel[];
Messenger channels.
optional channels.mms: MmsChannel[];
MMS (Multimedia Messaging Service) channels.
optional channels.pstn: PstnChannel[];
PSTN (Public Switched Telephone Network) channels.
optional channels.sip: SipChannel[];
SIP (Session Initiation Protocol) channels.
optional channels.sms: SmsChannel[];
SMS (Short Message Service) channels.
optional channels.vbc: VbcChannel[];
VBC (Voice Business Communication) channels.
optional channels.viber: ViberChannel[];
Viber channels.
optional channels.websocket: WebsocketChannel[];
WebSocket channels.
optional channels.whatsapp: WhatsappChannel[];
WhatsApp channels.
optional displayName: string;
The display name of the user.
optional id: string;
The unique ID associated with the user.
optional imageUrl: string;
The URL of the user's image.
optional name: string;
The name of the user.
optional properties: object;
Custom data associated with the user.
properties.customData: Record<string, string>;
Custom key-value pairs for user data.
users/lib/types/userType.ts:14
type VbcChannel: object;
Represents a VBC (Voice Business Communication) channel with an extension.
extension: string;
The extension associated with the VBC channel.
users/lib/types/vbcChannel.ts:4
type ViberChannel: object;
Represents a Viber channel with a phone number.
number: string;
The phone number associated with the Viber channel.
users/lib/types/viberChannel.ts:4
type WebsocketChannel: object;
Represents a WebSocket channel configuration.
optional contentType: string;
Optional content type for WebSocket channel data.
optional headers: Record<string, string>;
Optional headers for WebSocket channel configuration.
uri: string;
The WebSocket URI for the channel.
users/lib/types/websocketChannel.ts:4
type WebSocketChannelRequest: object & Omit<WebsocketChannel, "contentType">;
Represents a request to create or update a WebSocket channel.
content-type: string;
The content type associated with the WebSocket channel.
Vonage API's will return information using snake_case
. This represents the
pure response before the client will transform the keys into camelCase
.
users/lib/types/requests/websocketChannelRequest.ts:10
type WebSocketChannelResponse: object & Omit<WebsocketChannel, "contentType">;
Represents a response containing WebSocket channel information.
content-type: string;
The content type associated with the WebSocket channel.
Vonage API's will return information using snake_case
. This represents the
pure response before the client will transform the keys into camelCase
.
users/lib/types/responses/websocketChannelResponse.ts:9
type WhatsappChannel: object;
Represents a WhatsApp channel with a phone number.
number: string;
The phone number associated with the WhatsApp channel.