Skip to main content

LensStudio:RemoteServiceModule.RemoteApiResponse

Class

Response object from RemoteServiceModule API requests.

Index

Example

// RemoteApiResponse is received in the callback of performApiRequest().
// It has a protected constructor — you never instantiate it directly.
//
// Properties (all readonly):
// body: Editor.Buffer — response body data
// linkedResources: RemoteApiResponse.LinkedResource[] — linked resource URLs
// statusCode: number — HTTP status code

const { RemoteApiRequest, performApiRequest } = await import('LensStudio:RemoteServiceModule');

const request = RemoteApiRequest.create();
request.endpoint = '/v1/test';
request.specId = 'test-spec';
request.parameters = {};

performApiRequest(request, (response) => {
// body: Editor.Buffer containing the response payload
console.log('statusCode:', response.statusCode);
console.log('body byte length:', response.body.toBytes().length);

// linkedResources: array of LinkedResource objects
console.log('linkedResources count:', response.linkedResources.length);
for (const resource of response.linkedResources) {
console.log('linked resource url:', resource.url);
}
});

console.log('RemoteApiResponse is received via performApiRequest callback.');
console.log('Properties: body (Buffer), linkedResources (LinkedResource[]), statusCode (number) — all readonly.');

Properties

body

readonly body: Buffer

Buffer containing the response body data.


linkedResources

readonly linkedResources: LinkedResource[]

Array of resources linked to the response.


statusCode

readonly statusCode: number

HTTP status code of the response.

Nested types

Classes

ClassDescription
LinkedResourceRepresents a resource linked to the API response.