DigitalWorldHttpApi
Defined in: src/http-api/index.ts:32
Extends
Section titled “Extends”FetchHttpApi<O>
Type Parameters
Section titled “Type Parameters”O extends IHttpOpts
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DigitalWorldHttpApi<
O>(eventEmitter,opts):DigitalWorldHttpApi<O>
Defined in: src/http-api/fetch.ts:41
Parameters
Section titled “Parameters”eventEmitter
Section titled “eventEmitter”TypedEventEmitter<HttpApiEvent, HttpApiEventHandlerMap>
O
Returns
Section titled “Returns”DigitalWorldHttpApi<O>
Inherited from
Section titled “Inherited from”FetchHttpApi<O>.constructor
Properties
Section titled “Properties”
readonlyopts:O
Defined in: src/http-api/fetch.ts:43
Inherited from
Section titled “Inherited from”FetchHttpApi.opts
Methods
Section titled “Methods”abort()
Section titled “abort()”abort():
void
Defined in: src/http-api/fetch.ts:54
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”FetchHttpApi.abort
authedRequest()
Section titled “authedRequest()”authedRequest<
T>(method,path,queryParams?,body?,paramOpts?):Promise<T>
Defined in: src/http-api/fetch.ts:124
Perform an authorised request to the hub.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”method
Section titled “method”The HTTP method e.g. “GET”.
string
The HTTP path after the supplied prefix e.g. “/createRoom”.
queryParams?
Section titled “queryParams?”QueryDict = {}
A dict of query params (these will NOT be urlencoded). If unspecified, there will be no query params.
The HTTP JSON body.
paramOpts?
Section titled “paramOpts?”IRequestOpts = {}
additional options.
When paramOpts.doNotAttemptTokenRefresh is true, token refresh will not be attempted
when an expired token is encountered. Used to only attempt token refresh once.
Returns
Section titled “Returns”Promise<T>
The parsed response.
Throws
Section titled “Throws”Error if a problem occurred. This includes network problems and protocol-specific error JSON.
Inherited from
Section titled “Inherited from”FetchHttpApi.authedRequest
cancelUpload()
Section titled “cancelUpload()”cancelUpload(
promise):boolean
Defined in: src/http-api/index.ts:160
Parameters
Section titled “Parameters”promise
Section titled “promise”Promise<UploadResponse>
Returns
Section titled “Returns”boolean
fetch()
Section titled “fetch()”fetch(
resource,options?):Promise<Response>
Defined in: src/http-api/fetch.ts:59
Parameters
Section titled “Parameters”resource
Section titled “resource”string | URL
options?
Section titled “options?”RequestInit
Returns
Section titled “Returns”Promise<Response>
Inherited from
Section titled “Inherited from”FetchHttpApi.fetch
getCurrentUploads()
Section titled “getCurrentUploads()”getCurrentUploads():
Upload[]
Defined in: src/http-api/index.ts:169
Returns
Section titled “Returns”Upload[]
getUrl()
Section titled “getUrl()”getUrl(
path,queryParams?,prefix?,baseUrl?):URL
Defined in: src/http-api/fetch.ts:363
Form and return a hub request URL based on the given path params and prefix.
Parameters
Section titled “Parameters”string
The HTTP path after the supplied prefix e.g. “/createRoom”.
queryParams?
Section titled “queryParams?”QueryDict
A dict of query params (these will NOT be urlencoded).
prefix?
Section titled “prefix?”string
The full prefix to use e.g. “/_matrix/client/v2_alpha”, defaulting to this.opts.prefix.
baseUrl?
Section titled “baseUrl?”string
The baseUrl to use e.g. “https://matrix.org”, defaulting to this.opts.baseUrl.
Returns
Section titled “Returns”URL
URL
Inherited from
Section titled “Inherited from”FetchHttpApi.getUrl
idServerRequest()
Section titled “idServerRequest()”idServerRequest<
T>(method,path,params,prefix,accessToken?):Promise<T>
Defined in: src/http-api/fetch.ts:74
Type Parameters
Section titled “Type Parameters”T extends object = Record<string, unknown>
Parameters
Section titled “Parameters”method
Section titled “method”string
params
Section titled “params”Record<string, string | string[]> | undefined
prefix
Section titled “prefix”string
accessToken?
Section titled “accessToken?”string
Returns
Section titled “Returns”Promise<T>
Inherited from
Section titled “Inherited from”FetchHttpApi.idServerRequest
request()
Section titled “request()”request<
T>(method,path,queryParams?,body?,opts?):Promise<T>
Defined in: src/http-api/fetch.ts:211
Perform a request to the hub without any credentials.
Type Parameters
Section titled “Type Parameters”T = unknown
Parameters
Section titled “Parameters”method
Section titled “method”The HTTP method e.g. “GET”.
string
The HTTP path after the supplied prefix e.g. “/createRoom”.
queryParams?
Section titled “queryParams?”QueryDict
A dict of query params (these will NOT be urlencoded). If unspecified, there will be no query params.
The HTTP JSON body.
additional options
Returns
Section titled “Returns”Promise<T>
The parsed response.
Throws
Section titled “Throws”Error if a problem occurred. This includes network problems and protocol-specific error JSON.
Inherited from
Section titled “Inherited from”FetchHttpApi.request
requestOtherUrl()
Section titled “requestOtherUrl()”requestOtherUrl<
T>(method,url,body?,opts?):Promise<T>
Defined in: src/http-api/fetch.ts:234
Perform a request to an arbitrary URL.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”method
Section titled “method”The HTTP method e.g. “GET”.
string | URL
The HTTP URL object.
The HTTP JSON body.
BaseRequestOpts = {}
additional options
Returns
Section titled “Returns”Promise<T>
The parsed response.
Throws
Section titled “Throws”Error if a problem occurred. This includes network problems and protocol-specific error JSON.
Inherited from
Section titled “Inherited from”FetchHttpApi.requestOtherUrl
setIdBaseUrl()
Section titled “setIdBaseUrl()”setIdBaseUrl(
url?):void
Defined in: src/http-api/fetch.ts:70
Sets the base URL for the identity server
Parameters
Section titled “Parameters”string
The new base url
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”FetchHttpApi.setIdBaseUrl
uploadContent()
Section titled “uploadContent()”uploadContent(
file,opts?):Promise<UploadResponse>
Defined in: src/http-api/index.ts:48
Upload content to the hub
Parameters
Section titled “Parameters”XMLHttpRequestBodyInit
The object to upload. On a browser, something that can be sent to XMLHttpRequest.send (typically a File). Under node.js, a Buffer, String or ReadStream.
UploadOpts = {}
options object
Returns
Section titled “Returns”Promise<UploadResponse>
Promise which resolves to response object, or rejects with an error (usually a DigitalWorldError).
Throws
Section titled “Throws”May throw a DigitalWorldSafetyError if content is deemed unsafe.
DigitalWorldSafetyError