@sapphire/fetch 2.4.1 → 2.4.2-next.009d3d2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,266 +0,0 @@
1
- /**
2
- * The supported return types for the `fetch` method
3
- */
4
- export declare enum FetchResultTypes {
5
- /**
6
- * Returns only the body, as JSON. Similar to [`Body.json()`](https://developer.mozilla.org/en-US/docs/Web/API/Body/json).
7
- *
8
- * You should provide your own type cast (either through the generic return type, or with `as <type>`) to the response to define
9
- * the JSON structure, otherwise the result will be `unknown`.
10
- */
11
- JSON = "json",
12
- /**
13
- * Returns only the body, as a [Buffer](https://nodejs.org/api/buffer.html).
14
- * @remark Does not work in a Browser environment. For browsers use {@link FetchResultTypes.Blob} instead.
15
- * If you use this type in a Browsers environment a {@link ReferenceError `ReferenceError: Buffer is not defined`} will be thrown!
16
- */
17
- Buffer = "buffer",
18
- /**
19
- * Returns only the body, as a [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob).
20
- * @remark For NodeJS environment other `FetchResultTypes` are recommended, but you can use a Blob if you want to.
21
- */
22
- Blob = "blob",
23
- /**
24
- * Returns only the body, as plain text. Similar to [`Body.text()`](https://developer.mozilla.org/en-US/docs/Web/API/Body/text).
25
- */
26
- Text = "text",
27
- /**
28
- * Returns the entire response and doesn't parse the `body` in any way.
29
- */
30
- Result = "result"
31
- }
32
- /**
33
- * The list of [HTTP Methods](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods)
34
- */
35
- export declare enum FetchMethods {
36
- /**
37
- * The `GET` method requests a representation of the specified resource. Requests using `GET` should only retrieve data.
38
- * @see [MDN / Web / HTTP / Methods / GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET)
39
- */
40
- Get = "GET",
41
- /**
42
- * The `HEAD` method asks for a response identical to that of a {@link FetchMethods.Get `GET`} request, but without the response body.
43
- * @see [MDN / Web / HTTP / Methods / HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD)
44
- */
45
- Head = "HEAD",
46
- /**
47
- * The `POST` method is used to submit an entity to the specified resource, often causing a change in state or side effects on the server.
48
- * @see [MDN / Web / HTTP / Methods / POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST)
49
- */
50
- Post = "POST",
51
- /**
52
- * The `PUT` method replaces all current representations of the target resource with the request payload.
53
- * @see [MDN / Web / HTTP / Methods / PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT)
54
- */
55
- Put = "PUT",
56
- /**
57
- * The `DELETE` method deletes the specified resource.
58
- * @see [MDN / Web / HTTP / Methods / DELETE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE)
59
- */
60
- Delete = "DELETE",
61
- /**
62
- * The `CONNECT` method establishes a tunnel to the server identified by the target resource
63
- * @see [MDN / Web / HTTP / Methods / CONNECT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/CONNECT)
64
- */
65
- Connect = "CONNECT",
66
- /**
67
- * The `OPTIONS` method is used to describe the communication options for the target resource.
68
- * @see [MDN / Web / HTTP / Methods / OPTIONS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS)
69
- */
70
- Options = "OPTIONS",
71
- /**
72
- * The `TRACE` method performs a message loop-back test along the path to the target resource.
73
- * @see [MDN / Web / HTTP / Methods / TRACE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/TRACE)
74
- */
75
- Trace = "TRACE",
76
- /**
77
- * The `PATCH` method is used to apply partial modifications to a resource.
78
- * @see [MDN / Web / HTTP / Methods / PATCH](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH)
79
- */
80
- Patch = "PATCH"
81
- }
82
- /**
83
- * A list of common [Media Content Types](https://www.iana.org/assignments/media-types/media-types.xhtml) as defined by the [IANA](https://www.iana.org/).
84
- * Media Content Types are also known as a Multipurpose Internet Mail Extensions or MIME type
85
- * Media Content Types are defined and standardized in IETF's [RFC 6838](https://datatracker.ietf.org/doc/html/rfc6838).
86
- */
87
- export declare enum FetchMediaContentTypes {
88
- /**
89
- * The `audio/aac` media content type.
90
- * @see [Media-Types / audio / aac](https://www.iana.org/assignments/media-types/audio/aac)
91
- */
92
- AudioAac = "audio/aac",
93
- /**
94
- * The `audio/mp4` media content type.
95
- * @see [Media-Types / audio / mp4](https://www.iana.org/assignments/media-types/audio/mp4)
96
- * @see [[RFC4337](https://www.iana.org/go/rfc4337)] [[RFC6381](https://www.iana.org/go/rfc6381)]
97
- */
98
- AudioMp4 = "audio/mp4",
99
- /**
100
- * The `audio/mpeg` media content type.
101
- * @see [Media-Types / audio / mpeg](https://www.iana.org/assignments/media-types/audio/mpeg)
102
- * @see [[RFC3003](https://www.iana.org/go/rfc3003)]
103
- */
104
- AudioMpeg = "audio/mpeg",
105
- /**
106
- * The `audio/ogg` media content type.
107
- * @see [Media-Types / audio / ogg](https://www.iana.org/assignments/media-types/audio/ogg)
108
- * @see [[RFC5334](https://www.iana.org/go/rfc5334)] [[RFC7845](https://www.iana.org/go/rfc7845)]
109
- */
110
- AudioOgg = "audio/ogg",
111
- /**
112
- * The `audio/opus` media content type.
113
- * @see [Media-Types / audio / opus](https://www.iana.org/assignments/media-types/audio/opus)
114
- * @see [[RFC7587](https://www.iana.org/go/rfc7587)]
115
- */
116
- AudioOpus = "audio/opus",
117
- /**
118
- * The `audio/vorbis` media content type.
119
- * @see [Media-Types / audio / vorbis](https://www.iana.org/assignments/media-types/audio/vorbis)
120
- * @see [[RFC5215](https://www.iana.org/go/rfc5215)]
121
- */
122
- AudioVorbis = "audio/vorbis",
123
- /**
124
- * The `audio/wav` media content type.
125
- */
126
- AudioWav = "audio/wav",
127
- /**
128
- * The `audio/webm` media content type.
129
- */
130
- AudioWebm = "audio/webm",
131
- /**
132
- * The `font/otf` media content type.
133
- * @see [Media-Types / font / otf](https://www.iana.org/assignments/media-types/font/otf)
134
- * @see [[RFC8081](https://www.iana.org/go/rfc8081)]
135
- */
136
- FontOtf = "font/otf",
137
- /**
138
- * The `font/ttf` media content type.
139
- * @see [Media-Types / font / ttf](https://www.iana.org/assignments/media-types/font/ttf)
140
- * @see [[RFC8081](https://www.iana.org/go/rfc8081)]
141
- */
142
- FontTtf = "font/ttf",
143
- /**
144
- * The `font/woff` media content type.
145
- * @see [Media-Types / font / woff](https://www.iana.org/assignments/media-types/font/woff)
146
- * @see [[RFC8081](https://www.iana.org/go/rfc8081)]
147
- */
148
- FontWoff = "font/woff",
149
- /**
150
- * The `font/woff2` media content type.
151
- * @see [Media-Types / font / woff2](https://www.iana.org/assignments/media-types/font/woff2)
152
- * @see [[RFC8081](https://www.iana.org/go/rfc8081)]
153
- */
154
- FontWoff2 = "font/woff2",
155
- /**
156
- * The `multipart/form-data` media content type.
157
- * @see [Media-Types / multipart / form-data](https://www.iana.org/assignments/media-types/multipart/form-data)
158
- * @see [[RFC7578](https://www.iana.org/go/rfc7578)]
159
- */
160
- FormData = "multipart/form-data",
161
- /**
162
- * The `x-www-form-urlencoded` media content type.
163
- * @see [Media-Types / application / x-www-form-urlencoded](https://www.iana.org/assignments/media-types/application/x-www-form-urlencoded)
164
- */
165
- FormURLEncoded = "application/x-www-form-urlencoded",
166
- /**
167
- * The `image/apng` media content type.
168
- * @see [Media-Types / image / apng](https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types#apng_animated_portable_network_graphics)
169
- */
170
- ImageAPNG = "image/apng",
171
- /**
172
- * The `image/gif` media content type.
173
- * @see [Media-Types / image / gif](https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types#gif_graphics_interchange_format)
174
- * @see [[RFC2045](https://www.iana.org/go/rfc2045)] [[RFC2046](https://www.iana.org/go/rfc2046)]
175
- */
176
- ImageGIF = "image/gif",
177
- /**
178
- * The `image/jpeg` media content type.
179
- * @see [Media-Types / image / jpeg](https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types#jpeg_joint_photographic_experts_group_image)
180
- * @see [[RFC2045](https://www.iana.org/go/rfc2045)] [[RFC2046](https://www.iana.org/go/rfc2046)]
181
- */
182
- ImageJPEG = "image/jpeg",
183
- /**
184
- * The `image/png` media content type.
185
- * @see [Media-Types / image / png](https://www.iana.org/assignments/media-types/image/png)
186
- */
187
- ImagePNG = "image/png",
188
- /**
189
- * The `image/webp` media content type.
190
- * @see [Media-Types / image / webp](https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types#webp_image)
191
- */
192
- ImageWEBP = "image/webp",
193
- /**
194
- * The `application/json` media content type.
195
- * @see [Media-Types / application / json](https://www.iana.org/assignments/media-types/application/json)
196
- * @see [[RFC8259](https://www.iana.org/go/rfc8259)]
197
- */
198
- JSON = "application/json",
199
- /**
200
- * The `application/javascript` media content type.
201
- * @see [Media-Types / application / javascript](https://www.iana.org/assignments/media-types/application/javascript)
202
- * @see [[RFC4329](https://www.iana.org/go/rfc4329)]
203
- */
204
- JavaScript = "application/javascript",
205
- /**
206
- * The `application/octet-stream` media content type.
207
- * @see [Media-Types / application / octet-stream](https://www.iana.org/assignments/media-types/application/octet-stream)
208
- * @see [[RFC2045](https://www.iana.org/go/rfc2045)] [[RFC2046(https://www.iana.org/go/rfc2046)]
209
- */
210
- OctetStream = "application/octet-stream",
211
- /**
212
- * The `text/css` media content type.
213
- * @see [Media-Types / text / css](https://www.iana.org/assignments/media-types/text/css)
214
- * @see [[RFC2318](https://www.iana.org/go/rfc2318)]
215
- */
216
- TextCSS = "text/css",
217
- /**
218
- * The `text/HTML` media content type.
219
- * @see [Media-Types / text / html](https://www.iana.org/assignments/media-types/text/html)
220
- */
221
- TextHTML = "text/html",
222
- /**
223
- * The `text/plain` media content type.
224
- * @see [Media-Types / text / plain](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#textplain)
225
- * @see [[RFC2046](https://www.iana.org/go/rfc2046)] [[RFC3676](https://www.iana.org/go/rfc3676)] [[RFC5147](https://www.iana.org/go/rfc5147)]
226
- */
227
- TextPlain = "text/plain",
228
- /**
229
- * The `video/h264` media content type.
230
- * @see [Media-Types / video / h264](https://www.iana.org/assignments/media-types/video/H264)
231
- * @see [[RFC6184](https://www.iana.org/go/rfc6184)]
232
- */
233
- VideoH264 = "video/h264",
234
- /**
235
- * The `video/h265` media content type.
236
- * @see [Media-Types / video / h265](https://www.iana.org/assignments/media-types/video/H265)
237
- * @see [[RFC7798](https://www.iana.org/go/rfc7798)]
238
- */
239
- VideoH265 = "video/h265",
240
- /**
241
- * The `video/mp4` media content type.
242
- * @see [Media-Types / video / mp4](https://www.iana.org/assignments/media-types/video/mp4)
243
- * @see [[RFC4337](https://www.iana.org/go/rfc4337)] [[RFC6381](https://www.iana.org/go/rfc6381)]
244
- */
245
- VideoMp4 = "video/mp4",
246
- /**
247
- * The `video/ogg` media content type.
248
- * @see [Media-Types / video / ogg](https://www.iana.org/assignments/media-types/video/ogg)
249
- * @see [[RFC5334](https://www.iana.org/go/rfc5334)] [[RFC7845](https://www.iana.org/go/rfc7845)]
250
- */
251
- VideoOgg = "video/ogg",
252
- /**
253
- * The `video/webm` media content type.
254
- */
255
- VideoWebm = "video/webm",
256
- /**
257
- * The `application/xml` media content type.
258
- * @see [Media-Types / application / xml](https://www.iana.org/assignments/media-types/application/xml)
259
- * @see [[RFC7303](https://www.iana.org/go/rfc7303)]
260
- */
261
- XML = "application/xml"
262
- }
263
- export interface RequestOptions extends Omit<RequestInit, 'body'> {
264
- body?: BodyInit | Record<any, any>;
265
- }
266
- //# sourceMappingURL=types.d.ts.map