LensStudio:RemoteServiceModule.RemoteApiRequest
ClassConfiguration for request through "LensStudio:RemoteServiceModule".performApiRequest
Index
Properties
Methods
Example
// RemoteApiRequest is the configuration object for performApiRequest().
// It has a protected constructor — create instances via the static create() method.
//
// Properties:
// body: string — request body content
// endpoint: string — the API endpoint path
// parameters: any — key-value parameters for the request
// specId: string — identifier for the registered Snap service spec
//
// Static method:
// RemoteApiRequest.create(): RemoteApiRequest
const { RemoteApiRequest } = await import('LensStudio:RemoteServiceModule');
const request = RemoteApiRequest.create();
console.log('Created RemoteApiRequest via RemoteApiRequest.create().');
request.endpoint = '/v1/my-service';
console.log('endpoint set to:', request.endpoint);
request.specId = 'my-spec-id';
console.log('specId set to:', request.specId);
request.parameters = { query: 'hello', limit: 10 };
console.log('parameters set to:', JSON.stringify(request.parameters));
request.body = '{"data":"payload"}';
console.log('body set to:', request.body);
Properties
body
body:
string|Uint8Array<ArrayBufferLike>
The body of the request.
endpoint
endpoint:
string
The endpoint of the request (e.g. API path).
parameters
parameters:
any
Request parameters as key-value pairs.
specId
specId:
string
The spec id of the RemoteServiceModule.
Methods
create()
staticcreate():RemoteApiRequest
Create the configuration.
Returns
RemoteApiRequest