Skip to content

Vonage Audit

github-actions edited this page Dec 10, 2024 · 66 revisions

Vonage Audit


Documentation / Vonage Audit

Vonage Audit

Enumerations

AuditEventTypes

Audit Events are generated automatically by Vonage as the user interacts with either a Vonage API or the Vonage Dashboard. Each Audit Event object has a type and associated metadata.

Remarks

The list of supported event types does change from time to time. For this reason the OPTIONS method is provided to return event types. You can see how to return the definitive list of event types from the https://developer.vonage.com/en/audit/code-snippets/get-event-types

See

Documentation https://developer.vonage.com/en/audit/concepts/audit-events

Enumeration Members

Enumeration Member Value Description Defined in
ACCOUNT_SECRET_CREATE "ACCOUNT_SECRET_CREATE" Secret Rotation operation. audit/lib/enums.ts:63
ACCOUNT_SECRET_DELETE "ACCOUNT_SECRET_DELETE" Secret Rotation operation. audit/lib/enums.ts:58
ACCOUNT_UPDATE_SETTINGS_API "ACCOUNT_UPDATE_SETTINGS_API" Account Settings updated via API. audit/lib/enums.ts:73
ACCOUNT_UPDATE_SPAMMER "ACCOUNT_UPDATE_SPAMMER" Account Settings updated via API. audit/lib/enums.ts:68
APP_CREATE "APP_CREATE" App created. audit/lib/enums.ts:103
APP_DELETE "APP_DELETE" App deleted. audit/lib/enums.ts:113
APP_DISABLE "APP_DISABLE" App disabled. audit/lib/enums.ts:118
APP_ENABLE "APP_ENABLE" App enabled. audit/lib/enums.ts:123
APP_UPDATE "APP_UPDATE" App updated. audit/lib/enums.ts:108
AUTORELOAD_DISABLE "AUTORELOAD_DISABLE" Automatic reload disabled. audit/lib/enums.ts:148
AUTORELOAD_ENABLE "AUTORELOAD_ENABLE" Automatic reload enabled. audit/lib/enums.ts:138
AUTORELOAD_UPDATE "AUTORELOAD_UPDATE" Automatic reload settings updated. audit/lib/enums.ts:143
IP_WHITELIST_CREATE "IP_WHITELIST_CREATE" Whitelist IP added. audit/lib/enums.ts:128
IP_WHITELIST_DELETE "IP_WHITELIST_DELETE" Whitelist IP deleted. audit/lib/enums.ts:133
NUMBER_ASSIGN "NUMBER_ASSIGN" Number assigned. audit/lib/enums.ts:78
NUMBER_LINKED "NUMBER_LINKED" Number linked to Vonage application. audit/lib/enums.ts:93
NUMBER_RELEASE "NUMBER_RELEASE" Number released. audit/lib/enums.ts:88
NUMBER_UNLINKED "NUMBER_UNLINKED" Number unlinked from Vonage application. audit/lib/enums.ts:98
NUMBER_UPDATED "NUMBER_UPDATED" Number updated. audit/lib/enums.ts:83
USER_API_KEYS_UPDATE "USER_API_KEYS_UPDATE" Sub-accounts for user updated. audit/lib/enums.ts:53
USER_BILLING_UPDATE "USER_BILLING_UPDATE" User billing updated. audit/lib/enums.ts:28
USER_CREATE "USER_CREATE" User created. audit/lib/enums.ts:33
USER_LOGIN "USER_LOGIN" User login (Premium Support only). audit/lib/enums.ts:38
USER_LOGOUT "USER_LOGOUT" User logout (Premium Support only). audit/lib/enums.ts:43
USER_PRODUCT_SEARCH "USER_PRODUCT_SEARCH" Relates to searching for CDRs or logs in Dashboard. audit/lib/enums.ts:48
USER_STATUS "USER_STATUS" User status updated. audit/lib/enums.ts:18
USER_UPDATE "USER_UPDATE" User updated. audit/lib/enums.ts:23

Classes

Audit

Represents an SDK client for interacting with audit-related functionality.

Remarks

This client is only available as a standalone client. It cannot be instantiated from a Vonage client.

