Skip to content

Commit f5a8f96

Browse files
author
jarvisjiang
committed
update docs
1 parent 61346c9 commit f5a8f96

File tree

9 files changed

+41
-40
lines changed

9 files changed

+41
-40
lines changed

docs/classes/FetchError.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ new FetchError(message, status): FetchError
3737

3838
#### Defined in
3939

40-
[defines.ts:100](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/defines.ts#L100)
40+
[defines.ts:100](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/defines.ts#L100)
4141

4242
## Properties
4343

4444
| Property | Type | Default value | Description | Overrides | Defined in |
4545
| ------ | ------ | ------ | ------ | ------ | ------ |
46-
| `name` | `string` | `'FetchError'` | The name of the error. | `Error.name` | [defines.ts:94](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/defines.ts#L94) |
47-
| `status` | `number` | `0` | The status code of the response. | - | [defines.ts:98](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/defines.ts#L98) |
46+
| `name` | `string` | `'FetchError'` | The name of the error. | `Error.name` | [defines.ts:94](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/defines.ts#L94) |
47+
| `status` | `number` | `0` | The status code of the response. | - | [defines.ts:98](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/defines.ts#L98) |

docs/functions/fetchT.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Additional options for the fetch operation, including custom `FetchInit` propert
5757

5858
### Defined in
5959

60-
[fetch.ts:14](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/fetch.ts#L14)
60+
[fetch.ts:14](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/fetch.ts#L14)
6161

6262
## fetchT(url, init)
6363

@@ -96,7 +96,7 @@ Additional options for the fetch operation, including custom `FetchInit` propert
9696

9797
### Defined in
9898

99-
[fetch.ts:26](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/fetch.ts#L26)
99+
[fetch.ts:26](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/fetch.ts#L26)
100100

101101
## fetchT(url, init)
102102

@@ -135,7 +135,7 @@ Additional options for the fetch operation, including custom `FetchInit` propert
135135

136136
### Defined in
137137

138-
[fetch.ts:38](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/fetch.ts#L38)
138+
[fetch.ts:38](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/fetch.ts#L38)
139139

140140
## fetchT(url, init)
141141

@@ -180,12 +180,12 @@ Additional options for the fetch operation, including custom `FetchInit` propert
180180

181181
### Defined in
182182

183-
[fetch.ts:51](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/fetch.ts#L51)
183+
[fetch.ts:51](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/fetch.ts#L51)
184184

185185
## fetchT(url, init)
186186

187187
```ts
188-
function fetchT(url, init): FetchResponse<string>
188+
function fetchT(url, init): FetchResponse<string, Error>
189189
```
190190

191191
Fetches a resource from the network as a text string and returns a `FetchResponse` representing the operation.
@@ -199,7 +199,7 @@ Fetches a resource from the network as a text string and returns a `FetchRespons
199199

200200
### Returns
201201

202-
[`FetchResponse`](../type-aliases/FetchResponse.md)\<`string`\>
202+
[`FetchResponse`](../type-aliases/FetchResponse.md)\<`string`, `Error`\>
203203

204204
A `FetchTask` or `FetchResponse` depending on the provided options in `init`.
205205

@@ -219,12 +219,12 @@ Additional options for the fetch operation, including custom `FetchInit` propert
219219

220220
### Defined in
221221

222-
[fetch.ts:63](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/fetch.ts#L63)
222+
[fetch.ts:63](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/fetch.ts#L63)
223223

224224
## fetchT(url, init)
225225

226226
```ts
227-
function fetchT(url, init): FetchResponse<ArrayBuffer>
227+
function fetchT(url, init): FetchResponse<ArrayBuffer, Error>
228228
```
229229

230230
Fetches a resource from the network as an ArrayBuffer and returns a `FetchResponse` representing the operation.
@@ -238,7 +238,7 @@ Fetches a resource from the network as an ArrayBuffer and returns a `FetchRespon
238238

239239
### Returns
240240

241-
[`FetchResponse`](../type-aliases/FetchResponse.md)\<`ArrayBuffer`\>
241+
[`FetchResponse`](../type-aliases/FetchResponse.md)\<`ArrayBuffer`, `Error`\>
242242

243243
A `FetchTask` or `FetchResponse` depending on the provided options in `init`.
244244

@@ -258,12 +258,12 @@ Additional options for the fetch operation, including custom `FetchInit` propert
258258

259259
### Defined in
260260

261-
[fetch.ts:74](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/fetch.ts#L74)
261+
[fetch.ts:74](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/fetch.ts#L74)
262262

263263
## fetchT(url, init)
264264

265265
```ts
266-
function fetchT(url, init): FetchResponse<Blob>
266+
function fetchT(url, init): FetchResponse<Blob, Error>
267267
```
268268

269269
Fetches a resource from the network as a Blob and returns a `FetchResponse` representing the operation.
@@ -277,7 +277,7 @@ Fetches a resource from the network as a Blob and returns a `FetchResponse` repr
277277

278278
### Returns
279279

280-
[`FetchResponse`](../type-aliases/FetchResponse.md)\<`Blob`\>
280+
[`FetchResponse`](../type-aliases/FetchResponse.md)\<`Blob`, `Error`\>
281281

282282
A `FetchTask` or `FetchResponse` depending on the provided options in `init`.
283283

@@ -297,12 +297,12 @@ Additional options for the fetch operation, including custom `FetchInit` propert
297297

298298
### Defined in
299299

300-
[fetch.ts:85](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/fetch.ts#L85)
300+
[fetch.ts:85](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/fetch.ts#L85)
301301

302302
## fetchT(url, init)
303303

304304
```ts
305-
function fetchT<T>(url, init): FetchResponse<T>
305+
function fetchT<T>(url, init): FetchResponse<T, Error>
306306
```
307307

308308
Fetches a resource from the network and parses it as JSON, returning a `FetchResponse` representing the operation.
@@ -322,7 +322,7 @@ Fetches a resource from the network and parses it as JSON, returning a `FetchRes
322322

323323
### Returns
324324

325-
[`FetchResponse`](../type-aliases/FetchResponse.md)\<`T`\>
325+
[`FetchResponse`](../type-aliases/FetchResponse.md)\<`T`, `Error`\>
326326

327327
A `FetchTask` or `FetchResponse` depending on the provided options in `init`.
328328

@@ -342,7 +342,7 @@ Additional options for the fetch operation, including custom `FetchInit` propert
342342

343343
### Defined in
344344

345-
[fetch.ts:97](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/fetch.ts#L97)
345+
[fetch.ts:97](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/fetch.ts#L97)
346346

347347
## fetchT(url, init)
348348

@@ -381,7 +381,7 @@ Additional options for the fetch operation, including custom `FetchInit` propert
381381

382382
### Defined in
383383

384-
[fetch.ts:108](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/fetch.ts#L108)
384+
[fetch.ts:108](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/fetch.ts#L108)
385385

386386
## fetchT(url, init)
387387

@@ -420,4 +420,4 @@ Additional options for the fetch operation, including custom `FetchInit` propert
420420

421421
### Defined in
422422

423-
[fetch.ts:120](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/fetch.ts#L120)
423+
[fetch.ts:120](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/fetch.ts#L120)

docs/interfaces/FetchInit.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Extends the standard `RequestInit` interface from the Fetch API to include addit
1616

1717
| Property | Type | Description | Defined in |
1818
| ------ | ------ | ------ | ------ |
19-
| `abortable?` | `boolean` | Indicates whether the fetch request should be abortable. | [defines.ts:62](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/defines.ts#L62) |
20-
| `onChunk?` | (`chunk`: `Uint8Array`) => `void` | Specifies a function to be called when the fetch request receives a chunk of data. | [defines.ts:84](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/defines.ts#L84) |
21-
| `onProgress?` | (`progressResult`: `IOResult`\<[`FetchProgress`](FetchProgress.md)\>) => `void` | Specifies a function to be called when the fetch request makes progress. | [defines.ts:78](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/defines.ts#L78) |
22-
| `responseType?` | [`FetchResponseType`](../type-aliases/FetchResponseType.md) | Specifies the expected response type of the fetch request. | [defines.ts:67](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/defines.ts#L67) |
23-
| `timeout?` | `number` | Specifies the maximum time in milliseconds to wait for the fetch request to complete. | [defines.ts:72](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/defines.ts#L72) |
19+
| `abortable?` | `boolean` | Indicates whether the fetch request should be abortable. | [defines.ts:62](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/defines.ts#L62) |
20+
| `onChunk?` | (`chunk`: `Uint8Array`) => `void` | Specifies a function to be called when the fetch request receives a chunk of data. | [defines.ts:84](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/defines.ts#L84) |
21+
| `onProgress?` | (`progressResult`: `IOResult`\<[`FetchProgress`](FetchProgress.md)\>) => `void` | Specifies a function to be called when the fetch request makes progress. | [defines.ts:78](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/defines.ts#L78) |
22+
| `responseType?` | [`FetchResponseType`](../type-aliases/FetchResponseType.md) | Specifies the expected response type of the fetch request. | [defines.ts:67](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/defines.ts#L67) |
23+
| `timeout?` | `number` | Specifies the maximum time in milliseconds to wait for the fetch request to complete. | [defines.ts:72](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/defines.ts#L72) |

docs/interfaces/FetchProgress.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ Represents the progress of a fetch operation.
1212

1313
| Property | Type | Description | Defined in |
1414
| ------ | ------ | ------ | ------ |
15-
| `completedByteLength` | `number` | The number of bytes received so far. | [defines.ts:52](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/defines.ts#L52) |
16-
| `totalByteLength` | `number` | The total number of bytes to be received. | [defines.ts:47](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/defines.ts#L47) |
15+
| `completedByteLength` | `number` | The number of bytes received so far. | [defines.ts:52](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/defines.ts#L52) |
16+
| `totalByteLength` | `number` | The total number of bytes to be received. | [defines.ts:47](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/defines.ts#L47) |

docs/interfaces/FetchTask.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Defines the structure and behavior of a fetch task, including the ability to abo
1818

1919
| Property | Modifier | Type | Description | Defined in |
2020
| ------ | ------ | ------ | ------ | ------ |
21-
| `aborted` | `readonly` | `boolean` | Indicates whether the fetch task has been aborted. | [defines.ts:27](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/defines.ts#L27) |
22-
| `response` | `readonly` | [`FetchResponse`](../type-aliases/FetchResponse.md)\<`T`\> | The response of the fetch task, represented as an `AsyncResult`. | [defines.ts:32](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/defines.ts#L32) |
21+
| `aborted` | `readonly` | `boolean` | Indicates whether the fetch task has been aborted. | [defines.ts:27](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/defines.ts#L27) |
22+
| `response` | `readonly` | [`FetchResponse`](../type-aliases/FetchResponse.md)\<`T`, `any`\> | The response of the fetch task, represented as an `AsyncResult`. | [defines.ts:32](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/defines.ts#L32) |
2323

2424
## Methods
2525

@@ -43,4 +43,4 @@ Aborts the fetch task, optionally with a reason for the abortion.
4343
4444
#### Defined in
4545
46-
[defines.ts:22](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/defines.ts#L22)
46+
[defines.ts:22](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/defines.ts#L22)

docs/type-aliases/FetchResponse.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@
44

55
[@happy-ts/fetch-t](../README.md) / FetchResponse
66

7-
# Type Alias: FetchResponse\<T\>
7+
# Type Alias: FetchResponse\<T, E\>
88

99
```ts
10-
type FetchResponse<T>: AsyncResult<T, any>;
10+
type FetchResponse<T, E>: AsyncResult<T, E>;
1111
```
1212

1313
Represents the response of a fetch operation, encapsulating the result data or any error that occurred.
1414

1515
## Type Parameters
1616

17-
| Type Parameter | Description |
18-
| ------ | ------ |
19-
| `T` | The type of the data expected in the response. |
17+
| Type Parameter | Default type | Description |
18+
| ------ | ------ | ------ |
19+
| `T` | - | The type of the data expected in the response. |
20+
| `E` | `any` | - |
2021

2122
## Defined in
2223

23-
[defines.ts:9](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/defines.ts#L9)
24+
[defines.ts:9](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/defines.ts#L9)

docs/type-aliases/FetchResponseType.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ Specifies the expected response type of the fetch request.
1414

1515
## Defined in
1616

17-
[defines.ts:38](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/defines.ts#L38)
17+
[defines.ts:38](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/defines.ts#L38)

docs/variables/ABORT_ERROR.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ Name of abort error;
1414

1515
## Defined in
1616

17-
[constants.ts:4](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/constants.ts#L4)
17+
[constants.ts:4](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/constants.ts#L4)

docs/variables/TIMEOUT_ERROR.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ Name of timeout error;
1414

1515
## Defined in
1616

17-
[constants.ts:9](https://github.com/JiangJie/fetch-t/blob/2e206031a806329279bb68d7ae74aa44f812eb58/src/fetch/constants.ts#L9)
17+
[constants.ts:9](https://github.com/JiangJie/fetch-t/blob/61346c95bab5342bcbd9e97bca747ef24af2eac6/src/fetch/constants.ts#L9)

0 commit comments

Comments
 (0)