Network
| Packages | @univerjs/network |
|---|
This Facade provides a set of methods to make HTTP requests. You should not
create an instance of this class directly, instead, use getNetwork of
FUniver instead.
This class should not be instantiated directly. Use factory methods on
univerAPIinstead.
Overview
@univerjs/network
| Method | Description |
|---|---|
delete | Send DELETE request to the server |
get | Send a GET request to the server |
getSSE | Request for a stream of server-sent events |
patch | Send PATCH request to the server |
post | Send a POST request to the server |
put | Send a PUT request to the server |
APIs
Getters & Queries
get
Send a GET request to the server.
Signature
get<T>(url: string, params?: IRequestParams): Promise<HTTPResponse<T>>Parameters
urlstring— No descriptionparamsIRequestParams(optional) — No description
Returns
Promise<HTTPResponse<T>>— Network response.
@univerjs/network
getSSE
Request for a stream of server-sent events. Instead of a single response, the server sends a stream of responses,
Univer wraps the stream in an Observable which you can call subscribe on.
Signature
getSSE<T>(method: HTTPRequestMethod, url: string, params?: IPostRequestParams): Observable<HTTPEvent<T>>Parameters
methodHTTPRequestMethod— No descriptionurlstring— No descriptionparamsIPostRequestParams(optional) — No description
Returns
Observable<HTTPEvent<T>>— An observable that emits the network response.
@univerjs/network
Actions & Operations
delete
Send DELETE request to the server.
Signature
delete<T>(url: string, params?: IRequestParams): Promise<HTTPResponse<T>>Parameters
urlstring— No descriptionparamsIRequestParams(optional) — No description
Returns
Promise<HTTPResponse<T>>— Network response
@univerjs/network
Miscellaneous
patch
Send PATCH request to the server.
Signature
patch<T>(url: string, params?: IPostRequestParams): Promise<HTTPResponse<T>>Parameters
urlstring— No descriptionparamsIPostRequestParams(optional) — No description
Returns
Promise<HTTPResponse<T>>— Network response
@univerjs/network
post
Send a POST request to the server.
Signature
post<T>(url: string, params?: IPostRequestParams): Promise<HTTPResponse<T>>Parameters
urlstring— No descriptionparamsIPostRequestParams(optional) — No description
Returns
Promise<HTTPResponse<T>>— Network response.
@univerjs/network
put
Send a PUT request to the server.
Signature
put<T>(url: string, params?: IPostRequestParams): Promise<HTTPResponse<T>>Parameters
urlstring— No descriptionparamsIPostRequestParams(optional) — No description
Returns
Promise<HTTPResponse<T>>— Network response
@univerjs/network