@effect/platform 0.11.0 → 0.11.2

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.
Files changed (113) hide show
  1. package/Http/Body.d.ts +129 -0
  2. package/Http/Body.d.ts.map +1 -0
  3. package/Http/Body.js +70 -0
  4. package/Http/Body.js.map +1 -0
  5. package/Http/Client.d.ts +213 -0
  6. package/Http/Client.d.ts.map +1 -0
  7. package/Http/Client.js +124 -0
  8. package/Http/Client.js.map +1 -0
  9. package/Http/ClientError.d.ts +70 -0
  10. package/Http/ClientError.d.ts.map +1 -0
  11. package/Http/ClientError.js +28 -0
  12. package/Http/ClientError.js.map +1 -0
  13. package/Http/ClientRequest.d.ts +282 -0
  14. package/Http/ClientRequest.d.ts.map +1 -0
  15. package/Http/ClientRequest.js +202 -0
  16. package/Http/ClientRequest.js.map +1 -0
  17. package/Http/ClientResponse.d.ts +36 -0
  18. package/Http/ClientResponse.d.ts.map +1 -0
  19. package/Http/ClientResponse.js +29 -0
  20. package/Http/ClientResponse.js.map +1 -0
  21. package/Http/FormData.d.ts +56 -0
  22. package/Http/FormData.d.ts.map +1 -0
  23. package/Http/FormData.js +13 -0
  24. package/Http/FormData.js.map +1 -0
  25. package/Http/Headers.d.ts +38 -0
  26. package/Http/Headers.d.ts.map +1 -0
  27. package/Http/Headers.js +54 -0
  28. package/Http/Headers.js.map +1 -0
  29. package/Http/IncomingMessage.d.ts +37 -0
  30. package/Http/IncomingMessage.d.ts.map +1 -0
  31. package/Http/IncomingMessage.js +30 -0
  32. package/Http/IncomingMessage.js.map +1 -0
  33. package/Http/Method.d.ts +10 -0
  34. package/Http/Method.d.ts.map +1 -0
  35. package/Http/Method.js +12 -0
  36. package/Http/Method.js.map +1 -0
  37. package/Http/UrlParams.d.ts +56 -0
  38. package/Http/UrlParams.d.ts.map +1 -0
  39. package/Http/UrlParams.js +74 -0
  40. package/Http/UrlParams.js.map +1 -0
  41. package/HttpClient.d.ts +32 -0
  42. package/HttpClient.d.ts.map +1 -0
  43. package/HttpClient.js +23 -0
  44. package/HttpClient.js.map +1 -0
  45. package/internal/http/body.d.ts +2 -0
  46. package/internal/http/body.d.ts.map +1 -0
  47. package/internal/http/body.js +101 -0
  48. package/internal/http/body.js.map +1 -0
  49. package/internal/http/client.d.ts +3 -0
  50. package/internal/http/client.d.ts.map +1 -0
  51. package/internal/http/client.js +147 -0
  52. package/internal/http/client.js.map +1 -0
  53. package/internal/http/clientError.d.ts +2 -0
  54. package/internal/http/clientError.d.ts.map +1 -0
  55. package/internal/http/clientError.js +24 -0
  56. package/internal/http/clientError.js.map +1 -0
  57. package/internal/http/clientRequest.d.ts +2 -0
  58. package/internal/http/clientRequest.d.ts.map +1 -0
  59. package/internal/http/clientRequest.js +180 -0
  60. package/internal/http/clientRequest.js.map +1 -0
  61. package/internal/http/clientResponse.d.ts +2 -0
  62. package/internal/http/clientResponse.d.ts.map +1 -0
  63. package/internal/http/clientResponse.js +101 -0
  64. package/internal/http/clientResponse.js.map +1 -0
  65. package/mjs/Http/Body.mjs +52 -0
  66. package/mjs/Http/Body.mjs.map +1 -0
  67. package/mjs/Http/Client.mjs +97 -0
  68. package/mjs/Http/Client.mjs.map +1 -0
  69. package/mjs/Http/ClientError.mjs +17 -0
  70. package/mjs/Http/ClientError.mjs.map +1 -0
  71. package/mjs/Http/ClientRequest.mjs +162 -0
  72. package/mjs/Http/ClientRequest.mjs.map +1 -0
  73. package/mjs/Http/ClientResponse.mjs +18 -0
  74. package/mjs/Http/ClientResponse.mjs.map +1 -0
  75. package/mjs/Http/FormData.mjs +6 -0
  76. package/mjs/Http/FormData.mjs.map +1 -0
  77. package/mjs/Http/Headers.mjs +40 -0
  78. package/mjs/Http/Headers.mjs.map +1 -0
  79. package/mjs/Http/IncomingMessage.mjs +19 -0
  80. package/mjs/Http/IncomingMessage.mjs.map +1 -0
  81. package/mjs/Http/Method.mjs +5 -0
  82. package/mjs/Http/Method.mjs.map +1 -0
  83. package/mjs/Http/UrlParams.mjs +57 -0
  84. package/mjs/Http/UrlParams.mjs.map +1 -0
  85. package/mjs/HttpClient.mjs +18 -0
  86. package/mjs/HttpClient.mjs.map +1 -0
  87. package/mjs/internal/http/body.mjs +83 -0
  88. package/mjs/internal/http/body.mjs.map +1 -0
  89. package/mjs/internal/http/client.mjs +120 -0
  90. package/mjs/internal/http/client.mjs.map +1 -0
  91. package/mjs/internal/http/clientError.mjs +13 -0
  92. package/mjs/internal/http/clientError.mjs.map +1 -0
  93. package/mjs/internal/http/clientRequest.mjs +138 -0
  94. package/mjs/internal/http/clientRequest.mjs.map +1 -0
  95. package/mjs/internal/http/clientResponse.mjs +91 -0
  96. package/mjs/internal/http/clientResponse.mjs.map +1 -0
  97. package/package.json +2 -1
  98. package/src/Http/Body.ts +148 -0
  99. package/src/Http/Client.ts +280 -0
  100. package/src/Http/ClientError.ts +80 -0
  101. package/src/Http/ClientRequest.ts +320 -0
  102. package/src/Http/ClientResponse.ts +42 -0
  103. package/src/Http/FormData.ts +61 -0
  104. package/src/Http/Headers.ts +69 -0
  105. package/src/Http/IncomingMessage.ts +45 -0
  106. package/src/Http/Method.ts +17 -0
  107. package/src/Http/UrlParams.ts +106 -0
  108. package/src/HttpClient.ts +32 -0
  109. package/src/internal/http/body.ts +113 -0
  110. package/src/internal/http/client.ts +437 -0
  111. package/src/internal/http/clientError.ts +20 -0
  112. package/src/internal/http/clientRequest.ts +371 -0
  113. package/src/internal/http/clientResponse.ts +114 -0
