-
Notifications
You must be signed in to change notification settings - Fork 181
Vonage Vetch
Documentation / Vonage Vetch
Enum representing possible MIME types for the 'content-type' HTTP header that Vonage API's could accept.
Note: Most of the APIs will only accept application/json
. Please refer
to the specific API documentation to determine if another content type is
accepted
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
CSV |
"text/csv" |
Represents the MIME type for CSV data. | packages/vetch/lib/enums/contentType.ts:20 |
FORM_URLENCODED |
"application/x-www-form-urlencoded" |
Represents the MIME type for URL-encoded form data. | packages/vetch/lib/enums/contentType.ts:14 |
JSON |
"application/json" |
Represents the MIME type for JSON data. | packages/vetch/lib/enums/contentType.ts:11 |
XML |
"application/xml" |
Represents the MIME type for XML data. | packages/vetch/lib/enums/contentType.ts:17 |
Enum representing the HTTP methods that can be used for Vonage API requests.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
DELETE |
"DELETE" |
Represents an HTTP DELETE request. | packages/vetch/lib/enums/HTTPMethods.ts:12 |
GET |
"GET" |
Represents an HTTP GET request. | packages/vetch/lib/enums/HTTPMethods.ts:6 |
PATCH |
"PATCH" |
Represents an HTTP PATCH request. | packages/vetch/lib/enums/HTTPMethods.ts:18 |
POST |
"POST" |
Represents an HTTP POST request. | packages/vetch/lib/enums/HTTPMethods.ts:9 |
PUT |
"PUT" |
Represents an HTTP PUT request. | packages/vetch/lib/enums/HTTPMethods.ts:15 |
Enum representing the expected response types for API requests. This was originaly used to set what the expected response type will be. It is better to use the content-type header from the response to decode properly.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
json |
"json" |
Represents a JSON-formatted response. | packages/vetch/lib/enums/responseTypes.ts:11 |
stream |
"stream" |
Represents a stream response, typically for handling large data or files. | packages/vetch/lib/enums/responseTypes.ts:16 |
text |
"text" |
Represents a plain text response. | packages/vetch/lib/enums/responseTypes.ts:21 |
Class representing an error from a Vetch API request. Extends the built-in Error class and adds additional properties related to the API request and response.
The type of the data payload in the VetchResponse, expected to be an object that has been decoded from JSON or WebForm.
Error
new VetchError(
message,
options,
response?): VetchError
Creates an instance of VetchError.
string
The error message.
Configuration options for the API request.
Response
Configuration options for the API request.
Error.constructor
packages/vetch/lib/errors/vetchError.ts:27
optional cause: unknown;
Error.cause
node_modules/typescript/lib/lib.es2022.error.d.ts:24
optional code: string;
An optional error code.
packages/vetch/lib/errors/vetchError.ts:16
config: VetchOptions;
Configuration options for the API request.
packages/vetch/lib/errors/vetchError.ts:17
message: string;
Error.message
node_modules/typescript/lib/lib.es5.d.ts:1077
name: string;
Error.name
node_modules/typescript/lib/lib.es5.d.ts:1076
optional response: Response;
The API response that resulted in the error.
packages/vetch/lib/errors/vetchError.ts:18
optional stack: string;
Error.stack
node_modules/typescript/lib/lib.es5.d.ts:1078
static optional prepareStackTrace: (err, stackTraces) => any;
Optional override for formatting stack traces
Error
CallSite
[]
any
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Error.prepareStackTrace
node_modules/@types/node/globals.d.ts:143
static stackTraceLimit: number;
Error.stackTraceLimit
node_modules/@types/node/globals.d.ts:145
static captureStackTrace(targetObject, constructorOpt?): void
Create .stack property on a target object
object
Function
void
Error.captureStackTrace
node_modules/@types/node/globals.d.ts:136
type Headers: object;
Interface representing HTTP headers as a string-keyed object. Each property represents a header name, and the associated value can be a string or an array of strings. Includes optional 'authorization' and 'content-type' properties with restricted possible values for 'content-type'.
[index
: string
]: string
packages/vetch/lib/types/headers.ts:7
type VetchOptions: object;
Options to configure the Vetch request.
optional appendUserAgent: string;
Additional user agent string to append.
optional body: Record<string, string | readonly string[]> | string;
Use 'data' instead of 'body'
optional checkStatus: (status) => boolean;
A function to check the response status.
number
boolean
optional data: Record<string, string | readonly string[]> | string;
Request body data. Use 'data' instead of 'body' for newer implementations.
optional headers: Headers;
The headers to be sent with the request.
method: HTTPMethods;
The HTTP method to use for the request, e.g., GET, POST, etc.
optional params: Record<string, string | readonly string[]>;
Query parameters for the request.
optional responseType: ResponseTypes;
Expected response type.
ResponseTypes
is deprecated and will be removed in future versions.
optional timeout: number;
Time in milliseconds to wait for the request to complete.
type: ContentType;
The content type for the request, e.g., JSON, WebForm, etc.
url: string;
The URL endpoint for the request.
packages/vetch/lib/types/vetchOptions.ts:7
type VetchPromise<T>: Promise<VetchResponse<T>>;
Type representing a promise that resolves with a standardized Vetch API response. Vetch ("Vonage Fetch") ensures a consistent API response structure, irrespective of the HTTP adapter utilized by the developer.
• T
The type of the data payload in the VetchResponse, expected to be an object that has been decoded from JSON or WebForm.
packages/vetch/lib/types/vetchPromise.ts:12
type VetchResponse<T>: object;
Represents the response returned by a Vetch request.
• T
The type of the response data.
config: VetchOptions;
The configuration options used for the request.
data: T;
The parsed response data.
headers: Headers;
The response headers.
request: VetchOptions;
The configuration options for the request (same as 'config').
status: number;
The HTTP status code of the response.
statusText: string;
The HTTP status text of the response.