Example

Create a standalone Audit client

import { Audit } from '@vonage/audit';

const auditClient = new Audit({
 apiKey: VONAGE_API_KEY,
 apiSecret: VONAGE_API_SECRET
});

Extends

Constructors

new Audit()
new Audit(credentials, options?): Audit

Creates a new instance of the Client.

Parameters
credentials

The authentication credentials or an authentication instance.

AuthInterface | AuthParams

options?

ConfigParams

Optional configuration settings for the client.

Returns

Audit

Inherited from

Client.constructor

Defined in

server-client/dist/lib/client.d.ts:35

Properties

auth
protected auth: AuthInterface;

The authentication instance responsible for generating authentication headers and query parameters.

Inherited from

Client.auth

Defined in

server-client/dist/lib/client.d.ts:24

authType
authType: AuthenticationType = AuthenticationType.BASIC;

The type of authentication used for the client's requests.

Overrides

Client.authType

Defined in

audit/lib/audit.ts:33

BASE_PATH
protected BASE_PATH: string = 'beta';
Defined in

audit/lib/audit.ts:30

config
protected config: ConfigParams;

Configuration settings for the client, including default hosts for various services and other request settings.

Inherited from

Client.config

Defined in

server-client/dist/lib/client.d.ts:28

transformers
static transformers: object;

Static property containing utility transformers.

camelCaseObjectKeys
camelCaseObjectKeys: PartialTransformFunction;
kebabCaseObjectKeys
kebabCaseObjectKeys: PartialTransformFunction;
omit()
omit: (keys, obj) => TransformedObject;
Parameters
keys

string[]

obj

ObjectToTransform

Returns

TransformedObject

snakeCaseObjectKeys
snakeCaseObjectKeys: PartialTransformFunction;
Inherited from

Client.transformers

Defined in

server-client/dist/lib/client.d.ts:11

Methods

addAuthenticationToRequest()
addAuthenticationToRequest(request): Promise<VetchOptions>

Adds the appropriate authentication headers or parameters to the request based on the authentication type.

Parameters
request

VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

Client.addAuthenticationToRequest

Defined in

server-client/dist/lib/client.d.ts:43

addBasicAuthToRequest()
protected addBasicAuthToRequest(request): Promise<VetchOptions>

Adds basic authentication headers to the request.

Parameters
request

VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

Client.addBasicAuthToRequest

Defined in

server-client/dist/lib/client.d.ts:71

addJWTToRequest()
protected addJWTToRequest(request): Promise<VetchOptions>

Adds a JWT to the request.

Parameters
request

VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

Client.addJWTToRequest

Defined in

server-client/dist/lib/client.d.ts:64

addQueryKeySecretToRequest()
protected addQueryKeySecretToRequest(request): Promise<VetchOptions>

Adds API key and secret to the request.

Parameters
request

VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

Client.addQueryKeySecretToRequest

Defined in

server-client/dist/lib/client.d.ts:57

addQueryKeySecretToRequestBody()
protected addQueryKeySecretToRequestBody(request): Promise<VetchOptions>

Adds API key and secret to the request body.

Parameters
request

VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

Client.addQueryKeySecretToRequestBody

Defined in

server-client/dist/lib/client.d.ts:50

getConfig()
getConfig(): ConfigParams
Returns

ConfigParams

Inherited from

Client.getConfig

Defined in

server-client/dist/lib/client.d.ts:36

getEvent()
getEvent(eventId): Promise<AuditEvent>

Retrieves a specific audit event by its ID.

Parameters
eventId

string

The ID of the audit event to retrieve.

Returns

Promise<AuditEvent>

A promise that resolves to the retrieved audit event.

Example

Retrieve a specific audit event

const auditEvent = await auditClient.getEvent('event-id');
console.log(auditEvent.id);
Defined in

audit/lib/audit.ts:105

getEvents()
getEvents(params): AsyncGenerator<AuditEvent, void, undefined>

Retrieves a list of audit events based on specified parameters.

Parameters
params

AuditParams

The query parameters for filtering audit events.

Returns

AsyncGenerator<AuditEvent, void, undefined>

