Readonly
optsPrivate
uploadsThe HTTP method e.g. "GET".
The HTTP path after the supplied prefix e.g. "/createRoom".
Optional
queryParams: QueryDictA dict of query params (these will NOT be urlencoded). If unspecified, there will be no query params.
Optional
body: BodyThe HTTP JSON body.
additional options. If a number is specified,
this is treated as opts.localTimeoutMs
.
Get the content repository url with query parameters.
An object with a 'base', 'path' and 'params' for base URL, path and query parameters respectively.
Form and return a homeserver request URL based on the given path params and prefix.
URL
The HTTP path after the supplied prefix e.g. "/createRoom".
Optional
queryParams: QueryDictA dict of query params (these will NOT be urlencoded).
Optional
prefix: stringThe full prefix to use e.g. "/_matrix/client/v2_alpha", defaulting to this.opts.prefix.
Optional
baseUrl: stringThe baseUrl to use e.g. "https://matrix.org/", defaulting to this.opts.baseUrl.
Optional
accessToken: stringPerform a request to the homeserver without any credentials.
Promise which resolves to
{
data: {Object},
headers: {Object},
code: {Number},
}
If onlyData</code> is set, this will resolve to the <code>data
object only.
Rejects with an error if a problem occurred. This includes network problems and Matrix-specific error JSON.
The HTTP method e.g. "GET".
The HTTP path after the supplied prefix e.g. "/createRoom".
Optional
queryParams: QueryDictA dict of query params (these will NOT be urlencoded). If unspecified, there will be no query params.
Optional
body: BodyThe HTTP JSON body.
Optional
opts: IRequestOptsadditional options
Perform a request to an arbitrary URL.
Promise which resolves to data unless onlyData
is specified as false,
where the resolved value will be a fetch Response object.
Rejects with an error if a problem occurred. This includes network problems and Matrix-specific error JSON.
The HTTP method e.g. "GET".
The HTTP URL object.
Optional
body: BodyThe HTTP JSON body.
additional options
Upload content to the homeserver
Promise which resolves to response object, as determined by this.opts.onlyData, opts.rawResponse, and opts.onlyContentUri. Rejects with an error (usually a MatrixError).
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.
options object
Generated using TypeDoc
Perform an authorised request to the homeserver.
Returns
Promise which resolves to
If
onlyData
is set, this will resolve to thedata
object only.Returns
Rejects with an error if a problem occurred. This includes network problems and Matrix-specific error JSON.