Skip to content

Commit 23ffeea

Browse files
committed
refactor: expose responselike interface
1 parent ebd91ad commit 23ffeea

File tree

5 files changed

+42
-5
lines changed

5 files changed

+42
-5
lines changed

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ graphql-http
1717
- [RequestHeaders](interfaces/RequestHeaders.md)
1818
- [RequestParams](interfaces/RequestParams.md)
1919
- [ResponseInit](interfaces/ResponseInit.md)
20+
- [ResponseLike](interfaces/ResponseLike.md)
2021
- [Sink](interfaces/Sink.md)
2122

2223
### Type Aliases

docs/classes/NetworkError.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ you should supply the `Response` generic depending on your Fetch implementation.
1111

1212
| Name | Type |
1313
| :------ | :------ |
14-
| `Response` | extends `ResponseLike` = `ResponseLike` |
14+
| `Response` | extends [`ResponseLike`](../interfaces/ResponseLike.md) = [`ResponseLike`](../interfaces/ResponseLike.md) |
1515

1616
## Hierarchy
1717

@@ -39,7 +39,7 @@ you should supply the `Response` generic depending on your Fetch implementation.
3939

4040
| Name | Type |
4141
| :------ | :------ |
42-
| `Response` | extends `ResponseLike` = `ResponseLike` |
42+
| `Response` | extends [`ResponseLike`](../interfaces/ResponseLike.md) = [`ResponseLike`](../interfaces/ResponseLike.md) |
4343

4444
#### Parameters
4545

docs/interfaces/ClientOptions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ ___
114114

115115
### shouldRetry
116116

117-
`Optional` **shouldRetry**: (`err`: [`NetworkError`](../classes/NetworkError.md)<`ResponseLike`\>, `retries`: `number`) => `Promise`<`boolean`\>
117+
`Optional` **shouldRetry**: (`err`: [`NetworkError`](../classes/NetworkError.md)<[`ResponseLike`](ResponseLike.md)\>, `retries`: `number`) => `Promise`<`boolean`\>
118118

119119
#### Type declaration
120120

@@ -143,7 +143,7 @@ the `err` argument, will report it instead.
143143

144144
| Name | Type |
145145
| :------ | :------ |
146-
| `err` | [`NetworkError`](../classes/NetworkError.md)<`ResponseLike`\> |
146+
| `err` | [`NetworkError`](../classes/NetworkError.md)<[`ResponseLike`](ResponseLike.md)\> |
147147
| `retries` | `number` |
148148

149149
##### Returns

docs/interfaces/ResponseLike.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[graphql-http](../README.md) / ResponseLike
2+
3+
# Interface: ResponseLike
4+
5+
Concrete interface a response needs to implement for the client.
6+
7+
## Table of contents
8+
9+
### Properties
10+
11+
- [ok](ResponseLike.md#ok)
12+
- [status](ResponseLike.md#status)
13+
- [statusText](ResponseLike.md#statustext)
14+
15+
## Properties
16+
17+
### ok
18+
19+
`Readonly` **ok**: `boolean`
20+
21+
___
22+
23+
### status
24+
25+
`Readonly` **status**: `number`
26+
27+
___
28+
29+
### statusText
30+
31+
`Readonly` **statusText**: `string`

src/client.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,12 @@ export class NetworkError<
329329
}
330330
}
331331

332-
interface ResponseLike {
332+
/**
333+
* Concrete interface a response needs to implement for the client.
334+
*
335+
* @category Client
336+
*/
337+
export interface ResponseLike {
333338
readonly ok: boolean;
334339
readonly status: number;
335340
readonly statusText: string;

0 commit comments

Comments
 (0)