An async generator that yields audit events.

Example

Retrieve a list of audit events

const auditEvents = auditClient.getEvents({
  page: 1,
  size: 10,
  dateFrom: '2021-01-01T00:00:00Z',
  dateTo: '2021-01-31T23:59:59Z',
  eventType: 'message',
  search: 'search term'
});

for await (const event of auditEvents) {
  console.log(event.id);
  console.log(event.type);
  console.log(event.created);
  console.log(event.accountId);
  console.log(event.requestId);
  console.log(event.request);
  console.log(event.response);
  console.log(event.ipAddress);
  console.log(event.country);
  console.log(event.msisdn);
}
Defined in

audit/lib/audit.ts:68

parseResponse()
protected parseResponse<T>(request, response): Promise<VetchResponse<T>>

Parses the response based on its content type.

Type Parameters

T

The expected type of the parsed response data.

Parameters
request

VetchOptions

The request options.

response

Response

The raw response from the request.

Returns

Promise<VetchResponse<T>>

  • The parsed response.
Inherited from

Client.parseResponse

Defined in

server-client/dist/lib/client.d.ts:168

prepareBody()
protected prepareBody(request): undefined | string

Prepares the body for the request based on the content type.

Parameters
request

VetchOptions

The request options.

Returns

undefined | string

  • The prepared request body as a string or undefined.
Inherited from

Client.prepareBody

Defined in

server-client/dist/lib/client.d.ts:158

prepareRequest()
protected prepareRequest(request): Promise<VetchOptions>

Prepares the request with necessary headers, authentication, and query parameters.

Parameters
request

VetchOptions

The initial request options.

Returns

Promise<VetchOptions>

  • The modified request options.
Inherited from

Client.prepareRequest

Defined in

server-client/dist/lib/client.d.ts:151

sendDeleteRequest()
sendDeleteRequest<T>(url): Promise<VetchResponse<T>>

Sends a DELETE request to the specified URL.

Type Parameters

T

Parameters
url

string

The URL endpoint for the DELETE request.

Returns

Promise<VetchResponse<T>>

  • The response from the DELETE request.
Inherited from

Client.sendDeleteRequest

Defined in

server-client/dist/lib/client.d.ts:78

sendFormSubmitRequest()
sendFormSubmitRequest<T>(url, payload?): Promise<VetchResponse<T>>

Sends a POST request with form data to the specified URL.

Type Parameters

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<T>>

  • The response from the POST request.
Inherited from

Client.sendFormSubmitRequest

Defined in

server-client/dist/lib/client.d.ts:86

sendGetRequest()
sendGetRequest<T>(url, queryParams?): Promise<VetchResponse<T>>

Sends a GET request to the specified URL with optional query parameters.

Type Parameters

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<T>>

  • The response from the GET request.
Inherited from

Client.sendGetRequest

Defined in

server-client/dist/lib/client.d.ts:94

sendPatchRequest()
sendPatchRequest<T>(url, payload?): Promise<VetchResponse<T>>

Sends a PATCH request to the specified URL with an optional payload.

Type Parameters

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<T>>

  • The response from the PATCH request.
Inherited from

Client.sendPatchRequest

Defined in

server-client/dist/lib/client.d.ts:104

sendPostRequest()
sendPostRequest<T>(url, payload?): Promise<VetchResponse<T>>

Sends a POST request to the specified URL with an optional payload.

Type Parameters

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<T>>

  • The response from the POST request.
Inherited from

Client.sendPostRequest

Defined in

server-client/dist/lib/client.d.ts:114

sendPutRequest()
sendPutRequest<T>(url, payload?): Promise<VetchResponse<T>>

Sends a PUT request to the specified URL with an optional payload.

Type Parameters

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<T>>

  • The response from the PUT request.
Inherited from

Client.sendPutRequest

Defined in

server-client/dist/lib/client.d.ts:124

sendRequest()
sendRequest<T>(request): Promise<VetchResponse<T>>

Sends a request adding necessary headers, handling authentication, and parsing the response.

Type Parameters

T

Parameters
request

VetchOptions

The options defining the request, including URL, method, headers, and data.

Returns