@@ -0,0 +1,280 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import type * as Context from "@effect/data/Context"
5
+ import type * as Predicate from "@effect/data/Predicate"
6
+ import type * as Effect from "@effect/io/Effect"
7
+ import type * as Layer from "@effect/io/Layer"
8
+ import type * as Schedule from "@effect/io/Schedule"
9
+ import type * as Error from "@effect/platform/Http/ClientError"
10
+ import type * as ClientRequest from "@effect/platform/Http/ClientRequest"
11
+ import type * as ClientResponse from "@effect/platform/Http/ClientResponse"
12
+ import * as internal from "@effect/platform/internal/http/client"
13
+ import type * as ParseResult from "@effect/schema/ParseResult"
14
+ import type * as Schema from "@effect/schema/Schema"
15
+
16
+ /**
17
+ * @since 1.0.0
18
+ * @category models
19
+ */
20
+ export interface Client<R, E, A> {
21
+ (request: ClientRequest.ClientRequest): Effect.Effect<R, E, A>
22
+ }
23
+
24
+ /**
25
+ * @since 1.0.0
26
+ */
27
+ export namespace Client {
28
+ /**
29
+ * @since 1.0.0
30
+ * @category models
31
+ */
32
+ export type WithResponse<R, E> = Client<R, E, ClientResponse.ClientResponse>
33
+
34
+ /**
35
+ * @since 1.0.0
36
+ * @category models
37
+ */
38
+ export type Default = WithResponse<never, Error.HttpClientError>
39
+ }
40
+
41
+ /**
42
+ * @since 1.0.0
43
+ * @category tags
44
+ */
45
+ export const Client: Context.Tag<Client.Default, Client.Default> = internal.tag
46
+
47
+ /**
48
+ * @since 1.0.0
49
+ * @category layers
50
+ */
51
+ export const fetchLayer: Layer.Layer<never, never, Client.Default> = internal.fetchLayer
52
+
53
+ /**
54
+ * @since 1.0.0
55
+ * @category constructors
56
+ */
57
+ export const fetch: (options?: RequestInit) => Client.Default = internal.fetch
58
+
59
+ /**
60
+ * @since 1.0.0
61
+ * @category constructors
62
+ */
63
+ export const fetchOk: (options?: RequestInit) => Client.Default = internal.fetchOk
64
+
65
+ /**
66
+ * @since 1.0.0
67
+ * @category error handling
68
+ */
69
+ export const catchAll: {
70
+ <E, R2, E2, A2>(f: (e: E) => Effect.Effect<R2, E2, A2>): <R, A>(self: Client<R, E, A>) => Client<R2 | R, E2, A2 | A>
71
+ <R, E, A, R2, E2, A2>(self: Client<R, E, A>, f: (e: E) => Effect.Effect<R2, E2, A2>): Client<R | R2, E2, A | A2>
72
+ } = internal.catchAll
73
+
74
+ /**
75
+ * @since 1.0.0
76
+ * @category error handling
77
+ */
78
+ export const catchTag: {
79
+ <E extends { _tag: string }, K extends E["_tag"] & string, R1, E1, A1>(
80
+ tag: K,
81
+ f: (e: Extract<E, { _tag: K }>) => Effect.Effect<R1, E1, A1>
82
+ ): <R, A>(self: Client<R, E, A>) => Client<R1 | R, E1 | Exclude<E, { _tag: K }>, A1 | A>
83
+ <R, E extends { _tag: string }, A, K extends E["_tag"] & string, E1, R1, A1>(
84
+ self: Client<R, E, A>,
85
+ tag: K,
86
+ f: (e: Extract<E, { _tag: K }>) => Effect.Effect<R1, E1, A1>
87
+ ): Client<R | R1, E1 | Exclude<E, { _tag: K }>, A | A1>
88
+ } = internal.catchTag
89
+
90
+ /**
91
+ * @since 1.0.0
92
+ * @category error handling
93
+ */
94
+ export const catchTags: {
95
+ <
96
+ E extends { _tag: string },
97
+ Cases extends { [K in E["_tag"]]+?: ((error: Extract<E, { _tag: K }>) => Effect.Effect<any, any, any>) | undefined }
98
+ >(
99
+ cases: Cases
100
+ ): <R, A>(
101
+ self: Client<R, E, A>
102
+ ) => Client<
103
+ | R
104
+ | {
105
+ [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect.Effect<infer R, any, any> ? R : never
106
+ }[keyof Cases],
107
+ | Exclude<E, { _tag: keyof Cases }>
108
+ | {
109
+ [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect.Effect<any, infer E, any> ? E : never
110
+ }[keyof Cases],
111
+ | A
112
+ | {
113
+ [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect.Effect<any, any, infer A> ? A : never
114
+ }[keyof Cases]
115
+ >
116
+ <
117
+ R,
118
+ E extends { _tag: string },
119
+ A,
120
+ Cases extends { [K in E["_tag"]]+?: ((error: Extract<E, { _tag: K }>) => Effect.Effect<any, any, any>) | undefined }
121
+ >(
122
+ self: Client<R, E, A>,
123
+ cases: Cases
124
+ ): Client<
125
+ | R
126
+ | {
127
+ [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect.Effect<infer R, any, any> ? R : never
128
+ }[keyof Cases],
129
+ | Exclude<E, { _tag: keyof Cases }>
130
+ | {
131
+ [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect.Effect<any, infer E, any> ? E : never
132
+ }[keyof Cases],
133
+ | A
134
+ | {
135
+ [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect.Effect<any, any, infer A> ? A : never
136
+ }[keyof Cases]
137
+ >
138
+ } = internal.catchTags
139
+
140
+ /**
141
+ * @since 1.0.0
142
+ * @category filters
143
+ */
144
+ export const filterOrElse: {
145
+ <A, R2, E2, B>(
146
+ f: Predicate.Predicate<A>,
147
+ orElse: (a: A) => Effect.Effect<R2, E2, B>
148
+ ): <R, E>(self: Client<R, E, A>) => Client<R2 | R, E2 | E, A | B>
149
+ <R, E, A, R2, E2, B>(
150
+ self: Client<R, E, A>,
151
+ f: Predicate.Predicate<A>,
152
+ orElse: (a: A) => Effect.Effect<R2, E2, B>
153
+ ): Client<R | R2, E | E2, A | B>
154
+ } = internal.filterOrElse
155
+
156
+ /**
157
+ * @since 1.0.0
158
+ * @category filters
159
+ */
160
+ export const filterOrFail: {
161
+ <A, E2>(f: Predicate.Predicate<A>, orFailWith: (a: A) => E2): <R, E>(self: Client<R, E, A>) => Client<R, E2 | E, A>
162
+ <R, E, A, E2>(self: Client<R, E, A>, f: Predicate.Predicate<A>, orFailWith: (a: A) => E2): Client<R, E | E2, A>
163
+ } = internal.filterOrFail
164
+
165
+ /**
166
+ * @since 1.0.0
167
+ * @category filters
168
+ */
169
+ export const filterStatus: {
170
+ (
171
+ f: (status: number) => boolean
172
+ ): <R, E>(self: Client.WithResponse<R, E>) => Client.WithResponse<R, E | Error.ResponseError>
173
+ <R, E>(
174
+ self: Client.WithResponse<R, E>,
175
+ f: (status: number) => boolean
176
+ ): Client.WithResponse<R, Error.ResponseError | E>
177
+ } = internal.filterStatus
178
+
179
+ /**
180
+ * @since 1.0.0
181
+ * @category filters
182
+ */
183
+ export const filterStatusOk: <R, E>(
184
+ self: Client.WithResponse<R, E>
185
+ ) => Client.WithResponse<R, Error.ResponseError | E> = internal.filterStatusOk
186
+
187
+ /**
188
+ * @since 1.0.0
189
+ * @category mapping & sequencing
190
+ */
191
+ export const map: {
192
+ <A, B>(f: (a: A) => B): <R, E>(self: Client<R, E, A>) => Client<R, E, B>
193
+ <R, E, A, B>(self: Client<R, E, A>, f: (a: A) => B): Client<R, E, B>
194
+ } = internal.map
195
+
196
+ /**
197
+ * @since 1.0.0
198
+ * @category mapping & sequencing
199
+ */
200
+ export const mapEffect: {
201
+ <A, R2, E2, B>(f: (a: A) => Effect.Effect<R2, E2, B>): <R, E>(self: Client<R, E, A>) => Client<R2 | R, E2 | E, B>
202
+ <R, E, A, R2, E2, B>(self: Client<R, E, A>, f: (a: A) => Effect.Effect<R2, E2, B>): Client<R | R2, E | E2, B>
203
+ } = internal.mapEffect
204
+
205
+ /**
206
+ * @since 1.0.0
207
+ * @category mapping & sequencing
208
+ */
209
+ export const mapRequest: {
210
+ (
211
+ f: (a: ClientRequest.ClientRequest) => ClientRequest.ClientRequest
212
+ ): <R, E, A>(self: Client<R, E, A>) => Client<R, E, A>
213
+ <R, E, A>(self: Client<R, E, A>, f: (a: ClientRequest.ClientRequest) => ClientRequest.ClientRequest): Client<R, E, A>
214
+ } = internal.mapRequest
215
+
216
+ /**
217
+ * @since 1.0.0
218
+ * @category mapping & sequencing
219
+ */
220
+ export const mapRequestEffect: {
221
+ <R2, E2>(
222
+ f: (a: ClientRequest.ClientRequest) => Effect.Effect<R2, E2, ClientRequest.ClientRequest>
223
+ ): <R, E, A>(self: Client<R, E, A>) => Client<R2 | R, E2 | E, A>
224
+ <R, E, A, R2, E2>(
225
+ self: Client<R, E, A>,
226
+ f: (a: ClientRequest.ClientRequest) => Effect.Effect<R2, E2, ClientRequest.ClientRequest>
227
+ ): Client<R | R2, E | E2, A>
228
+ } = internal.mapRequestEffect
229
+
230
+ /**
231
+ * @since 1.0.0
232
+ * @category error handling
233
+ */
234
+ export const retry: {
235
+ <R1, E extends E0, E0, B>(policy: Schedule.Schedule<R1, E0, B>): <R, A>(self: Client<R, E, A>) => Client<R1 | R, E, A>
236
+ <R, E extends E0, E0, A, R1, B>(self: Client<R, E, A>, policy: Schedule.Schedule<R1, E0, B>): Client<R | R1, E, A>
237
+ } = internal.retry
238
+
239
+ /**
240
+ * @since 1.0.0
241
+ * @category schema
242
+ */
243
+ export const schemaFunction: {
244
+ <SI, SA>(
245
+ schema: Schema.Schema<SI, SA>
246
+ ): <R, E, A>(
247
+ self: Client<R, E, A>
248
+ ) => (
249
+ request: ClientRequest.ClientRequest
250
+ ) => (a: SA) => Effect.Effect<R, Error.RequestError | E | ParseResult.ParseError, A>
251
+ <R, E, A, SI, SA>(
252
+ self: Client<R, E, A>,
253
+ schema: Schema.Schema<SI, SA>
254
+ ): (
255
+ request: ClientRequest.ClientRequest
256
+ ) => (a: SA) => Effect.Effect<R, Error.RequestError | ParseResult.ParseError | E, A>
257
+ } = internal.schemaFunction
258
+
259
+ /**
260
+ * @since 1.0.0
261
+ * @category mapping & sequencing
262
+ */
263
+ export const tap: {
264
+ <A, R2, E2, _>(f: (a: A) => Effect.Effect<R2, E2, _>): <R, E>(self: Client<R, E, A>) => Client<R2 | R, E2 | E, A>
265
+ <R, E, A, R2, E2, _>(self: Client<R, E, A>, f: (a: A) => Effect.Effect<R2, E2, _>): Client<R | R2, E | E2, A>
266
+ } = internal.tap
267
+
268
+ /**
269
+ * @since 1.0.0
270
+ * @category mapping & sequencing
271
+ */
272
+ export const tapRequest: {
273
+ <R2, E2, _>(
274
+ f: (a: ClientRequest.ClientRequest) => Effect.Effect<R2, E2, _>
275
+ ): <R, E, A>(self: Client<R, E, A>) => Client<R2 | R, E2 | E, A>
276
+ <R, E, A, R2, E2, _>(
277
+ self: Client<R, E, A>,
278
+ f: (a: ClientRequest.ClientRequest) => Effect.Effect<R2, E2, _>
279
+ ): Client<R | R2, E | E2, A>
280
+ } = internal.tapRequest
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import type * as Data from "@effect/data/Data"
5
+ import type * as ClientRequest from "@effect/platform/Http/ClientRequest"
6
+ import type * as ClientResponse from "@effect/platform/Http/ClientResponse"
7
+ import * as internal from "@effect/platform/internal/http/clientError"
8
+
9
+ /**
10
+ * @since 1.0.0
11
+ * @category type id
12
+ */
13
+ export const TypeId: unique symbol = internal.TypeId
14
+
15
+ /**
16
+ * @since 1.0.0
17
+ * @category type id
18
+ */
19
+ export type TypeId = typeof TypeId
20
+
21
+ /**
22
+ * @since 1.0.0
23
+ * @category error
24
+ */
25
+ export type HttpClientError = RequestError | ResponseError
26
+
27
+ /**
28
+ * @since 1.0.0
29
+ */
30
+ export namespace HttpError {
31
+ /**
32
+ * @since 1.0.0
33
+ * @category models
34
+ */
35
+ export interface Proto extends Data.Case {
36
+ readonly [TypeId]: TypeId
37
+ readonly _tag: string
38
+ }
39
+
40
+ /**
41
+ * @since 1.0.0
42
+ */
43
+ export type ProvidedFields = TypeId | "_tag" | keyof Data.Case
44
+ }
45
+
46
+ /**
47
+ * @since 1.0.0
48
+ * @category error
49
+ */
50
+ export interface RequestError extends HttpError.Proto {
51
+ readonly _tag: "RequestError"
52
+ readonly request: ClientRequest.ClientRequest
53
+ readonly reason: "Transport" | "Encode"
54
+ readonly error: unknown
55
+ }
56
+
57
+ /**
58
+ * @since 1.0.0
59
+ * @category error
60
+ */
61
+ export const RequestError: (props: Omit<RequestError, HttpError.ProvidedFields>) => RequestError = internal.requestError
62
+
63
+ /**
64
+ * @since 1.0.0
65
+ * @category error
66
+ */
67
+ export interface ResponseError extends HttpError.Proto {
68
+ readonly _tag: "ResponseError"
69
+ readonly request: ClientRequest.ClientRequest
70
+ readonly response: ClientResponse.ClientResponse
71
+ readonly reason: "StatusCode" | "Decode" | "EmptyBody"
72
+ readonly error: unknown
73
+ }
74
+
75
+ /**
76
+ * @since 1.0.0
77
+ * @category error
78
+ */
79
+ export const ResponseError: (props: Omit<ResponseError, HttpError.ProvidedFields>) => ResponseError =
80
+ internal.responseError
@@ -0,0 +1,320 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import type { Pipeable } from "@effect/data/Pipeable"
5
+ import type * as Body from "@effect/platform/Http/Body"
6
+ import type * as Error from "@effect/platform/Http/ClientError"
7
+ import type * as Headers from "@effect/platform/Http/Headers"
8
+ import type { Method } from "@effect/platform/Http/Method"
9
+ import type * as UrlParams from "@effect/platform/Http/UrlParams"
10
+ import * as internal from "@effect/platform/internal/http/clientRequest"
11
+ import type * as Schema from "@effect/schema/Schema"
12
+ import type * as Stream from "@effect/stream/Stream"
13
+
14
+ /**
15
+ * @since 1.0.0
16
+ * @category type ids
17
+ */
18
+ export const TypeId = Symbol.for("@effect/platform/Http/ClientRequest")
19
+
20
+ /**
21
+ * @since 1.0.0
22
+ * @category type ids
23
+ */
24
+ export type TypeId = typeof TypeId
25
+
26
+ /**
27
+ * @since 1.0.0
28
+ * @category models
29
+ */
30
+ export interface ClientRequest extends Pipeable {
31
+ readonly [TypeId]: TypeId
32
+ readonly method: Method
33
+ readonly url: string
34
+ readonly urlParams: UrlParams.UrlParams
35
+ readonly headers: Headers.Headers
36
+ readonly body: Body.Body
37
+ }
38
+
39
+ /**
40
+ * @since 1.0.0
41
+ * @category models
42
+ */
43
+ export interface Options {
44
+ readonly method?: Method
45
+ readonly url?: string
46
+ readonly urlParams?: UrlParams.Input
47
+ readonly headers?: Headers.Input
48
+ readonly body?: Body.Body
49
+ readonly accept?: string
50
+ readonly acceptJson?: boolean
51
+ }
52
+
53
+ /**
54
+ * @since 1.0.0
55
+ */
56
+ export namespace Options {
57
+ /**
58
+ * @since 1.0.0
59
+ * @category models
60
+ */
61
+ export interface NoBody extends Omit<Options, "method" | "url" | "body"> {}
62
+
63
+ /**
64
+ * @since 1.0.0
65
+ * @category models
66
+ */
67
+ export interface NoUrl extends Omit<Options, "method" | "url"> {}
68
+ }
69
+
70
+ /**
71
+ * @since 1.0.0
72
+ * @category constructors
73
+ */
74
+ export const make: {
75
+ (method: "GET" | "HEAD"): (url: string, options?: Options.NoBody) => ClientRequest
76
+ (
77
+ method: Exclude<Method, "GET" | "HEAD">
78
+ ): (url: string, options?: Options.NoUrl) => ClientRequest
79
+ } = internal.make
80
+
81
+ /**
82
+ * @since 1.0.0
83
+ * @category constructors
84
+ */
85
+ export const get: (url: string, options?: Options.NoBody) => ClientRequest = internal.get
86
+
87
+ /**
88
+ * @since 1.0.0
89
+ * @category constructors
90
+ */
91
+ export const post: (url: string, options?: Options.NoUrl) => ClientRequest = internal.post
92
+
93
+ /**
94
+ * @since 1.0.0
95
+ * @category constructors
96
+ */
97
+ export const patch: (url: string, options?: Options.NoUrl) => ClientRequest = internal.patch
98
+
99
+ /**
100
+ * @since 1.0.0
101
+ * @category constructors
102
+ */
103
+ export const put: (url: string, options?: Options.NoUrl) => ClientRequest = internal.put
104
+
105
+ /**
106
+ * @since 1.0.0
107
+ * @category constructors
108
+ */
109
+ export const del: (url: string, options?: Options.NoUrl) => ClientRequest = internal.del
110
+
111
+ /**
112
+ * @since 1.0.0
113
+ * @category constructors
114
+ */
115
+ export const head: (url: string, options?: Options.NoBody) => ClientRequest = internal.head
116
+
117
+ /**
118
+ * @since 1.0.0
119
+ * @category constructors
120
+ */
121
+ export const options: (url: string, options?: Options.NoUrl) => ClientRequest = internal.options
122
+
123
+ /**
124
+ * @since 1.0.0
125
+ * @category combinators
126
+ */
127
+ export const modify: {
128
+ (options: Options): (self: ClientRequest) => ClientRequest
129
+ (self: ClientRequest, options: Options): ClientRequest
130
+ } = internal.modify
131
+
132
+ /**
133
+ * @since 1.0.0
134
+ * @category combinators
135
+ */
136
+ export const setMethod: {
137
+ (method: Method): (self: ClientRequest) => ClientRequest
138
+ (self: ClientRequest, method: Method): ClientRequest
139
+ } = internal.setMethod
140
+
141
+ /**
142
+ * @since 1.0.0
143
+ * @category combinators
144
+ */
145
+ export const setHeader: {
146
+ (key: string, value: string): (self: ClientRequest) => ClientRequest
147
+ (self: ClientRequest, key: string, value: string): ClientRequest
148
+ } = internal.setHeader
149
+
150
+ /**
151
+ * @since 1.0.0
152
+ * @category combinators
153
+ */
154
+ export const setHeaders: {
155
+ (input: Headers.Input): (self: ClientRequest) => ClientRequest
156
+ (self: ClientRequest, input: Headers.Input): ClientRequest
157
+ } = internal.setHeaders
158
+
159
+ /**
160
+ * @since 1.0.0
161
+ * @category combinators
162
+ */
163
+ export const basicAuth: {
164
+ (username: string, password: string): (self: ClientRequest) => ClientRequest
165
+ (self: ClientRequest, username: string, password: string): ClientRequest
166
+ } = internal.basicAuth
167
+
168
+ /**
169
+ * @since 1.0.0
170
+ * @category combinators
171
+ */
172
+ export const accept: {
173
+ (mediaType: string): (self: ClientRequest) => ClientRequest
174
+ (self: ClientRequest, mediaType: string): ClientRequest
175
+ } = internal.accept
176
+
177
+ /**
178
+ * @since 1.0.0
179
+ * @category combinators
180
+ */
181
+ export const acceptJson: (self: ClientRequest) => ClientRequest = internal.acceptJson
182
+
183
+ /**
184
+ * @since 1.0.0
185
+ * @category combinators
186
+ */
187
+ export const setUrl: {
188
+ (url: string): (self: ClientRequest) => ClientRequest
189
+ (self: ClientRequest, url: string): ClientRequest
190
+ } = internal.setUrl
191
+
192
+ /**
193
+ * @since 1.0.0
194
+ * @category combinators
195
+ */
196
+ export const prependUrl: {
197
+ (path: string): (self: ClientRequest) => ClientRequest
198
+ (self: ClientRequest, path: string): ClientRequest
199
+ } = internal.prependUrl
200
+
201
+ /**
202
+ * @since 1.0.0
203
+ * @category combinators
204
+ */
205
+ export const appendUrl: {
206
+ (path: string): (self: ClientRequest) => ClientRequest
207
+ (self: ClientRequest, path: string): ClientRequest
208
+ } = internal.appendUrl
209
+
210
+ /**
211
+ * @since 1.0.0
212
+ * @category combinators
213
+ */
214
+ export const updateUrl: {
215
+ (f: (url: string) => string): (self: ClientRequest) => ClientRequest
216
+ (self: ClientRequest, f: (url: string) => string): ClientRequest
217
+ } = internal.updateUrl
218
+
219
+ /**
220
+ * @since 1.0.0
221
+ * @category combinators
222
+ */
223
+ export const setUrlParam = internal.setUrlParam
224
+
225
+ /**
226
+ * @since 1.0.0
227
+ * @category combinators
228
+ */
229
+ export const setUrlParams = internal.setUrlParams
230
+
231
+ /**
232
+ * @since 1.0.0
233
+ * @category combinators
234
+ */
235
+ export const appendUrlParam = internal.appendUrlParam
236
+
237
+ /**
238
+ * @since 1.0.0
239
+ * @category combinators
240
+ */
241
+ export const appendUrlParams = internal.appendUrlParams
242
+
243
+ /**
244
+ * @since 1.0.0
245
+ * @category combinators
246
+ */
247
+ export const setBody: {
248
+ (body: Body.Body): (self: ClientRequest) => ClientRequest
249
+ (self: ClientRequest, body: Body.Body): ClientRequest
250
+ } = internal.setBody
251
+
252
+ /**
253
+ * @since 1.0.0
254
+ * @category combinators
255
+ */
256
+ export const binaryBody: {
257
+ (body: Uint8Array, contentType?: string): (self: ClientRequest) => ClientRequest
258
+ (self: ClientRequest, body: Uint8Array, contentType?: string): ClientRequest
259
+ } = internal.binaryBody
260
+
261
+ /**
262
+ * @since 1.0.0
263
+ * @category combinators
264
+ */
265
+ export const textBody: {
266
+ (body: string, contentType?: string): (self: ClientRequest) => ClientRequest
267
+ (self: ClientRequest, body: string, contentType?: string): ClientRequest
268
+ } = internal.textBody
269
+
270
+ /**
271
+ * @since 1.0.0
272
+ * @category combinators
273
+ */
274
+ export const jsonBody: {
275
+ (body: unknown): (self: ClientRequest) => ClientRequest
276
+ (self: ClientRequest, body: string): ClientRequest
277
+ } = internal.jsonBody
278
+
279
+ /**
280
+ * @since 1.0.0
281
+ * @category combinators
282
+ */
283
+ export const schemaBody: <I, A>(schema: Schema.Schema<I, A>) => {
284
+ (body: A): (self: ClientRequest) => ClientRequest
285
+ (self: ClientRequest, body: A): ClientRequest
286
+ } = internal.schemaBody
287
+
288
+ /**
289
+ * @since 1.0.0
290
+ * @category combinators
291
+ */
292
+ export const urlParamsBody: {
293
+ (input: UrlParams.Input): (self: ClientRequest) => ClientRequest
294
+ (self: ClientRequest, input: UrlParams.Input): ClientRequest
295
+ } = internal.urlParamsBody
296
+
297
+ /**
298
+ * @since 1.0.0
299
+ * @category combinators
300
+ */
301
+ export const formDataBody: {
302
+ (body: FormData): (self: ClientRequest) => ClientRequest
303
+ (self: ClientRequest, body: FormData): ClientRequest
304
+ } = internal.formDataBody
305
+
306
+ /**
307
+ * @since 1.0.0
308
+ * @category combinators
309
+ */
310
+ export const streamBody: {
311
+ (
312
+ body: Stream.Stream<never, Error.RequestError, Uint8Array>,
313
+ options?: { readonly contentType?: string; readonly contentLength?: number }
314
+ ): (self: ClientRequest) => ClientRequest
315
+ (
316
+ self: ClientRequest,
317
+ body: Stream.Stream<never, Error.RequestError, Uint8Array>,
318
+ options?: { readonly contentType?: string; readonly contentLength?: number }
319
+ ): ClientRequest
320
+ } = internal.streamBody