# Network

- Human documentation: [https://docs.univer.ai/reference/facade/network](https://docs.univer.ai/reference/facade/network)

- Agent Markdown: [https://docs.univer.ai/reference/facade/network.md](https://docs.univer.ai/reference/facade/network.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

- Source: [facade/network.mdx](https://github.com/dream-num/documentation/blob/dev/content/reference/facade/network.mdx)

---

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

## Overview

### @univerjs/network

| Method              | Description                                |
| ------------------- | ------------------------------------------ |
| [`delete`](#delete) | Send DELETE request to the server          |
| [`get`](#get)       | Send a GET request to the server           |
| [`getSSE`](#getsse) | Request for a stream of server-sent events |
| [`patch`](#patch)   | Send PATCH request to the server           |
| [`post`](#post)     | Send a POST request to the server          |
| [`put`](#put)       | Send a PUT request to the server           |

## APIs

### Getters & Queries

### `get`

Send a GET request to the server.

**Signature**

```typescript
get<T>(url: string, params?: IRequestParams): Promise<HTTPResponse<T>>
```

**Parameters**

* `url` `string` — *No 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`](https://rxjs.dev/guide/observable) which you can call `subscribe` on.

**Signature**

```typescript
getSSE<T>(method: HTTPRequestMethod, url: string, params?: IPostRequestParams): Observable<HTTPEvent<T>>
```

**Parameters**

* `method` `HTTPRequestMethod` — *No description*
* `url` `string` — *No 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**

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

**Parameters**

* `url` `string` — *No description*
* `params` `IRequestParams` *(optional)* — *No description*

**Returns**

* `Promise<HTTPResponse<T>>` — Network response

Source: 

`@univerjs/network`

### Miscellaneous

### `patch`

Send PATCH request to the server.

**Signature**

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

**Parameters**

* `url` `string` — *No description*
* `params` `IPostRequestParams` *(optional)* — *No description*

**Returns**

* `Promise<HTTPResponse<T>>` — Network response

Source: 

`@univerjs/network`

### `post`

Send a POST request to the server.

**Signature**

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

**Parameters**

* `url` `string` — *No description*
* `params` `IPostRequestParams` *(optional)* — *No description*

**Returns**

* `Promise<HTTPResponse<T>>` — Network response.

Source: 

`@univerjs/network`

### `put`

Send a PUT request to the server.

**Signature**

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

**Parameters**

* `url` `string` — *No description*
* `params` `IPostRequestParams` *(optional)* — *No description*

**Returns**

* `Promise<HTTPResponse<T>>` — Network response

Source: 

`@univerjs/network`