Promise<VetchResponse<T>>

  • The parsed response from the request.
Inherited from

Client.sendRequest

Defined in

server-client/dist/lib/client.d.ts:144

sendRequestWithData()
sendRequestWithData<T>(
   method, 
   url, 
payload?): Promise<VetchResponse<T>>

Sends a request with JSON-encoded data to the specified URL using the provided HTTP method.

Type Parameters

T

Parameters
method

The HTTP method to be used for the request (only POST, PATCH, or PUT are acceptable).

POST | PUT | 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<T>>

  • The response from the request.
Inherited from

Client.sendRequestWithData

Defined in

server-client/dist/lib/client.d.ts:135

Type Aliases

AuditEvent

type AuditEvent: object;

Represents an Audit Event.

Type declaration

accountId
accountId: string;

The API_KEY of the Vonage API account that the audit event is associated with.

context?
optional context: unknown;

Additional context information for the audit event.

createdAt
createdAt: string;

The date when the audit event was created.

eventType
eventType: AuditEventTypes | string;

The type of the audit event.

id
id: string;

UUID of the audit event.

source
source: "CD" | "DEVAPI";

The source of the event.

sourceCountry
sourceCountry: string;

ISO 3166-1 Alpha-2 country code recorded for the event.

sourceDescription
sourceDescription: "Customer Dashboard" | "Developer API";

Description of the audit event source.

userEmail?
optional userEmail: string;

Email of the user whose account the audit event is associated with.

userId?
optional userId: string;

The ID of the user that the audit event is associated with.

Defined in

audit/lib/types/auditEvent.ts:5


AuditEventListResponse

type AuditEventListResponse: object;

Represents the response containing a list of audit events.

Type declaration

_embedded?
optional _embedded: object;

An object containing an array of audit events.

_embedded.events
_embedded.events: AuditEvent[];
_links
_links: APILinks;

Links associated with the API response.

page
page: AuditEventPage;

Information about the pagination and page details.

Remarks

Vonage API's will return information using snake_case. This represents the pure response before the client will transform the keys into camelCase

Defined in

audit/lib/types/auditEventListResponse.ts:12


AuditEventPage

type AuditEventPage: object;

Represents information about the pagination of audit events.

Type declaration

number
number: number;

The current page number.

size
size: number;

The number of items per page.

totalElements
totalElements: number;

The total number of elements across all pages.

totalPages
totalPages: number;

The total number of pages available.

Defined in

audit/lib/types/auditEventPage.ts:4


AuditEventResponse

type AuditEventResponse: object & Pick<AuditEvent, "id" | "source" | "context">;

Represents an Audit Event.

Type declaration

account_id
account_id: string;

The API_KEY of the Vonage API account that the audit event is associated with.

created_at
created_at: string;

The date when the audit event was created.

event_type
event_type: AuditEventTypes | string;

The type of the audit event.

source_country
source_country: string;

ISO 3166-1 Alpha-2 country code recorded for the event.

source_description
source_description: Pick<AuditEvent, "sourceDescription">;

Description of the audit event source.

user_email?
optional user_email: string;

Email of the user whose account the audit event is associated with.

user_id?
optional user_id: string;

The ID of the user that the audit event is associated with.

Remarks

Vonage API's will return information using snake_case. This represents the pure response before the client will transform the keys into camelCase

Defined in

audit/lib/types/auditEventResponse.ts:11


AuditParams

type AuditParams: object;

Represents parameters for querying audit events.

Type declaration

dateFrom?
optional dateFrom: string;

The start date for the audit event query.

dateTo?
optional dateTo: string;

The end date for the audit event query.

eventType?
optional eventType: AuditEventTypes | string;

The type of the audit event to filter by.

page?
optional page: number;

The page number for paginated results.

searchText?
optional searchText: string;

Text to search within audit event descriptions.

size?
optional size: number;

The number of items per page.

Defined in

audit/lib/types/auditParams.ts:6


AuditResponse<T>

type AuditResponse<T>: VetchResponse<T>;

Type Parameters

T

Deprecated

this is not used

Defined in

audit/lib/types/auditResponse.ts:6

Clone this wiki locally