Network

GitHubEdit on GitHub
Packages@univerjs/network
CORE

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 univerAPI instead.

Overview

@univerjs/network

MethodDescription
deleteSend DELETE request to the server
getSend a GET request to the server
getSSERequest for a stream of server-sent events
patchSend PATCH request to the server
postSend a POST request to the server
putSend 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

  • url stringNo description
  • params IRequestParams (optional)No description

Returns

  • Promise<HTTPResponse<T>> — Network response.
Source: @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

  • method HTTPRequestMethodNo description
  • url stringNo description
  • params IPostRequestParams (optional)No description

Returns

  • Observable<HTTPEvent<T>> — An observable that emits the network response.
Source: @univerjs/network

Actions & Operations

delete

Send DELETE request to the server.

Signature

delete<T>(url: string, params?: IRequestParams): Promise<HTTPResponse<T>>

Parameters

  • url stringNo description
  • params IRequestParams (optional)No description

Returns

  • Promise<HTTPResponse<T>> — Network response
Source: @univerjs/network

Miscellaneous

patch

Send PATCH request to the server.

Signature

patch<T>(url: string, params?: IPostRequestParams): Promise<HTTPResponse<T>>

Parameters

  • url stringNo description
  • params IPostRequestParams (optional)No description

Returns

  • Promise<HTTPResponse<T>> — Network response
Source: @univerjs/network

post

Send a POST request to the server.

Signature

post<T>(url: string, params?: IPostRequestParams): Promise<HTTPResponse<T>>

Parameters

  • url stringNo description
  • params IPostRequestParams (optional)No description

Returns

  • Promise<HTTPResponse<T>> — Network response.
Source: @univerjs/network

put

Send a PUT request to the server.

Signature

put<T>(url: string, params?: IPostRequestParams): Promise<HTTPResponse<T>>

Parameters

  • url stringNo description
  • params IPostRequestParams (optional)No description

Returns

  • Promise<HTTPResponse<T>> — Network response
Source: @univerjs/network