@putdotio/sdk 9.1.7 → 9.2.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.
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
1
- import { A as mapDecodeErrorToValidationError, C as PutioTransportError, D as fallbackPutioErrorEnvelope, E as definePutioOperationErrorSpec, M as parseErrorBody, N as responseRateLimitHeaders, O as makeResponseError, P as withOperationErrors, S as PutioRateLimitError, T as decodePutioErrorEnvelope, _ as PutioApiError, a as buildPutioUrl, b as PutioErrorEnvelopeSchema, c as makePutioSdkLiveLayer, d as requestVoid, f as selectJsonField, g as DEFAULT_PUTIO_WEB_APP_URL, h as DEFAULT_PUTIO_UPLOAD_BASE_URL, i as PutioSdkConfig, j as mapTransportError, k as mapConfigurationError, l as requestArrayBuffer, m as DEFAULT_PUTIO_API_BASE_URL, n as toCursorSelectionForm, o as makePutioSdkConfig, p as selectJsonFields, r as OkResponseSchema, s as makePutioSdkLayer, t as joinCsv, u as requestJson, v as PutioAuthError, w as PutioValidationError, x as PutioOperationError, y as PutioConfigurationError } from "./forms-BoZMwEUj.js";
2
- import { Cause, Effect, Exit, ManagedRuntime, Option, Schema } from "effect";
1
+ import { A as isPutioAuthError, B as withOperationErrors, C as PutioRateLimitError, D as definePutioOperationErrorSpec, E as decodePutioErrorEnvelope, F as mapConfigurationError, I as mapDecodeErrorToValidationError, L as mapTransportError, M as isPutioOperationError, N as isPutioRateLimitError, O as fallbackPutioErrorEnvelope, P as makeResponseError, R as parseErrorBody, S as PutioOperationError, T as PutioValidationError, _ as DEFAULT_PUTIO_WEB_APP_URL, a as buildPutioUrl, b as PutioConfigurationError, c as makePutioSdkLayer, d as requestJson, f as requestVoid, g as DEFAULT_PUTIO_UPLOAD_BASE_URL, h as DEFAULT_PUTIO_API_BASE_URL, i as PutioSdkConfig, j as isPutioErrorEnvelope, k as isPutioApiError, l as makePutioSdkLiveLayer, m as selectJsonFields, n as toCursorSelectionForm, o as encodePathSegment, p as selectJsonField, r as OkResponseSchema, s as makePutioSdkConfig, t as joinCsv, u as requestArrayBuffer, v as PutioApiError, w as PutioTransportError, x as PutioErrorEnvelopeSchema, y as PutioAuthError, z as responseRateLimitHeaders } from "./forms-NEv3jqmj.js";
2
+ import { Cause, Context, Effect, Exit, Layer, ManagedRuntime, Schema } from "effect";
3
3
  //#region src/domains/account.ts
4
4
  const RequestedFlag$1 = Schema.Literal(1);
5
5
  const AccountDiskSchema = Schema.Struct({
6
- avail: Schema.Number.pipe(Schema.nonNegative()),
7
- size: Schema.Number.pipe(Schema.nonNegative()),
8
- used: Schema.Number.pipe(Schema.nonNegative())
6
+ avail: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
7
+ size: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
8
+ used: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0))
9
9
  });
10
10
  const AccountWarningsSchema = Schema.Struct({
11
11
  callback_url_has_failed: Schema.optional(Schema.Boolean),
12
12
  pushover_token_has_failed: Schema.optional(Schema.Boolean)
13
13
  });
14
- const AccountSettingsSchema = Schema.Struct({
14
+ const AccountSettingsFields = {
15
15
  beta_user: Schema.Boolean,
16
16
  callback_url: Schema.NullOr(Schema.String),
17
17
  dark_theme: Schema.Boolean,
18
- default_download_folder: Schema.Number.pipe(Schema.int()),
18
+ default_download_folder: Schema.Int,
19
19
  dont_autoselect_subtitles: Schema.Boolean,
20
20
  fluid_layout: Schema.Boolean,
21
21
  hide_subtitles: Schema.Boolean,
@@ -28,25 +28,31 @@ const AccountSettingsSchema = Schema.Struct({
28
28
  show_optimistic_usage: Schema.Boolean,
29
29
  sort_by: Schema.String,
30
30
  start_from: Schema.Boolean,
31
- subtitle_languages: Schema.Array(Schema.NullOr(Schema.String)).pipe(Schema.maxItems(2)),
31
+ subtitle_languages: Schema.Array(Schema.NullOr(Schema.String)).check(Schema.isMaxLength(2)),
32
32
  theater_mode: Schema.Boolean,
33
- theme: Schema.Literal("dark", "light", "auto"),
33
+ theme: Schema.Literals([
34
+ "dark",
35
+ "light",
36
+ "auto"
37
+ ]),
34
38
  transfer_sort_by: Schema.NullOr(Schema.String),
35
39
  trash_enabled: Schema.Boolean,
36
40
  tunnel_route_name: Schema.NullOr(Schema.String),
37
41
  two_factor_enabled: Schema.Boolean,
38
42
  use_private_download_ip: Schema.Boolean,
39
43
  use_start_from: Schema.Boolean,
40
- video_player: Schema.NullOr(Schema.Literal("html5", "flash"))
41
- });
42
- const AccountFeaturesSchema = Schema.Record({
43
- key: Schema.String,
44
- value: Schema.Boolean
45
- });
44
+ video_player: Schema.NullOr(Schema.Literals(["html5", "flash"]))
45
+ };
46
+ const AccountSettingsSchema = Schema.Struct(AccountSettingsFields);
47
+ const AccountFeaturesSchema = Schema.Record(Schema.String, Schema.Boolean);
46
48
  const PasInfoSchema = Schema.Struct({ user_hash: Schema.String });
47
49
  const AccountInfoBaseSchema = Schema.Struct({
48
50
  account_active: Schema.optional(Schema.NullOr(Schema.Boolean)),
49
- account_status: Schema.Literal("active", "inactive", "stranger"),
51
+ account_status: Schema.Literals([
52
+ "active",
53
+ "inactive",
54
+ "stranger"
55
+ ]),
50
56
  avatar_url: Schema.String,
51
57
  can_create_sub_account: Schema.Boolean,
52
58
  disk: AccountDiskSchema,
@@ -56,12 +62,12 @@ const AccountInfoBaseSchema = Schema.Struct({
56
62
  is_eligible_for_friend_invitation: Schema.Boolean,
57
63
  is_sub_account: Schema.Boolean,
58
64
  mail: Schema.String,
59
- monthly_bandwidth_usage: Schema.Number.pipe(Schema.nonNegative()),
65
+ monthly_bandwidth_usage: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
60
66
  password_last_changed_at: Schema.NullOr(Schema.String),
61
67
  private_download_host_ip: Schema.NullOr(Schema.String),
62
68
  settings: AccountSettingsSchema,
63
- trash_size: Schema.Number.pipe(Schema.nonNegative()),
64
- user_id: Schema.Number.pipe(Schema.int()),
69
+ trash_size: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
70
+ user_id: Schema.Int,
65
71
  username: Schema.String,
66
72
  warnings: AccountWarningsSchema
67
73
  });
@@ -74,10 +80,10 @@ const AccountInfoQuerySchema = Schema.Struct({
74
80
  profitwell: Schema.optional(RequestedFlag$1),
75
81
  push_token: Schema.optional(RequestedFlag$1)
76
82
  });
77
- const AccountInfoBroadSchema = Schema.extend(AccountInfoBaseSchema, Schema.Struct({
83
+ const AccountInfoBroadSchema = AccountInfoBaseSchema.pipe(Schema.fieldsAssign({
78
84
  download_token: Schema.optional(Schema.String),
79
85
  features: Schema.optional(AccountFeaturesSchema),
80
- paddle_user_id: Schema.optional(Schema.NullOr(Schema.Number.pipe(Schema.int()))),
86
+ paddle_user_id: Schema.optional(Schema.NullOr(Schema.Int)),
81
87
  pas: Schema.optional(PasInfoSchema),
82
88
  push_token: Schema.optional(Schema.String),
83
89
  user_hash: Schema.optional(Schema.String)
@@ -94,13 +100,47 @@ const AccountTwoFactorSettingsSchema = Schema.Struct({
94
100
  code: Schema.String,
95
101
  enable: Schema.Boolean
96
102
  });
97
- const SaveAccountSettingsPayloadSchema = Schema.Union(Schema.partial(AccountSettingsSchema), Schema.Struct({ username: Schema.String }), Schema.Struct({
98
- current_password: Schema.String,
99
- mail: Schema.String
100
- }), Schema.Struct({
101
- current_password: Schema.String,
102
- password: Schema.String
103
- }), Schema.Struct({ two_factor_enabled: AccountTwoFactorSettingsSchema }));
103
+ const AccountSettingsPatchSchema = Schema.Struct({
104
+ beta_user: Schema.optional(AccountSettingsFields.beta_user),
105
+ callback_url: Schema.optional(AccountSettingsFields.callback_url),
106
+ dark_theme: Schema.optional(AccountSettingsFields.dark_theme),
107
+ default_download_folder: Schema.optional(AccountSettingsFields.default_download_folder),
108
+ dont_autoselect_subtitles: Schema.optional(AccountSettingsFields.dont_autoselect_subtitles),
109
+ fluid_layout: Schema.optional(AccountSettingsFields.fluid_layout),
110
+ hide_subtitles: Schema.optional(AccountSettingsFields.hide_subtitles),
111
+ history_enabled: Schema.optional(AccountSettingsFields.history_enabled),
112
+ is_invisible: Schema.optional(AccountSettingsFields.is_invisible),
113
+ locale: Schema.optional(AccountSettingsFields.locale),
114
+ login_mails_enabled: Schema.optional(AccountSettingsFields.login_mails_enabled),
115
+ next_episode: Schema.optional(AccountSettingsFields.next_episode),
116
+ pushover_token: Schema.optional(AccountSettingsFields.pushover_token),
117
+ show_optimistic_usage: Schema.optional(AccountSettingsFields.show_optimistic_usage),
118
+ sort_by: Schema.optional(AccountSettingsFields.sort_by),
119
+ start_from: Schema.optional(AccountSettingsFields.start_from),
120
+ subtitle_languages: Schema.optional(AccountSettingsFields.subtitle_languages),
121
+ theater_mode: Schema.optional(AccountSettingsFields.theater_mode),
122
+ theme: Schema.optional(AccountSettingsFields.theme),
123
+ transfer_sort_by: Schema.optional(AccountSettingsFields.transfer_sort_by),
124
+ trash_enabled: Schema.optional(AccountSettingsFields.trash_enabled),
125
+ tunnel_route_name: Schema.optional(AccountSettingsFields.tunnel_route_name),
126
+ two_factor_enabled: Schema.optional(AccountSettingsFields.two_factor_enabled),
127
+ use_private_download_ip: Schema.optional(AccountSettingsFields.use_private_download_ip),
128
+ use_start_from: Schema.optional(AccountSettingsFields.use_start_from),
129
+ video_player: Schema.optional(AccountSettingsFields.video_player)
130
+ });
131
+ const SaveAccountSettingsPayloadSchema = Schema.Union([
132
+ AccountSettingsPatchSchema,
133
+ Schema.Struct({ username: Schema.String }),
134
+ Schema.Struct({
135
+ current_password: Schema.String,
136
+ mail: Schema.String
137
+ }),
138
+ Schema.Struct({
139
+ current_password: Schema.String,
140
+ password: Schema.String
141
+ }),
142
+ Schema.Struct({ two_factor_enabled: AccountTwoFactorSettingsSchema })
143
+ ]);
104
144
  const AccountClearOptionsSchema = Schema.Struct({
105
145
  active_transfers: Schema.Boolean,
106
146
  files: Schema.Boolean,
@@ -113,7 +153,11 @@ const AccountClearOptionsSchema = Schema.Struct({
113
153
  });
114
154
  const AccountConfirmationSchema = Schema.Struct({
115
155
  created_at: Schema.String,
116
- subject: Schema.Literal("mail_change", "password_change", "subscription_upgrade")
156
+ subject: Schema.Literals([
157
+ "mail_change",
158
+ "password_change",
159
+ "subscription_upgrade"
160
+ ])
117
161
  });
118
162
  const AccountConfirmationsEnvelopeSchema = Schema.Struct({
119
163
  confirmations: Schema.Array(AccountConfirmationSchema),
@@ -224,7 +268,7 @@ const AccountConfirmationsErrorSpec = definePutioOperationErrorSpec({
224
268
  statusCode: 401
225
269
  }]
226
270
  });
227
- function getAccountInfo(query) {
271
+ function getAccountInfo(query = {}) {
228
272
  return ensureAccountInfoFields(requestJson(AccountInfoEnvelopeSchema, {
229
273
  method: "GET",
230
274
  path: "/v2/account/info",
@@ -269,36 +313,36 @@ const listAccountConfirmations = (subject) => requestJson(AccountConfirmationsEn
269
313
  const OAuthAppBaseSchema = Schema.Struct({
270
314
  description: Schema.String,
271
315
  has_icon: Schema.NullOr(Schema.Boolean),
272
- id: Schema.Number.pipe(Schema.int()),
316
+ id: Schema.Int,
273
317
  name: Schema.String,
274
318
  website: Schema.String
275
319
  });
276
320
  const OAuthAppSchema = OAuthAppBaseSchema;
277
- const OwnedOAuthAppSchema = Schema.extend(OAuthAppBaseSchema, Schema.Struct({
321
+ const OwnedOAuthAppSchema = OAuthAppBaseSchema.pipe(Schema.fieldsAssign({
278
322
  callback: Schema.String,
279
323
  hidden: Schema.Boolean,
280
324
  secret: Schema.String
281
325
  }));
282
- const MyOAuthAppSchema = Schema.extend(OwnedOAuthAppSchema, Schema.Struct({ users: Schema.Number.pipe(Schema.int(), Schema.nonNegative()) }));
283
- const PopularOAuthAppSchema = Schema.extend(OAuthAppBaseSchema, Schema.Struct({
326
+ const MyOAuthAppSchema = OwnedOAuthAppSchema.pipe(Schema.fieldsAssign({ users: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)) }));
327
+ const PopularOAuthAppSchema = OAuthAppBaseSchema.pipe(Schema.fieldsAssign({
284
328
  hidden: Schema.optional(Schema.Boolean),
285
329
  maker: Schema.String,
286
- users: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.nonNegative()))
330
+ users: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))
287
331
  }));
288
332
  const OAuthAppSessionSchema = Schema.Struct({
289
333
  active: Schema.Boolean,
290
- app_id: Schema.Number.pipe(Schema.int()),
334
+ app_id: Schema.Int,
291
335
  app_name: Schema.optional(Schema.String),
292
336
  client_name: Schema.String,
293
337
  created_at: Schema.String,
294
- id: Schema.Number.pipe(Schema.int()),
338
+ id: Schema.Int,
295
339
  ip_address: Schema.String,
296
340
  last_used_at: Schema.NullOr(Schema.String),
297
341
  note: Schema.NullOr(Schema.String),
298
342
  user_agent: Schema.String
299
343
  });
300
344
  const OAuthAppWithTokenSchema = Schema.Struct({
301
- app: Schema.Union(OwnedOAuthAppSchema, OAuthAppSchema),
345
+ app: Schema.Union([OwnedOAuthAppSchema, OAuthAppSchema]),
302
346
  status: Schema.Literal("OK"),
303
347
  token: Schema.NullOr(Schema.String)
304
348
  });
@@ -311,7 +355,7 @@ const PopularOAuthAppsEnvelopeSchema = Schema.Struct({
311
355
  status: Schema.Literal("OK")
312
356
  });
313
357
  const OAuthAppEnvelopeSchema = Schema.Struct({
314
- app: Schema.Union(OwnedOAuthAppSchema, OAuthAppSchema),
358
+ app: Schema.Union([OwnedOAuthAppSchema, OAuthAppSchema]),
315
359
  status: Schema.Literal("OK")
316
360
  });
317
361
  const OAuthRegeneratedTokenEnvelopeSchema = Schema.Struct({
@@ -331,7 +375,7 @@ const OAuthAppUpdateInputSchema = Schema.Struct({
331
375
  description: Schema.String,
332
376
  hidden: Schema.optional(Schema.Boolean),
333
377
  icon: Schema.optional(Schema.instanceOf(Blob)),
334
- id: Schema.Number.pipe(Schema.int()),
378
+ id: Schema.Int,
335
379
  website: Schema.String
336
380
  });
337
381
  const OAuthSetIconInputSchema = Schema.Struct({ icon: Schema.instanceOf(Blob) });
@@ -412,14 +456,14 @@ const buildOAuthAuthorizeUrl = (options) => buildPutioUrl(options.baseUrl ?? "ht
412
456
  ...options.query,
413
457
  oauth_token: options.oauthToken
414
458
  });
415
- const buildOAuthAppIconUrl = (options) => buildPutioUrl(options.baseUrl ?? "https://api.put.io", `/v2/oauth/apps/${options.id}/icon`, { oauth_token: options.oauthToken });
459
+ const buildOAuthAppIconUrl = (options) => buildPutioUrl(options.baseUrl ?? "https://api.put.io", `/v2/oauth/apps/${encodePathSegment(options.id)}/icon`, { oauth_token: options.oauthToken });
416
460
  const queryOAuthApps = () => requestJson(OAuthAppsEnvelopeSchema, {
417
461
  method: "GET",
418
462
  path: "/v2/oauth/apps"
419
463
  }).pipe(selectJsonField("apps"), withOperationErrors(QueryOAuthAppsErrorSpec));
420
464
  const getOAuthApp = (id, options) => requestJson(OAuthAppWithTokenSchema, {
421
465
  method: "GET",
422
- path: options?.edit ? `/v2/oauth/apps/${id}/edit` : `/v2/oauth/apps/${id}`
466
+ path: options?.edit ? `/v2/oauth/apps/${encodePathSegment(id)}/edit` : `/v2/oauth/apps/${encodePathSegment(id)}`
423
467
  }).pipe(withOperationErrors(GetOAuthAppErrorSpec));
424
468
  const setOAuthAppIcon = (id, input) => {
425
469
  const formData = new FormData();
@@ -430,7 +474,7 @@ const setOAuthAppIcon = (id, input) => {
430
474
  value: formData
431
475
  },
432
476
  method: "POST",
433
- path: `/v2/oauth/apps/${id}/icon`
477
+ path: `/v2/oauth/apps/${encodePathSegment(id)}/icon`
434
478
  });
435
479
  };
436
480
  const createOAuthApp = (input) => requestJson(OAuthAppEnvelopeSchema, {
@@ -447,15 +491,15 @@ const updateOAuthApp = (input) => requestJson(OAuthAppWithTokenSchema, {
447
491
  value: makeUpdateOAuthAppFormData(input)
448
492
  },
449
493
  method: "POST",
450
- path: `/v2/oauth/apps/${input.id}`
494
+ path: `/v2/oauth/apps/${encodePathSegment(input.id)}`
451
495
  }).pipe(withOperationErrors(UpdateOAuthAppErrorSpec));
452
496
  const deleteOAuthApp = (id) => requestJson(OkResponseSchema, {
453
497
  method: "POST",
454
- path: `/v2/oauth/apps/${id}/delete`
498
+ path: `/v2/oauth/apps/${encodePathSegment(id)}/delete`
455
499
  }).pipe(withOperationErrors(DeleteOAuthAppErrorSpec));
456
500
  const regenerateOAuthAppToken = (id) => requestJson(OAuthRegeneratedTokenEnvelopeSchema, {
457
501
  method: "POST",
458
- path: `/v2/oauth/apps/${id}/regenerate_token`
502
+ path: `/v2/oauth/apps/${encodePathSegment(id)}/regenerate_token`
459
503
  }).pipe(selectJsonField("access_token"), withOperationErrors(RegenerateOAuthAppTokenErrorSpec));
460
504
  const getPopularOAuthApps = () => requestJson(PopularOAuthAppsEnvelopeSchema, {
461
505
  method: "GET",
@@ -465,14 +509,20 @@ const getPopularOAuthApps = () => requestJson(PopularOAuthAppsEnvelopeSchema, {
465
509
  //#region src/domains/auth.ts
466
510
  const LoginResponseSchema = Schema.Struct({
467
511
  access_token: Schema.String,
468
- user_id: Schema.Number.pipe(Schema.int())
469
- });
470
- const TokenScopeSchema = Schema.NullOr(Schema.Literal("default", "two_factor", "files_public_access", "files_download", "token_validate"));
512
+ user_id: Schema.Int
513
+ });
514
+ const TokenScopeSchema = Schema.NullOr(Schema.Literals([
515
+ "default",
516
+ "two_factor",
517
+ "files_public_access",
518
+ "files_download",
519
+ "token_validate"
520
+ ]));
471
521
  const ValidateTokenResponseSchema = Schema.Struct({
472
522
  result: Schema.Boolean,
473
- token_id: Schema.NullOr(Schema.Number.pipe(Schema.int())),
523
+ token_id: Schema.NullOr(Schema.Int),
474
524
  token_scope: TokenScopeSchema,
475
- user_id: Schema.NullOr(Schema.Number.pipe(Schema.int()))
525
+ user_id: Schema.NullOr(Schema.Int)
476
526
  });
477
527
  const RecoveryCodeEntrySchema = Schema.Struct({
478
528
  code: Schema.String,
@@ -489,7 +539,7 @@ const GenerateTOTPResponseSchema = Schema.Struct({
489
539
  });
490
540
  const VerifyTOTPResponseSchema = Schema.Struct({
491
541
  token: Schema.String,
492
- user_id: Schema.Number.pipe(Schema.int())
542
+ user_id: Schema.Int
493
543
  });
494
544
  const AuthorizationCodeSchema = Schema.Struct({
495
545
  code: Schema.String,
@@ -519,13 +569,13 @@ const ClientsEnvelopeSchema = Schema.Struct({
519
569
  const VoucherEnvelopeSchema = Schema.Struct({
520
570
  status: Schema.Literal("OK"),
521
571
  voucher: Schema.Struct({
522
- days: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
572
+ days: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
523
573
  owner: Schema.NullOr(Schema.String)
524
574
  })
525
575
  });
526
576
  const GiftCardEnvelopeSchema = Schema.Struct({
527
577
  gift_card: Schema.Struct({
528
- days: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
578
+ days: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
529
579
  plan: Schema.Boolean
530
580
  }),
531
581
  status: Schema.Literal("OK")
@@ -543,7 +593,7 @@ const FriendInviteEnvelopeSchema = Schema.Struct({
543
593
  plan: Schema.Struct({
544
594
  code: Schema.String,
545
595
  name: Schema.String,
546
- period: Schema.Number.pipe(Schema.int(), Schema.nonNegative())
596
+ period: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))
547
597
  })
548
598
  }),
549
599
  status: Schema.Literal("OK")
@@ -565,14 +615,14 @@ const GenerateTOTPEnvelopeSchema = Schema.Struct({
565
615
  const VerifyTOTPEnvelopeSchema = Schema.Struct({
566
616
  status: Schema.Literal("OK"),
567
617
  token: Schema.String,
568
- user_id: Schema.Number.pipe(Schema.int())
618
+ user_id: Schema.Int
569
619
  });
570
620
  const RecoveryCodesEnvelopeSchema = Schema.Struct({
571
621
  recovery_codes: TwoFactorRecoveryCodesSchema,
572
622
  status: Schema.Literal("OK")
573
623
  });
574
624
  const RegisterInputSchema = Schema.Struct({
575
- client_id: Schema.Union(Schema.String, Schema.Number.pipe(Schema.int())),
625
+ client_id: Schema.Union([Schema.String, Schema.Int]),
576
626
  family_invite_code: Schema.optional(Schema.String),
577
627
  friend_invite_code: Schema.optional(Schema.String),
578
628
  gift_card_confirmation_code: Schema.optional(Schema.String),
@@ -830,7 +880,7 @@ const login = (input) => requestJson(LoginResponseSchema, {
830
880
  username: input.username
831
881
  },
832
882
  method: "PUT",
833
- path: input.fingerprint ? `/v2/oauth2/authorizations/clients/${input.clientId}/${input.fingerprint}` : `/v2/oauth2/authorizations/clients/${input.clientId}`,
883
+ path: input.fingerprint ? `/v2/oauth2/authorizations/clients/${encodePathSegment(input.clientId)}/${encodePathSegment(input.fingerprint)}` : `/v2/oauth2/authorizations/clients/${encodePathSegment(input.clientId)}`,
834
884
  query: {
835
885
  client_name: input.clientName,
836
886
  client_secret: input.clientSecret
@@ -852,28 +902,28 @@ const register = (input) => requestJson(ResetPasswordEnvelopeSchema, {
852
902
  const exists = (key, value) => requestJson(ExistsEnvelopeSchema, {
853
903
  auth: { type: "none" },
854
904
  method: "GET",
855
- path: `/v2/registration/exists/${key}`,
905
+ path: `/v2/registration/exists/${encodePathSegment(key)}`,
856
906
  query: { value }
857
907
  }).pipe(selectJsonField("exists"));
858
908
  const getVoucher = (code) => requestJson(VoucherEnvelopeSchema, {
859
909
  auth: { type: "none" },
860
910
  method: "GET",
861
- path: `/v2/registration/voucher/${code}`
911
+ path: `/v2/registration/voucher/${encodePathSegment(code)}`
862
912
  }).pipe(selectJsonField("voucher"), withOperationErrors(VoucherLookupErrorSpec));
863
913
  const getGiftCard = (code) => requestJson(GiftCardEnvelopeSchema, {
864
914
  auth: { type: "none" },
865
915
  method: "GET",
866
- path: `/v2/registration/gift_card/${code}`
916
+ path: `/v2/registration/gift_card/${encodePathSegment(code)}`
867
917
  }).pipe(selectJsonField("gift_card"), withOperationErrors(GiftCardLookupErrorSpec));
868
918
  const getFamilyInvite = (code) => requestJson(FamilyInviteEnvelopeSchema, {
869
919
  auth: { type: "none" },
870
920
  method: "GET",
871
- path: `/v2/registration/family/${code}`
921
+ path: `/v2/registration/family/${encodePathSegment(code)}`
872
922
  }).pipe(selectJsonField("invite"), withOperationErrors(FamilyInviteLookupErrorSpec));
873
923
  const getFriendInvite = (code) => requestJson(FriendInviteEnvelopeSchema, {
874
924
  auth: { type: "none" },
875
925
  method: "GET",
876
- path: `/v2/registration/friend/${code}`
926
+ path: `/v2/registration/friend/${encodePathSegment(code)}`
877
927
  }).pipe(selectJsonField("invite"), withOperationErrors(FriendInviteLookupErrorSpec));
878
928
  const forgotPassword = (mail) => requestJson(OkResponseSchema, {
879
929
  auth: { type: "none" },
@@ -908,7 +958,7 @@ const getCode = (input) => requestJson(AuthorizationCodeEnvelopeSchema, {
908
958
  const checkCodeMatch = (code) => requestJson(CodeMatchEnvelopeSchema, {
909
959
  auth: { type: "none" },
910
960
  method: "GET",
911
- path: `/v2/oauth2/oob/code/${code}`
961
+ path: `/v2/oauth2/oob/code/${encodePathSegment(code)}`
912
962
  }).pipe(selectJsonField("oauth_token"));
913
963
  const linkDevice = (code) => requestJson(LinkDeviceEnvelopeSchema, {
914
964
  body: {
@@ -924,7 +974,7 @@ const grants = () => requestJson(GrantsEnvelopeSchema, {
924
974
  }).pipe(selectJsonField("apps"), withOperationErrors(GrantsErrorSpec));
925
975
  const revokeApp = (id) => requestJson(OkResponseSchema, {
926
976
  method: "POST",
927
- path: `/v2/oauth/grants/${id}/delete`
977
+ path: `/v2/oauth/grants/${encodePathSegment(id)}/delete`
928
978
  }).pipe(withOperationErrors(RevokeOAuthGrantErrorSpec));
929
979
  const clients = () => requestJson(ClientsEnvelopeSchema, {
930
980
  method: "GET",
@@ -932,7 +982,7 @@ const clients = () => requestJson(ClientsEnvelopeSchema, {
932
982
  }).pipe(selectJsonField("clients"), withOperationErrors(ClientsErrorSpec));
933
983
  const revokeClient = (id) => requestJson(OkResponseSchema, {
934
984
  method: "POST",
935
- path: `/v2/oauth/clients/${id}/delete`
985
+ path: `/v2/oauth/clients/${encodePathSegment(id)}/delete`
936
986
  }).pipe(withOperationErrors(RevokeOAuthClientErrorSpec));
937
987
  const revokeAllClients = () => requestJson(OkResponseSchema, {
938
988
  method: "POST",
@@ -982,8 +1032,8 @@ const isJsonValue = (value) => {
982
1032
  return false;
983
1033
  };
984
1034
  const isJsonObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && isJsonValue(value);
985
- const JsonValueSchema = Schema.Unknown.pipe(Schema.filter(isJsonValue, { message: () => "Expected a JSON-compatible value" }));
986
- const JsonObjectSchema = Schema.Unknown.pipe(Schema.filter(isJsonObject, { message: () => "Expected a JSON object" }));
1035
+ const JsonValueSchema = Schema.Unknown.pipe(Schema.refine(isJsonValue, { expected: "a JSON-compatible value" }));
1036
+ const JsonObjectSchema = Schema.Unknown.pipe(Schema.refine(isJsonObject, { expected: "a JSON object" }));
987
1037
  const ConfigEnvelopeSchema = Schema.Struct({
988
1038
  config: JsonObjectSchema,
989
1039
  status: Schema.Literal("OK")
@@ -1002,7 +1052,7 @@ const readConfigWith = (schema) => requestJson(Schema.Struct({
1002
1052
  }), {
1003
1053
  method: "GET",
1004
1054
  path: "/v2/config"
1005
- }).pipe(selectJsonField("config"));
1055
+ }).pipe(Effect.map((envelope) => envelope["config"]));
1006
1056
  const writeConfig = (config) => requestJson(OkResponseSchema, {
1007
1057
  body: {
1008
1058
  type: "json",
@@ -1013,34 +1063,39 @@ const writeConfig = (config) => requestJson(OkResponseSchema, {
1013
1063
  });
1014
1064
  const getConfigKey = (key) => requestJson(ConfigValueEnvelopeSchema, {
1015
1065
  method: "GET",
1016
- path: `/v2/config/${key}`
1066
+ path: `/v2/config/${encodePathSegment(key)}`
1017
1067
  }).pipe(selectJsonField("value"));
1018
1068
  const getConfigKeyWith = (key, schema) => requestJson(Schema.Struct({
1019
1069
  status: Schema.Literal("OK"),
1020
1070
  value: schema
1021
1071
  }), {
1022
1072
  method: "GET",
1023
- path: `/v2/config/${key}`
1024
- }).pipe(selectJsonField("value"));
1073
+ path: `/v2/config/${encodePathSegment(key)}`
1074
+ }).pipe(Effect.map((envelope) => envelope["value"]));
1025
1075
  const setConfigKey = (key, value) => requestJson(OkResponseSchema, {
1026
1076
  body: {
1027
1077
  type: "json",
1028
1078
  value: { value }
1029
1079
  },
1030
1080
  method: "PUT",
1031
- path: `/v2/config/${key}`
1081
+ path: `/v2/config/${encodePathSegment(key)}`
1032
1082
  });
1033
1083
  const deleteConfigKey = (key) => requestJson(OkResponseSchema, {
1034
1084
  method: "DELETE",
1035
- path: `/v2/config/${key}`
1085
+ path: `/v2/config/${encodePathSegment(key)}`
1036
1086
  });
1037
1087
  //#endregion
1038
1088
  //#region src/domains/download-links.ts
1039
- const DownloadLinksStatusSchema = Schema.Literal("NEW", "PROCESSING", "DONE", "ERROR");
1089
+ const DownloadLinksStatusSchema = Schema.Literals([
1090
+ "NEW",
1091
+ "PROCESSING",
1092
+ "DONE",
1093
+ "ERROR"
1094
+ ]);
1040
1095
  const DownloadLinksCreateInputSchema = Schema.Struct({
1041
1096
  cursor: Schema.optional(Schema.String),
1042
- excludeIds: Schema.optional(Schema.Array(Schema.Number.pipe(Schema.int(), Schema.nonNegative()))),
1043
- ids: Schema.optional(Schema.Array(Schema.Number.pipe(Schema.int(), Schema.nonNegative())))
1097
+ excludeIds: Schema.optional(Schema.Array(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))),
1098
+ ids: Schema.optional(Schema.Array(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))))
1044
1099
  });
1045
1100
  const DownloadLinksPayloadSchema = Schema.Struct({
1046
1101
  download_links: Schema.Array(Schema.String),
@@ -1048,13 +1103,13 @@ const DownloadLinksPayloadSchema = Schema.Struct({
1048
1103
  mp4_links: Schema.Array(Schema.String)
1049
1104
  });
1050
1105
  const DownloadLinksCreateEnvelopeSchema = Schema.Struct({
1051
- id: Schema.Number.pipe(Schema.int(), Schema.positive()),
1106
+ id: Schema.Int.check(Schema.isGreaterThan(0)),
1052
1107
  status: Schema.Literal("OK")
1053
1108
  });
1054
1109
  const DownloadLinksPendingEnvelopeSchema = Schema.Struct({
1055
1110
  error_msg: Schema.optional(Schema.NullOr(Schema.String)),
1056
1111
  links: Schema.Null,
1057
- links_status: Schema.Literal("NEW", "PROCESSING"),
1112
+ links_status: Schema.Literals(["NEW", "PROCESSING"]),
1058
1113
  status: Schema.Literal("OK")
1059
1114
  });
1060
1115
  const DownloadLinksDoneEnvelopeSchema = Schema.Struct({
@@ -1069,7 +1124,11 @@ const DownloadLinksErrorEnvelopeSchema = Schema.Struct({
1069
1124
  links_status: Schema.Literal("ERROR"),
1070
1125
  status: Schema.Literal("OK")
1071
1126
  });
1072
- const DownloadLinksInfoSchema = Schema.Union(DownloadLinksPendingEnvelopeSchema, DownloadLinksDoneEnvelopeSchema, DownloadLinksErrorEnvelopeSchema);
1127
+ const DownloadLinksInfoSchema = Schema.Union([
1128
+ DownloadLinksPendingEnvelopeSchema,
1129
+ DownloadLinksDoneEnvelopeSchema,
1130
+ DownloadLinksErrorEnvelopeSchema
1131
+ ]);
1073
1132
  const CreateDownloadLinksErrorSpec = definePutioOperationErrorSpec({
1074
1133
  domain: "downloadLinks",
1075
1134
  operation: "create",
@@ -1122,78 +1181,103 @@ const createDownloadLinks = (input = {}) => requestJson(DownloadLinksCreateEnvel
1122
1181
  }).pipe(selectJsonFields("id"), withOperationErrors(CreateDownloadLinksErrorSpec));
1123
1182
  const getDownloadLinks = (id) => requestJson(DownloadLinksInfoSchema, {
1124
1183
  method: "GET",
1125
- path: `/v2/download_links/${id}`
1184
+ path: `/v2/download_links/${encodePathSegment(id)}`
1126
1185
  }).pipe(withOperationErrors(GetDownloadLinksErrorSpec));
1127
1186
  //#endregion
1128
1187
  //#region src/domains/events.ts
1129
1188
  const HistoryEventBaseSchema = Schema.Struct({
1130
1189
  created_at: Schema.String,
1131
- id: Schema.Number.pipe(Schema.int()),
1190
+ id: Schema.Int,
1132
1191
  type: Schema.String,
1133
- user_id: Schema.Number.pipe(Schema.int())
1192
+ user_id: Schema.Int
1134
1193
  });
1135
- const HistoryFileEventSchema = Schema.extend(HistoryEventBaseSchema, Schema.Struct({
1136
- file_id: Schema.Number.pipe(Schema.int()),
1194
+ const HistoryFileEventSchema = HistoryEventBaseSchema.pipe(Schema.fieldsAssign({
1195
+ file_id: Schema.Int,
1137
1196
  file_name: Schema.String,
1138
- file_size: Schema.Number.pipe(Schema.nonNegative())
1197
+ file_size: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0))
1139
1198
  }));
1140
- const HistoryTransferEventSchema = Schema.extend(HistoryEventBaseSchema, Schema.Struct({
1199
+ const HistoryTransferEventSchema = HistoryEventBaseSchema.pipe(Schema.fieldsAssign({
1141
1200
  source: Schema.String,
1142
1201
  transfer_name: Schema.String
1143
1202
  }));
1144
- const HistoryFileSharedEventSchema = Schema.extend(HistoryFileEventSchema.pipe(Schema.omit("type")), Schema.Struct({
1203
+ const HistoryFileSharedEventSchema = HistoryFileEventSchema.mapFields(({ type: _type, ...fields }) => fields).pipe(Schema.fieldsAssign({
1145
1204
  sharing_user_name: Schema.String,
1146
1205
  type: Schema.Literal("file_shared")
1147
1206
  }));
1148
- const HistoryUploadEventSchema = Schema.extend(HistoryFileEventSchema.pipe(Schema.omit("type")), Schema.Struct({ type: Schema.Literal("upload") }));
1149
- const HistoryFileFromRssDeletedEventSchema = Schema.extend(HistoryFileEventSchema.pipe(Schema.omit("type")), Schema.Struct({
1207
+ const HistoryUploadEventSchema = HistoryFileEventSchema.mapFields(({ type: _type, ...fields }) => fields).pipe(Schema.fieldsAssign({ type: Schema.Literal("upload") }));
1208
+ const HistoryFileFromRssDeletedEventSchema = HistoryFileEventSchema.mapFields(({ type: _type, ...fields }) => fields).pipe(Schema.fieldsAssign({
1150
1209
  file_source: Schema.String,
1151
1210
  type: Schema.Literal("file_from_rss_deleted_for_space")
1152
1211
  }));
1153
- const HistoryTransferCompletedEventSchema = Schema.extend(HistoryTransferEventSchema.pipe(Schema.omit("type")), Schema.Struct({
1154
- file_id: Schema.Number.pipe(Schema.int()),
1155
- transfer_size: Schema.Number.pipe(Schema.nonNegative()),
1212
+ const HistoryTransferCompletedEventSchema = HistoryTransferEventSchema.mapFields(({ type: _type, ...fields }) => fields).pipe(Schema.fieldsAssign({
1213
+ file_id: Schema.Int,
1214
+ transfer_size: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
1156
1215
  type: Schema.Literal("transfer_completed")
1157
1216
  }));
1158
- const HistoryTransferErrorEventSchema = Schema.extend(HistoryTransferEventSchema.pipe(Schema.omit("type")), Schema.Struct({ type: Schema.Literal("transfer_error") }));
1159
- const HistoryTransferFromRssErrorEventSchema = Schema.extend(HistoryEventBaseSchema.pipe(Schema.omit("type")), Schema.Struct({
1160
- rss_id: Schema.Number.pipe(Schema.int()),
1217
+ const HistoryTransferErrorEventSchema = HistoryTransferEventSchema.mapFields(({ type: _type, ...fields }) => fields).pipe(Schema.fieldsAssign({ type: Schema.Literal("transfer_error") }));
1218
+ const HistoryTransferFromRssErrorEventSchema = HistoryEventBaseSchema.mapFields(({ type: _type, ...fields }) => fields).pipe(Schema.fieldsAssign({
1219
+ rss_id: Schema.Int,
1161
1220
  transfer_name: Schema.String,
1162
1221
  type: Schema.Literal("transfer_from_rss_error")
1163
1222
  }));
1164
- const HistoryTransferCallbackErrorEventSchema = Schema.extend(HistoryEventBaseSchema.pipe(Schema.omit("type")), Schema.Struct({
1223
+ const HistoryTransferCallbackErrorEventSchema = HistoryEventBaseSchema.mapFields(({ type: _type, ...fields }) => fields).pipe(Schema.fieldsAssign({
1165
1224
  message: Schema.String,
1166
- transfer_id: Schema.Number.pipe(Schema.int()),
1225
+ transfer_id: Schema.Int,
1167
1226
  transfer_name: Schema.String,
1168
1227
  type: Schema.Literal("transfer_callback_error")
1169
1228
  }));
1170
- const HistoryPrivateTorrentPinEventSchema = Schema.extend(HistoryEventBaseSchema.pipe(Schema.omit("type")), Schema.Struct({
1229
+ const HistoryPrivateTorrentPinEventSchema = HistoryEventBaseSchema.mapFields(({ type: _type, ...fields }) => fields).pipe(Schema.fieldsAssign({
1171
1230
  new_host_ip: Schema.String,
1172
1231
  pinned_host_ip: Schema.String,
1173
1232
  type: Schema.Literal("private_torrent_pin"),
1174
1233
  user_download_name: Schema.String
1175
1234
  }));
1176
- const HistoryRssFilterPausedEventSchema = Schema.extend(HistoryEventBaseSchema.pipe(Schema.omit("type")), Schema.Struct({
1177
- rss_filter_id: Schema.Number.pipe(Schema.int()),
1235
+ const HistoryRssFilterPausedEventSchema = HistoryEventBaseSchema.mapFields(({ type: _type, ...fields }) => fields).pipe(Schema.fieldsAssign({
1236
+ rss_filter_id: Schema.Int,
1178
1237
  rss_filter_title: Schema.String,
1179
1238
  type: Schema.Literal("rss_filter_paused")
1180
1239
  }));
1181
- const HistoryVoucherEventSchema = Schema.extend(HistoryEventBaseSchema.pipe(Schema.omit("type")), Schema.Struct({
1240
+ const HistoryVoucherEventSchema = HistoryEventBaseSchema.mapFields(({ type: _type, ...fields }) => fields).pipe(Schema.fieldsAssign({
1182
1241
  type: Schema.Literal("voucher"),
1183
- voucher: Schema.Number.pipe(Schema.int()),
1184
- voucher_owner_id: Schema.Number.pipe(Schema.int()),
1242
+ voucher: Schema.Int,
1243
+ voucher_owner_id: Schema.Int,
1185
1244
  voucher_owner_name: Schema.String
1186
1245
  }));
1187
- const HistoryZipCreatedEventSchema = Schema.extend(HistoryEventBaseSchema.pipe(Schema.omit("type")), Schema.Struct({
1246
+ const HistoryZipCreatedEventSchema = HistoryEventBaseSchema.mapFields(({ type: _type, ...fields }) => fields).pipe(Schema.fieldsAssign({
1188
1247
  type: Schema.Literal("zip_created"),
1189
- zip_id: Schema.Number.pipe(Schema.int()),
1190
- zip_size: Schema.Number.pipe(Schema.nonNegative())
1248
+ zip_id: Schema.Int,
1249
+ zip_size: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0))
1191
1250
  }));
1192
- const HistoryKnownEventTypeSchema = Schema.Literal("file_shared", "upload", "file_from_rss_deleted_for_space", "transfer_completed", "transfer_error", "transfer_from_rss_error", "transfer_callback_error", "private_torrent_pin", "rss_filter_paused", "voucher", "zip_created");
1193
- const HistoryEventSchema = Schema.Union(HistoryFileSharedEventSchema, HistoryUploadEventSchema, HistoryFileFromRssDeletedEventSchema, HistoryTransferCompletedEventSchema, HistoryTransferErrorEventSchema, HistoryTransferFromRssErrorEventSchema, HistoryTransferCallbackErrorEventSchema, HistoryPrivateTorrentPinEventSchema, HistoryRssFilterPausedEventSchema, HistoryVoucherEventSchema, HistoryZipCreatedEventSchema, HistoryEventBaseSchema);
1251
+ const HistoryKnownEventTypeSchema = Schema.Literals([
1252
+ "file_shared",
1253
+ "upload",
1254
+ "file_from_rss_deleted_for_space",
1255
+ "transfer_completed",
1256
+ "transfer_error",
1257
+ "transfer_from_rss_error",
1258
+ "transfer_callback_error",
1259
+ "private_torrent_pin",
1260
+ "rss_filter_paused",
1261
+ "voucher",
1262
+ "zip_created"
1263
+ ]);
1264
+ const HistoryEventSchema = Schema.Union([
1265
+ HistoryFileSharedEventSchema,
1266
+ HistoryUploadEventSchema,
1267
+ HistoryFileFromRssDeletedEventSchema,
1268
+ HistoryTransferCompletedEventSchema,
1269
+ HistoryTransferErrorEventSchema,
1270
+ HistoryTransferFromRssErrorEventSchema,
1271
+ HistoryTransferCallbackErrorEventSchema,
1272
+ HistoryPrivateTorrentPinEventSchema,
1273
+ HistoryRssFilterPausedEventSchema,
1274
+ HistoryVoucherEventSchema,
1275
+ HistoryZipCreatedEventSchema,
1276
+ HistoryEventBaseSchema
1277
+ ]);
1194
1278
  const EventsListQuerySchema = Schema.Struct({
1195
- before: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.positive())),
1196
- per_page: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.positive()))
1279
+ before: Schema.optional(Schema.Int.check(Schema.isGreaterThan(0))),
1280
+ per_page: Schema.optional(Schema.Int.check(Schema.isGreaterThan(0)))
1197
1281
  });
1198
1282
  const EventsListEnvelopeSchema = Schema.Struct({
1199
1283
  events: Schema.Array(HistoryEventSchema),
@@ -1254,7 +1338,7 @@ const listEvents = (query = {}) => requestJson(EventsListEnvelopeSchema, {
1254
1338
  }).pipe(withOperationErrors(ListEventsErrorSpec));
1255
1339
  const deleteEvent = (id) => requestJson(OkResponseSchema, {
1256
1340
  method: "POST",
1257
- path: `/v2/events/delete/${id}`
1341
+ path: `/v2/events/delete/${encodePathSegment(id)}`
1258
1342
  }).pipe(withOperationErrors(DeleteEventErrorSpec));
1259
1343
  const clearEvents = () => requestJson(OkResponseSchema, {
1260
1344
  method: "POST",
@@ -1262,22 +1346,22 @@ const clearEvents = () => requestJson(OkResponseSchema, {
1262
1346
  }).pipe(withOperationErrors(ClearEventsErrorSpec));
1263
1347
  const getEventTorrent = (id) => requestArrayBuffer({
1264
1348
  method: "GET",
1265
- path: `/v2/events/${id}/torrent`
1349
+ path: `/v2/events/${encodePathSegment(id)}/torrent`
1266
1350
  }).pipe(withOperationErrors(GetEventTorrentErrorSpec));
1267
1351
  //#endregion
1268
1352
  //#region src/domains/family.ts
1269
- const NonNegativeIntegerSchema = Schema.Number.pipe(Schema.int(), Schema.nonNegative());
1270
- const NonNegativeIntegerFromStringSchema = Schema.NumberFromString.pipe(Schema.int(), Schema.nonNegative());
1353
+ const NonNegativeIntegerSchema = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
1354
+ const NonNegativeIntegerFromStringSchema = Schema.NumberFromString.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0));
1271
1355
  const FamilyInviteSchema = Schema.Struct({
1272
1356
  code: Schema.String,
1273
1357
  created_at: Schema.String,
1274
- user_id: Schema.NullOr(Schema.Number.pipe(Schema.int()))
1358
+ user_id: Schema.NullOr(Schema.Int)
1275
1359
  });
1276
1360
  const FamilyMemberSchema = Schema.Struct({
1277
1361
  avatar_url: Schema.String,
1278
1362
  created_at: Schema.String,
1279
- disk_used: Schema.Union(NonNegativeIntegerSchema, NonNegativeIntegerFromStringSchema),
1280
- id: Schema.Number.pipe(Schema.int(), Schema.positive()),
1363
+ disk_used: Schema.Union([NonNegativeIntegerSchema, NonNegativeIntegerFromStringSchema]),
1364
+ id: Schema.Int.check(Schema.isGreaterThan(0)),
1281
1365
  is_owner: Schema.Boolean,
1282
1366
  name: Schema.String
1283
1367
  });
@@ -1384,11 +1468,11 @@ const createFamilyInvite = () => requestJson(FamilyCreateInviteEnvelopeSchema, {
1384
1468
  }).pipe(selectJsonFields("code"), withOperationErrors(CreateFamilyInviteErrorSpec));
1385
1469
  const removeFamilyMember = (username) => requestJson(OkResponseSchema, {
1386
1470
  method: "DELETE",
1387
- path: `/v2/family/sub_account/${encodeURIComponent(username)}`
1471
+ path: `/v2/family/sub_account/${encodePathSegment(username)}`
1388
1472
  }).pipe(Effect.asVoid, withOperationErrors(RemoveFamilyMemberErrorSpec));
1389
1473
  const joinFamily = (inviteCode) => requestJson(OkResponseSchema, {
1390
1474
  method: "POST",
1391
- path: `/v2/family/join/${encodeURIComponent(inviteCode)}`
1475
+ path: `/v2/family/join/${encodePathSegment(inviteCode)}`
1392
1476
  }).pipe(Effect.asVoid, withOperationErrors(JoinFamilyErrorSpec));
1393
1477
  //#endregion
1394
1478
  //#region src/domains/ifttt.ts
@@ -1440,30 +1524,57 @@ const sendIftttEvent = (input) => requestJson(OkResponseSchema, {
1440
1524
  //#endregion
1441
1525
  //#region src/domains/files.ts
1442
1526
  const RequestedFlag = Schema.Literal(1);
1443
- const FileTypeSchema = Schema.Literal("FOLDER", "FILE", "AUDIO", "VIDEO", "IMAGE", "ARCHIVE", "PDF", "TEXT", "SWF");
1444
- const FolderTypeSchema = Schema.Literal("REGULAR", "SHARED_ROOT", "SHARED_FRIEND");
1445
- const FileSortSchema = Schema.Literal("NAME_ASC", "NAME_DESC", "SIZE_ASC", "SIZE_DESC", "DATE_ASC", "DATE_DESC", "MODIFIED_ASC", "MODIFIED_DESC", "TYPE_ASC", "TYPE_DESC", "WATCH_ASC", "WATCH_DESC");
1527
+ const FileTypeSchema = Schema.Literals([
1528
+ "FOLDER",
1529
+ "FILE",
1530
+ "AUDIO",
1531
+ "VIDEO",
1532
+ "IMAGE",
1533
+ "ARCHIVE",
1534
+ "PDF",
1535
+ "TEXT",
1536
+ "SWF"
1537
+ ]);
1538
+ const FolderTypeSchema = Schema.Literals([
1539
+ "REGULAR",
1540
+ "SHARED_ROOT",
1541
+ "SHARED_FRIEND"
1542
+ ]);
1543
+ const FileSortSchema = Schema.Literals([
1544
+ "NAME_ASC",
1545
+ "NAME_DESC",
1546
+ "SIZE_ASC",
1547
+ "SIZE_DESC",
1548
+ "DATE_ASC",
1549
+ "DATE_DESC",
1550
+ "MODIFIED_ASC",
1551
+ "MODIFIED_DESC",
1552
+ "TYPE_ASC",
1553
+ "TYPE_DESC",
1554
+ "WATCH_ASC",
1555
+ "WATCH_DESC"
1556
+ ]);
1446
1557
  const FileMediaMetadataSchema = Schema.Struct({
1447
- aspect_ratio: Schema.optional(Schema.NullOr(Schema.Number.pipe(Schema.nonNegative()))),
1558
+ aspect_ratio: Schema.optional(Schema.NullOr(Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)))),
1448
1559
  codec: Schema.optional(Schema.NullOr(Schema.String)),
1449
- duration: Schema.optional(Schema.NullOr(Schema.Number.pipe(Schema.nonNegative()))),
1450
- height: Schema.optional(Schema.NullOr(Schema.Number.pipe(Schema.int(), Schema.nonNegative()))),
1451
- width: Schema.optional(Schema.NullOr(Schema.Number.pipe(Schema.int(), Schema.nonNegative())))
1560
+ duration: Schema.optional(Schema.NullOr(Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)))),
1561
+ height: Schema.optional(Schema.NullOr(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))),
1562
+ width: Schema.optional(Schema.NullOr(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))))
1452
1563
  });
1453
1564
  const FileMediaInfoFormatSchema = Schema.Struct({
1454
- bit_rate: Schema.optional(Schema.Number.pipe(Schema.nonNegative())),
1455
- duration: Schema.optional(Schema.Number.pipe(Schema.nonNegative())),
1565
+ bit_rate: Schema.optional(Schema.Number.check(Schema.isGreaterThanOrEqualTo(0))),
1566
+ duration: Schema.optional(Schema.Number.check(Schema.isGreaterThanOrEqualTo(0))),
1456
1567
  name: Schema.optional(Schema.String)
1457
1568
  });
1458
1569
  const FileMediaInfoStreamSchema = Schema.Struct({
1459
- channels: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.nonNegative())),
1570
+ channels: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
1460
1571
  codec_name: Schema.optional(Schema.String),
1461
1572
  codec_type: Schema.optional(Schema.String),
1462
- height: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.nonNegative())),
1463
- level: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.nonNegative())),
1573
+ height: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
1574
+ level: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
1464
1575
  profile: Schema.optional(Schema.String),
1465
1576
  rfc6381_codec: Schema.optional(Schema.String),
1466
- width: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.nonNegative()))
1577
+ width: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))
1467
1578
  });
1468
1579
  const FileMediaInfoSchema = Schema.Struct({
1469
1580
  format: Schema.optional(Schema.NullOr(FileMediaInfoFormatSchema)),
@@ -1479,24 +1590,24 @@ const FileBaseSchema = Schema.Struct({
1479
1590
  first_accessed_at: Schema.NullOr(Schema.String),
1480
1591
  folder_type: FolderTypeSchema,
1481
1592
  icon: Schema.NullOr(Schema.String),
1482
- id: Schema.Number.pipe(Schema.int()),
1593
+ id: Schema.Int,
1483
1594
  is_hidden: Schema.Boolean,
1484
1595
  is_mp4_available: Schema.Boolean,
1485
1596
  is_shared: Schema.Boolean,
1486
1597
  name: Schema.String,
1487
1598
  opensubtitles_hash: Schema.NullOr(Schema.String),
1488
- parent_id: Schema.NullOr(Schema.Number.pipe(Schema.int())),
1599
+ parent_id: Schema.NullOr(Schema.Int),
1489
1600
  screenshot: Schema.NullOr(Schema.String),
1490
1601
  sha1: Schema.optional(Schema.NullOr(Schema.String)),
1491
- size: Schema.Number.pipe(Schema.nonNegative()),
1492
- start_from: Schema.optional(Schema.Number.pipe(Schema.nonNegative())),
1602
+ size: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
1603
+ start_from: Schema.optional(Schema.Number.check(Schema.isGreaterThanOrEqualTo(0))),
1493
1604
  updated_at: Schema.String
1494
1605
  });
1495
- const FileBroadSchema = Schema.extend(FileBaseSchema, Schema.Struct({
1606
+ const FileBroadSchema = FileBaseSchema.pipe(Schema.fieldsAssign({
1496
1607
  content_type_and_codecs: Schema.optional(Schema.NullOr(Schema.String)),
1497
1608
  media_info: Schema.optional(Schema.NullOr(FileMediaInfoSchema)),
1498
1609
  media_metadata: Schema.optional(Schema.NullOr(FileMediaMetadataSchema)),
1499
- mp4_size: Schema.optional(Schema.NullOr(Schema.Number.pipe(Schema.nonNegative()))),
1610
+ mp4_size: Schema.optional(Schema.NullOr(Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)))),
1500
1611
  mp4_stream_url: Schema.optional(Schema.NullOr(Schema.String)),
1501
1612
  need_convert: Schema.optional(Schema.Boolean),
1502
1613
  sender_name: Schema.optional(Schema.String),
@@ -1513,7 +1624,7 @@ const FileQuerySchema = Schema.Struct({
1513
1624
  stream_url: Schema.optional(RequestedFlag),
1514
1625
  video_metadata: Schema.optional(RequestedFlag)
1515
1626
  });
1516
- const FilesListQuerySchema = Schema.extend(FileQuerySchema.pipe(Schema.omit("codecs", "media_info")), Schema.Struct({
1627
+ const FilesListQuerySchema = FileQuerySchema.mapFields(({ codecs: _codecs, media_info: _mediaInfo, ...fields }) => fields).pipe(Schema.fieldsAssign({
1517
1628
  breadcrumbs: Schema.optional(RequestedFlag),
1518
1629
  codecs_parent: Schema.optional(RequestedFlag),
1519
1630
  content_type: Schema.optional(Schema.String),
@@ -1524,7 +1635,7 @@ const FilesListQuerySchema = Schema.extend(FileQuerySchema.pipe(Schema.omit("cod
1524
1635
  mp4_status_parent: Schema.optional(RequestedFlag),
1525
1636
  mp4_stream_url_parent: Schema.optional(RequestedFlag),
1526
1637
  no_cursor: Schema.optional(RequestedFlag),
1527
- per_page: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.positive())),
1638
+ per_page: Schema.optional(Schema.Int.check(Schema.isGreaterThan(0))),
1528
1639
  sort: Schema.optional(FileSortSchema),
1529
1640
  sort_by: Schema.optional(FileSortSchema),
1530
1641
  stream_url_parent: Schema.optional(RequestedFlag),
@@ -1532,11 +1643,11 @@ const FilesListQuerySchema = Schema.extend(FileQuerySchema.pipe(Schema.omit("cod
1532
1643
  video_metadata_parent: Schema.optional(RequestedFlag)
1533
1644
  }));
1534
1645
  const FilesSearchQuerySchema = Schema.Struct({
1535
- per_page: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.positive())),
1646
+ per_page: Schema.optional(Schema.Int.check(Schema.isGreaterThan(0))),
1536
1647
  query: Schema.String,
1537
- type: Schema.optional(Schema.Union(FileTypeSchema, Schema.Array(FileTypeSchema)))
1648
+ type: Schema.optional(Schema.Union([FileTypeSchema, Schema.Array(FileTypeSchema)]))
1538
1649
  });
1539
- const FileBreadcrumbSchema = Schema.Tuple(Schema.Number.pipe(Schema.int()), Schema.String);
1650
+ const FileBreadcrumbSchema = Schema.Tuple([Schema.Int, Schema.String]);
1540
1651
  const FileEnvelopeSchema = Schema.Struct({
1541
1652
  file: FileBroadSchema,
1542
1653
  status: Schema.Literal("OK")
@@ -1547,7 +1658,7 @@ const FilesListEnvelopeSchema = Schema.Struct({
1547
1658
  files: Schema.Array(FileBroadSchema),
1548
1659
  parent: Schema.NullOr(FileBroadSchema),
1549
1660
  status: Schema.Literal("OK"),
1550
- total: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.nonNegative()))
1661
+ total: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))
1551
1662
  });
1552
1663
  const FilesListContinueEnvelopeSchema = Schema.Struct({
1553
1664
  breadcrumbs: Schema.optional(Schema.Array(FileBreadcrumbSchema)),
@@ -1555,29 +1666,29 @@ const FilesListContinueEnvelopeSchema = Schema.Struct({
1555
1666
  files: Schema.Array(FileBroadSchema),
1556
1667
  parent: Schema.optional(Schema.NullOr(FileBroadSchema)),
1557
1668
  status: Schema.Literal("OK"),
1558
- total: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.nonNegative()))
1669
+ total: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))
1559
1670
  });
1560
1671
  const FilesSearchEnvelopeSchema = Schema.Struct({
1561
1672
  cursor: Schema.NullOr(Schema.String),
1562
1673
  files: Schema.Array(FileBroadSchema),
1563
1674
  status: Schema.Literal("OK"),
1564
- total: Schema.Number.pipe(Schema.int(), Schema.nonNegative())
1675
+ total: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))
1565
1676
  });
1566
1677
  Schema.Struct({
1567
1678
  name: Schema.optional(Schema.String),
1568
- parent_id: Schema.optional(Schema.Number.pipe(Schema.int())),
1679
+ parent_id: Schema.optional(Schema.Int),
1569
1680
  path: Schema.optional(Schema.String)
1570
1681
  });
1571
1682
  Schema.Struct({
1572
- file_id: Schema.Number.pipe(Schema.int()),
1683
+ file_id: Schema.Int,
1573
1684
  name: Schema.String
1574
1685
  });
1575
1686
  Schema.Struct({
1576
- file_id: Schema.Number.pipe(Schema.int()),
1687
+ file_id: Schema.Int,
1577
1688
  time: Schema.Number
1578
1689
  });
1579
1690
  const FileStartFromEnvelopeSchema = Schema.Struct({
1580
- start_from: Schema.Number.pipe(Schema.nonNegative()),
1691
+ start_from: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
1581
1692
  status: Schema.Literal("OK")
1582
1693
  });
1583
1694
  const FileDownloadUrlEnvelopeSchema = Schema.Struct({
@@ -1585,7 +1696,7 @@ const FileDownloadUrlEnvelopeSchema = Schema.Struct({
1585
1696
  url: Schema.String
1586
1697
  });
1587
1698
  const FileUploadTransferSchema = Schema.Struct({
1588
- id: Schema.Number.pipe(Schema.int()),
1699
+ id: Schema.Int,
1589
1700
  name: Schema.String
1590
1701
  });
1591
1702
  const FileUploadEnvelopeSchema = Schema.Struct({
@@ -1593,35 +1704,53 @@ const FileUploadEnvelopeSchema = Schema.Struct({
1593
1704
  status: Schema.Literal("OK"),
1594
1705
  transfer: Schema.optional(FileUploadTransferSchema)
1595
1706
  });
1596
- const FileConversionStatusSchema = Schema.Union(Schema.Struct({
1597
- id: Schema.Number.pipe(Schema.int()),
1707
+ const FileConversionNotAvailableSchema = Schema.Struct({
1708
+ id: Schema.Int,
1598
1709
  status: Schema.Literal("NOT_AVAILABLE")
1599
- }), Schema.Struct({
1600
- id: Schema.Number.pipe(Schema.int()),
1601
- percent_done: Schema.Number.pipe(Schema.nonNegative()),
1710
+ });
1711
+ const FileConversionInQueueSchema = Schema.Struct({
1712
+ id: Schema.Int,
1713
+ percent_done: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
1602
1714
  status: Schema.Literal("IN_QUEUE")
1603
- }), Schema.Struct({
1604
- id: Schema.Number.pipe(Schema.int()),
1605
- percent_done: Schema.Number.pipe(Schema.nonNegative()),
1715
+ });
1716
+ const FileConversionConvertingSchema = Schema.Struct({
1717
+ id: Schema.Int,
1718
+ percent_done: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
1606
1719
  status: Schema.Literal("CONVERTING")
1607
- }), Schema.Struct({
1608
- id: Schema.Number.pipe(Schema.int()),
1609
- percent_done: Schema.Number.pipe(Schema.nonNegative()),
1610
- size: Schema.Number.pipe(Schema.nonNegative()),
1720
+ });
1721
+ const FileConversionCompletedSchema = Schema.Struct({
1722
+ id: Schema.Int,
1723
+ percent_done: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
1724
+ size: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
1611
1725
  status: Schema.Literal("COMPLETED")
1612
- }), Schema.Struct({
1613
- id: Schema.Number.pipe(Schema.int()),
1726
+ });
1727
+ const FileConversionErrorSchema = Schema.Struct({
1728
+ id: Schema.Int,
1614
1729
  status: Schema.Literal("ERROR")
1615
- }));
1730
+ });
1731
+ const FileConversionStatusSchema = Schema.Union([
1732
+ FileConversionNotAvailableSchema,
1733
+ FileConversionInQueueSchema,
1734
+ FileConversionConvertingSchema,
1735
+ FileConversionCompletedSchema,
1736
+ FileConversionErrorSchema
1737
+ ]);
1616
1738
  const FileConversionStatusEnvelopeSchema = Schema.Struct({
1617
1739
  mp4: FileConversionStatusSchema,
1618
1740
  status: Schema.Literal("OK")
1619
1741
  });
1620
1742
  const FilesBulkConvertEnvelopeSchema = Schema.Struct({
1621
- count: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
1743
+ count: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
1622
1744
  status: Schema.Literal("OK")
1623
1745
  });
1624
- const FileActiveConversionSchema = Schema.extend(FileConversionStatusSchema, Schema.Struct({ name: Schema.String }));
1746
+ const ActiveConversionFields = { name: Schema.String };
1747
+ const FileActiveConversionSchema = Schema.Union([
1748
+ FileConversionNotAvailableSchema.pipe(Schema.fieldsAssign(ActiveConversionFields)),
1749
+ FileConversionInQueueSchema.pipe(Schema.fieldsAssign(ActiveConversionFields)),
1750
+ FileConversionConvertingSchema.pipe(Schema.fieldsAssign(ActiveConversionFields)),
1751
+ FileConversionCompletedSchema.pipe(Schema.fieldsAssign(ActiveConversionFields)),
1752
+ FileConversionErrorSchema.pipe(Schema.fieldsAssign(ActiveConversionFields))
1753
+ ]);
1625
1754
  const FileActiveConversionsEnvelopeSchema = Schema.Struct({ mp4s: Schema.Array(FileActiveConversionSchema) });
1626
1755
  const FileSubtitleSchema = Schema.Struct({
1627
1756
  format: Schema.String,
@@ -1638,26 +1767,34 @@ const FileSubtitlesEnvelopeSchema = Schema.Struct({
1638
1767
  });
1639
1768
  const FileDeleteResultEnvelopeSchema = Schema.Struct({
1640
1769
  cursor: Schema.NullOr(Schema.String),
1641
- skipped: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
1770
+ skipped: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
1642
1771
  status: Schema.Literal("OK")
1643
1772
  });
1644
1773
  const FilesMoveErrorSchema = Schema.Struct({
1645
1774
  error_type: Schema.String,
1646
- id: Schema.Number.pipe(Schema.int()),
1775
+ id: Schema.Int,
1647
1776
  name: Schema.NullOr(Schema.String),
1648
- status_code: Schema.Number.pipe(Schema.int())
1777
+ status_code: Schema.Int
1649
1778
  });
1650
1779
  const FilesMoveEnvelopeSchema = Schema.Struct({
1651
1780
  errors: Schema.Array(FilesMoveErrorSchema),
1652
1781
  status: Schema.Literal("OK")
1653
1782
  });
1654
- const FileExtractionStatusSchema = Schema.Literal("ERROR", "EXTRACTED", "EXTRACTING", "NEW", "PASSWORD", "PASSWORD_OBTAINED", "SENT_TO_QUEUE");
1783
+ const FileExtractionStatusSchema = Schema.Literals([
1784
+ "ERROR",
1785
+ "EXTRACTED",
1786
+ "EXTRACTING",
1787
+ "NEW",
1788
+ "PASSWORD",
1789
+ "PASSWORD_OBTAINED",
1790
+ "SENT_TO_QUEUE"
1791
+ ]);
1655
1792
  const FileExtractionSchema = Schema.Struct({
1656
- files: Schema.Array(Schema.Number.pipe(Schema.int())),
1657
- id: Schema.Number.pipe(Schema.int()),
1793
+ files: Schema.Array(Schema.Int),
1794
+ id: Schema.Int,
1658
1795
  message: Schema.NullOr(Schema.String),
1659
1796
  name: Schema.String,
1660
- num_parts: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
1797
+ num_parts: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
1661
1798
  status: FileExtractionStatusSchema
1662
1799
  });
1663
1800
  const FileExtractionsEnvelopeSchema = Schema.Struct({
@@ -1666,13 +1803,13 @@ const FileExtractionsEnvelopeSchema = Schema.Struct({
1666
1803
  });
1667
1804
  Schema.Struct({
1668
1805
  cursor: Schema.optional(Schema.String),
1669
- excludeIds: Schema.optional(Schema.Array(Schema.Number.pipe(Schema.int()))),
1670
- ids: Schema.optional(Schema.Array(Schema.Number.pipe(Schema.int())))
1806
+ excludeIds: Schema.optional(Schema.Array(Schema.Int)),
1807
+ ids: Schema.optional(Schema.Array(Schema.Int))
1671
1808
  });
1672
1809
  const FilesNextFileSchema = Schema.Struct({
1673
- id: Schema.Number.pipe(Schema.int()),
1810
+ id: Schema.Int,
1674
1811
  name: Schema.String,
1675
- parent_id: Schema.NullOr(Schema.Number.pipe(Schema.int()))
1812
+ parent_id: Schema.NullOr(Schema.Int)
1676
1813
  });
1677
1814
  const FilesNextFileEnvelopeSchema = Schema.Struct({
1678
1815
  next_file: FilesNextFileSchema,
@@ -1940,20 +2077,20 @@ const toUploadResult = (value) => {
1940
2077
  };
1941
2078
  throw new PutioValidationError({ cause: "Expected put.io upload response to contain either \"file\" or \"transfer\"" });
1942
2079
  };
1943
- const buildFileApiDownloadUrl = (baseUrl, fileId, options = {}) => buildPutioUrl(baseUrl, options.name ? `/v2/files/${fileId}/download/${normalizeFileName(options.name)}` : `/v2/files/${fileId}/download`, {
2080
+ const buildFileApiDownloadUrl = (baseUrl, fileId, options = {}) => buildPutioUrl(baseUrl, options.name ? `/v2/files/${encodePathSegment(fileId)}/download/${normalizeFileName(options.name)}` : `/v2/files/${encodePathSegment(fileId)}/download`, {
1944
2081
  ...useTunnelToQuery(options.useTunnel),
1945
2082
  oauth_token: options.oauthToken
1946
2083
  });
1947
- const buildFileApiContentUrl = (baseUrl, fileId, options = {}) => buildPutioUrl(baseUrl, `/v2/files/${fileId}/stream`, {
2084
+ const buildFileApiContentUrl = (baseUrl, fileId, options = {}) => buildPutioUrl(baseUrl, `/v2/files/${encodePathSegment(fileId)}/stream`, {
1948
2085
  ...useTunnelToQuery(options.useTunnel),
1949
2086
  oauth_token: options.oauthToken
1950
2087
  });
1951
- const buildFileApiMp4DownloadUrl = (baseUrl, fileId, options = {}) => buildPutioUrl(baseUrl, options.name ? `/v2/files/${fileId}/mp4/download/${normalizeFileName(options.name)}` : `/v2/files/${fileId}/mp4/download`, {
2088
+ const buildFileApiMp4DownloadUrl = (baseUrl, fileId, options = {}) => buildPutioUrl(baseUrl, options.name ? `/v2/files/${encodePathSegment(fileId)}/mp4/download/${normalizeFileName(options.name)}` : `/v2/files/${encodePathSegment(fileId)}/mp4/download`, {
1952
2089
  ...useTunnelToQuery(options.useTunnel),
1953
2090
  convert: options.convert ? 1 : void 0,
1954
2091
  oauth_token: options.oauthToken
1955
2092
  });
1956
- const buildFileHlsStreamUrl = (baseUrl, fileId, options = {}) => buildPutioUrl(baseUrl, `/v2/files/${fileId}/hls/media.m3u8`, {
2093
+ const buildFileHlsStreamUrl = (baseUrl, fileId, options = {}) => buildPutioUrl(baseUrl, `/v2/files/${encodePathSegment(fileId)}/hls/media.m3u8`, {
1957
2094
  max_subtitle_count: options.maxSubtitleCount,
1958
2095
  oauth_token: options.oauthToken,
1959
2096
  original: typeof options.playOriginal === "boolean" ? options.playOriginal ? 1 : 0 : void 0,
@@ -1995,9 +2132,10 @@ const continueFiles = (cursor, query = {}) => requestJson(FilesListContinueEnvel
1995
2132
  query
1996
2133
  }).pipe(withOperationErrors(ContinueFilesErrorSpec));
1997
2134
  function getFile(input) {
2135
+ if (input.query === null) return Effect.fail(new PutioValidationError({ cause: "getFile query must be an object when provided" }));
1998
2136
  const effect = requestJson(FileEnvelopeSchema, {
1999
2137
  method: "GET",
2000
- path: `/v2/files/${input.id}`,
2138
+ path: `/v2/files/${encodePathSegment(input.id)}`,
2001
2139
  query: input.query
2002
2140
  }).pipe(selectJsonField("file"), withOperationErrors(GetFileErrorSpec));
2003
2141
  if (input.query === void 0) return effect;
@@ -2084,11 +2222,11 @@ const moveFileSelection = (selection, parentId) => requestJson(FilesMoveEnvelope
2084
2222
  }).pipe(selectJsonField("errors"));
2085
2223
  const getStartFrom = (fileId) => requestJson(FileStartFromEnvelopeSchema, {
2086
2224
  method: "GET",
2087
- path: `/v2/files/${fileId}/start-from`
2225
+ path: `/v2/files/${encodePathSegment(fileId)}/start-from`
2088
2226
  }).pipe(selectJsonField("start_from"), withOperationErrors(StartFromErrorSpec));
2089
2227
  const getDownloadUrl = (fileId) => requestJson(FileDownloadUrlEnvelopeSchema, {
2090
2228
  method: "GET",
2091
- path: `/v2/files/${fileId}/url`
2229
+ path: `/v2/files/${encodePathSegment(fileId)}/url`
2092
2230
  }).pipe(selectJsonField("url"), withOperationErrors(DownloadUrlErrorSpec));
2093
2231
  const getApiDownloadUrl = (fileId, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => buildFileApiDownloadUrl(config.baseUrl ?? "https://api.put.io", fileId, {
2094
2232
  ...options,
@@ -2108,7 +2246,7 @@ const getHlsStreamUrl = (fileId, options = {}) => resolveRouteContext(options.oa
2108
2246
  })));
2109
2247
  const listFileSubtitles = (fileId, options = {}) => requestJson(FileSubtitlesEnvelopeSchema, {
2110
2248
  method: "GET",
2111
- path: `/v2/files/${fileId}/subtitles`,
2249
+ path: `/v2/files/${encodePathSegment(fileId)}/subtitles`,
2112
2250
  query: options.languages ? { languages: joinCsv(options.languages) } : void 0
2113
2251
  }).pipe(withOperationErrors(FileSubtitlesErrorSpec));
2114
2252
  const setStartFrom = (input) => requestJson(OkResponseSchema, {
@@ -2117,27 +2255,27 @@ const setStartFrom = (input) => requestJson(OkResponseSchema, {
2117
2255
  value: { time: input.time }
2118
2256
  },
2119
2257
  method: "POST",
2120
- path: `/v2/files/${input.file_id}/start-from/set`
2258
+ path: `/v2/files/${encodePathSegment(input.file_id)}/start-from/set`
2121
2259
  }).pipe(withOperationErrors(StartFromErrorSpec));
2122
2260
  const resetStartFrom = (fileId) => requestJson(OkResponseSchema, {
2123
2261
  method: "GET",
2124
- path: `/v2/files/${fileId}/start-from/delete`
2262
+ path: `/v2/files/${encodePathSegment(fileId)}/start-from/delete`
2125
2263
  }).pipe(withOperationErrors(StartFromErrorSpec));
2126
2264
  const getMp4Status = (fileId) => requestJson(FileConversionStatusEnvelopeSchema, {
2127
2265
  method: "GET",
2128
- path: `/v2/files/${fileId}/mp4`
2266
+ path: `/v2/files/${encodePathSegment(fileId)}/mp4`
2129
2267
  }).pipe(selectJsonField("mp4"), withOperationErrors(FileMp4ErrorSpec));
2130
2268
  const convertFileToMp4 = (fileId) => requestJson(FileConversionStatusEnvelopeSchema, {
2131
2269
  method: "POST",
2132
- path: `/v2/files/${fileId}/mp4`
2270
+ path: `/v2/files/${encodePathSegment(fileId)}/mp4`
2133
2271
  }).pipe(selectJsonField("mp4"), withOperationErrors(FileMp4ErrorSpec));
2134
2272
  const deleteFileMp4 = (fileId) => requestVoid({
2135
2273
  method: "DELETE",
2136
- path: `/v2/files/${fileId}/mp4`
2274
+ path: `/v2/files/${encodePathSegment(fileId)}/mp4`
2137
2275
  }).pipe(withOperationErrors(FileMp4MutationErrorSpec));
2138
2276
  const putMp4ToMyFiles = (fileId) => requestVoid({
2139
2277
  method: "GET",
2140
- path: `/v2/files/${fileId}/put-mp4-to-my-folders`
2278
+ path: `/v2/files/${encodePathSegment(fileId)}/put-mp4-to-my-folders`
2141
2279
  }).pipe(withOperationErrors(FileMp4MutationErrorSpec));
2142
2280
  const convertFilesToMp4 = (ids) => requestJson(FilesBulkConvertEnvelopeSchema, {
2143
2281
  body: {
@@ -2187,16 +2325,16 @@ const listFileExtractions = () => requestJson(FileExtractionsEnvelopeSchema, {
2187
2325
  }).pipe(selectJsonField("extractions"), withOperationErrors(FileExtractionsErrorSpec));
2188
2326
  const deleteFileExtraction = (extractionId) => requestVoid({
2189
2327
  method: "DELETE",
2190
- path: `/v2/files/extract/${extractionId}`
2328
+ path: `/v2/files/extract/${encodePathSegment(extractionId)}`
2191
2329
  });
2192
2330
  const findNextFile = (fileId, fileType) => requestJson(FilesNextFileEnvelopeSchema, {
2193
2331
  method: "GET",
2194
- path: `/v2/files/${fileId}/next-file`,
2332
+ path: `/v2/files/${encodePathSegment(fileId)}/next-file`,
2195
2333
  query: { file_type: fileType }
2196
2334
  }).pipe(selectJsonField("next_file"));
2197
2335
  const findNextVideo = (fileId) => requestJson(FilesNextVideoEnvelopeSchema, {
2198
2336
  method: "GET",
2199
- path: `/v2/files/${fileId}/next-video`
2337
+ path: `/v2/files/${encodePathSegment(fileId)}/next-video`
2200
2338
  }).pipe(selectJsonField("next_video"));
2201
2339
  const createFileUploadRequest = (input, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => ({
2202
2340
  body: createFileUploadFormData(input),
@@ -2216,11 +2354,17 @@ const uploadFile = (input, options = {}) => resolveRouteContext(options.oauthTok
2216
2354
  })), Effect.map(toUploadResult), withOperationErrors(FileUploadErrorSpec));
2217
2355
  //#endregion
2218
2356
  //#region src/domains/friend-invites.ts
2219
- const FriendInviteJoinedUserStatusSchema = Schema.Literal("CONVERTED", "IN_TRIAL", "TRIAL_ENDED", "TRIAL_NOT_STARTED", "UNKNOWN");
2357
+ const FriendInviteJoinedUserStatusSchema = Schema.Literals([
2358
+ "CONVERTED",
2359
+ "IN_TRIAL",
2360
+ "TRIAL_ENDED",
2361
+ "TRIAL_NOT_STARTED",
2362
+ "UNKNOWN"
2363
+ ]);
2220
2364
  const FriendInviteJoinedUserSchema = Schema.Struct({
2221
2365
  avatar_url: Schema.String,
2222
2366
  created_at: Schema.String,
2223
- earned_amount: Schema.NullOr(Schema.Number.pipe(Schema.nonNegative())),
2367
+ earned_amount: Schema.NullOr(Schema.Number.check(Schema.isGreaterThanOrEqualTo(0))),
2224
2368
  name: Schema.String,
2225
2369
  status: FriendInviteJoinedUserStatusSchema
2226
2370
  });
@@ -2231,7 +2375,7 @@ const FriendInviteSchema = Schema.Struct({
2231
2375
  });
2232
2376
  const FriendInvitesListEnvelopeSchema = Schema.Struct({
2233
2377
  invites: Schema.Array(FriendInviteSchema),
2234
- remaining_limit: Schema.Number.pipe(Schema.int()),
2378
+ remaining_limit: Schema.Int,
2235
2379
  status: Schema.Literal("OK")
2236
2380
  });
2237
2381
  const FriendInviteCreateEnvelopeSchema = Schema.Struct({
@@ -2277,25 +2421,25 @@ const createFriendInvite = () => requestJson(FriendInviteCreateEnvelopeSchema, {
2277
2421
  //#region src/domains/friends.ts
2278
2422
  const FriendBaseSchema = Schema.Struct({
2279
2423
  avatar_url: Schema.String,
2280
- id: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
2424
+ id: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
2281
2425
  name: Schema.String
2282
2426
  });
2283
- const FriendSchema = Schema.extend(FriendBaseSchema, Schema.Struct({
2427
+ const FriendSchema = FriendBaseSchema.pipe(Schema.fieldsAssign({
2284
2428
  has_received_files: Schema.Boolean,
2285
2429
  has_shared_files: Schema.Boolean
2286
2430
  }));
2287
- const UserSearchResultSchema = Schema.extend(FriendBaseSchema, Schema.Struct({ invited: Schema.Boolean }));
2431
+ const UserSearchResultSchema = FriendBaseSchema.pipe(Schema.fieldsAssign({ invited: Schema.Boolean }));
2288
2432
  const FriendsListEnvelopeSchema = Schema.Struct({
2289
2433
  friends: Schema.Array(FriendSchema),
2290
2434
  status: Schema.Literal("OK"),
2291
- total: Schema.Number.pipe(Schema.int(), Schema.nonNegative())
2435
+ total: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))
2292
2436
  });
2293
2437
  const FriendRequestsEnvelopeSchema = Schema.Struct({
2294
2438
  friends: Schema.Array(FriendBaseSchema),
2295
2439
  status: Schema.Literal("OK")
2296
2440
  });
2297
2441
  const FriendRequestsCountEnvelopeSchema = Schema.Struct({
2298
- count: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
2442
+ count: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
2299
2443
  status: Schema.Literal("OK")
2300
2444
  });
2301
2445
  const FriendSearchEnvelopeSchema = Schema.Struct({
@@ -2427,7 +2571,7 @@ const listFriends = () => requestJson(FriendsListEnvelopeSchema, {
2427
2571
  }).pipe(selectJsonFields("friends", "total"), withOperationErrors(ListFriendsErrorSpec));
2428
2572
  const searchFriends = (username) => requestJson(FriendSearchEnvelopeSchema, {
2429
2573
  method: "GET",
2430
- path: `/v2/friends/user-search/${encodeURIComponent(username)}`
2574
+ path: `/v2/friends/user-search/${encodePathSegment(username)}`
2431
2575
  }).pipe(selectJsonField("users"), withOperationErrors(SearchFriendsErrorSpec));
2432
2576
  const listWaitingRequests = () => requestJson(FriendRequestsEnvelopeSchema, {
2433
2577
  method: "GET",
@@ -2443,33 +2587,51 @@ const listSentRequests = () => requestJson(FriendRequestsEnvelopeSchema, {
2443
2587
  }).pipe(selectJsonField("friends"), withOperationErrors(ListSentRequestsErrorSpec));
2444
2588
  const sendFriendRequest = (username) => requestJson(OkResponseSchema, {
2445
2589
  method: "POST",
2446
- path: `/v2/friends/${encodeURIComponent(username)}/request`
2590
+ path: `/v2/friends/${encodePathSegment(username)}/request`
2447
2591
  }).pipe(withOperationErrors(SendFriendRequestErrorSpec));
2448
2592
  const removeFriend = (username) => requestJson(OkResponseSchema, {
2449
2593
  method: "POST",
2450
- path: `/v2/friends/${encodeURIComponent(username)}/unfriend`
2594
+ path: `/v2/friends/${encodePathSegment(username)}/unfriend`
2451
2595
  }).pipe(withOperationErrors(RemoveFriendErrorSpec));
2452
2596
  const approveFriendRequest = (username) => requestJson(OkResponseSchema, {
2453
2597
  method: "POST",
2454
- path: `/v2/friends/${encodeURIComponent(username)}/approve`
2598
+ path: `/v2/friends/${encodePathSegment(username)}/approve`
2455
2599
  }).pipe(withOperationErrors(ApproveFriendRequestErrorSpec));
2456
2600
  const denyFriendRequest = (username) => requestJson(OkResponseSchema, {
2457
2601
  method: "POST",
2458
- path: `/v2/friends/${encodeURIComponent(username)}/deny`
2602
+ path: `/v2/friends/${encodePathSegment(username)}/deny`
2459
2603
  }).pipe(withOperationErrors(DenyFriendRequestErrorSpec));
2460
2604
  const getFriendSharedFolder = (username) => requestJson(FriendSharedFolderEnvelopeSchema, {
2461
2605
  method: "GET",
2462
- path: `/v2/friends/${encodeURIComponent(username)}/files`
2606
+ path: `/v2/friends/${encodePathSegment(username)}/files`
2463
2607
  }).pipe(selectJsonField("file"), withOperationErrors(FriendSharedFolderErrorSpec));
2464
2608
  //#endregion
2465
2609
  //#region src/domains/payment.ts
2466
- const PaymentPlanTypeSchema = Schema.Literal("onetime", "subscription");
2467
- const PaymentOptionPlanTypeSchema = Schema.Literal("onetime", "subscription", "trial");
2468
- const PaymentProviderNameSchema = Schema.Literal("Paddle", "Fastspring", "OpenNode", "AcceptNano");
2469
- const PaymentTypeSchema = Schema.Literal("credit-card", "cryptocurrency", "nano");
2470
- const UserSubscriptionStatusSchema = Schema.Literal("ACTIVE", "CANCELED", "PAST_DUE", "TRIALING");
2610
+ const PaymentPlanTypeSchema = Schema.Literals(["onetime", "subscription"]);
2611
+ const PaymentOptionPlanTypeSchema = Schema.Literals([
2612
+ "onetime",
2613
+ "subscription",
2614
+ "trial"
2615
+ ]);
2616
+ const PaymentProviderNameSchema = Schema.Literals([
2617
+ "Paddle",
2618
+ "Fastspring",
2619
+ "OpenNode",
2620
+ "AcceptNano"
2621
+ ]);
2622
+ const PaymentTypeSchema = Schema.Literals([
2623
+ "credit-card",
2624
+ "cryptocurrency",
2625
+ "nano"
2626
+ ]);
2627
+ const UserSubscriptionStatusSchema = Schema.Literals([
2628
+ "ACTIVE",
2629
+ "CANCELED",
2630
+ "PAST_DUE",
2631
+ "TRIALING"
2632
+ ]);
2471
2633
  const PaymentSubscriptionInfoSchema = Schema.Struct({
2472
- id: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.positive())),
2634
+ id: Schema.optional(Schema.Int.check(Schema.isGreaterThan(0))),
2473
2635
  need_payment_information_update: Schema.optional(Schema.Boolean),
2474
2636
  next_billing_date: Schema.optional(Schema.NullOr(Schema.String)),
2475
2637
  next_retry_date: Schema.optional(Schema.NullOr(Schema.String)),
@@ -2479,14 +2641,14 @@ const PaymentSubscriptionInfoSchema = Schema.Struct({
2479
2641
  const PaymentInfoPlanSchema = Schema.Struct({
2480
2642
  code: Schema.optional(Schema.String),
2481
2643
  group_code: Schema.optional(Schema.String),
2482
- period_days: Schema.optional(Schema.NullOr(Schema.Number.pipe(Schema.int(), Schema.positive()))),
2483
- storage_space: Schema.optional(Schema.Number.pipe(Schema.nonNegative())),
2644
+ period_days: Schema.optional(Schema.NullOr(Schema.Int.check(Schema.isGreaterThan(0)))),
2645
+ storage_space: Schema.optional(Schema.Number.check(Schema.isGreaterThanOrEqualTo(0))),
2484
2646
  subscription: Schema.optional(PaymentSubscriptionInfoSchema),
2485
2647
  type: Schema.optional(Schema.NullOr(PaymentPlanTypeSchema))
2486
2648
  });
2487
2649
  const PaymentLastPaymentSchema = Schema.Struct({
2488
- method: Schema.String,
2489
- provider: Schema.String
2650
+ method: Schema.optional(Schema.String),
2651
+ provider: Schema.optional(Schema.String)
2490
2652
  });
2491
2653
  const PaymentInfoSchema = Schema.Struct({
2492
2654
  expiration_date: Schema.optional(Schema.String),
@@ -2499,20 +2661,20 @@ const PaymentInfoSchema = Schema.Struct({
2499
2661
  status: Schema.Literal("OK")
2500
2662
  });
2501
2663
  const PaymentPlanCommonPropertiesSchema = Schema.Struct({
2502
- family_invites: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
2503
- seed_ratio: Schema.Number.pipe(Schema.nonNegative()),
2504
- seed_time: Schema.Number.pipe(Schema.nonNegative()),
2505
- storage_space: Schema.Number.pipe(Schema.nonNegative()),
2506
- torrent_slot: Schema.Number.pipe(Schema.int(), Schema.nonNegative())
2664
+ family_invites: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
2665
+ seed_ratio: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
2666
+ seed_time: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
2667
+ storage_space: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
2668
+ torrent_slot: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))
2507
2669
  });
2508
2670
  const PaymentSubPlanSchema = Schema.Struct({
2509
2671
  code: Schema.String,
2510
2672
  daily_price: Schema.NullOr(Schema.String),
2511
2673
  fastspring_url: Schema.NullOr(Schema.String),
2512
2674
  is_trial_subscription: Schema.Boolean,
2513
- period_days: Schema.NullOr(Schema.Number.pipe(Schema.int(), Schema.positive())),
2675
+ period_days: Schema.NullOr(Schema.Int.check(Schema.isGreaterThan(0))),
2514
2676
  price: Schema.NullOr(Schema.String),
2515
- subscription_trial_period: Schema.NullOr(Schema.Number.pipe(Schema.int(), Schema.nonNegative())),
2677
+ subscription_trial_period: Schema.NullOr(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
2516
2678
  type: PaymentPlanTypeSchema
2517
2679
  });
2518
2680
  const PaymentPlanGroupSchema = Schema.Struct({
@@ -2525,7 +2687,7 @@ const PaymentPlansEnvelopeSchema = Schema.Struct({
2525
2687
  status: Schema.Literal("OK")
2526
2688
  });
2527
2689
  const PaymentOptionSchema = Schema.Struct({
2528
- discount_percent: Schema.Number.pipe(Schema.nonNegative()),
2690
+ discount_percent: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
2529
2691
  name: PaymentTypeSchema,
2530
2692
  suitable_plan_types: Schema.Array(PaymentOptionPlanTypeSchema)
2531
2693
  });
@@ -2535,7 +2697,7 @@ const PaymentOptionsEnvelopeSchema = Schema.Struct({
2535
2697
  });
2536
2698
  const PaymentHistoryPlanSchema = Schema.Struct({
2537
2699
  name: Schema.String,
2538
- period_days: Schema.NullOr(Schema.Number.pipe(Schema.int(), Schema.nonNegative())),
2700
+ period_days: Schema.NullOr(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
2539
2701
  price: Schema.NullOr(Schema.String),
2540
2702
  type: Schema.NullOr(PaymentPlanTypeSchema)
2541
2703
  });
@@ -2547,7 +2709,7 @@ const PaymentHistoryItemSchema = Schema.Struct({
2547
2709
  actual_currency_code: Schema.optional(Schema.String),
2548
2710
  coupon_code: Schema.NullOr(Schema.String),
2549
2711
  date: Schema.String,
2550
- id: Schema.Number.pipe(Schema.int(), Schema.positive()),
2712
+ id: Schema.Int.check(Schema.isGreaterThan(0)),
2551
2713
  invoice: Schema.NullOr(Schema.String),
2552
2714
  plan: PaymentHistoryPlanSchema,
2553
2715
  refunded: Schema.Boolean,
@@ -2573,16 +2735,16 @@ const PaymentChangePlanCurrentPlanSchema = Schema.Struct({
2573
2735
  subscription_payment_provider: Schema.NullOr(PaymentProviderNameSchema)
2574
2736
  });
2575
2737
  const PaymentChangePlanTargetPlanSchema = Schema.Struct({
2576
- hd_avail: Schema.Number.pipe(Schema.nonNegative()),
2738
+ hd_avail: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
2577
2739
  is_trial_subscription: Schema.Boolean,
2578
2740
  new_code: Schema.String,
2579
- period_days: Schema.NullOr(Schema.Number.pipe(Schema.int(), Schema.positive())),
2741
+ period_days: Schema.NullOr(Schema.Int.check(Schema.isGreaterThan(0))),
2580
2742
  plan_code: Schema.String,
2581
2743
  plan_name: Schema.String,
2582
2744
  plan_type: PaymentPlanTypeSchema,
2583
2745
  price: Schema.String,
2584
2746
  simulated_expiration: Schema.NullOr(Schema.String),
2585
- subscription_trial_period: Schema.NullOr(Schema.Number.pipe(Schema.int(), Schema.nonNegative()))
2747
+ subscription_trial_period: Schema.NullOr(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))
2586
2748
  });
2587
2749
  const PaymentChangePlanProviderPaddlePreviewSchema = Schema.Struct({
2588
2750
  charge_amount: Schema.NullOr(Schema.String),
@@ -2596,8 +2758,8 @@ const PaymentChangePlanProviderFastspringPreviewSchema = Schema.Struct({
2596
2758
  refund_amount: Schema.NullOr(Schema.String)
2597
2759
  });
2598
2760
  const PaymentChangePlanDiscountSchema = Schema.Struct({
2599
- discount: Schema.Number.pipe(Schema.nonNegative()),
2600
- type: Schema.Literal("percentage", "amount")
2761
+ discount: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
2762
+ type: Schema.Literals(["percentage", "amount"])
2601
2763
  });
2602
2764
  const PaymentChangePlanPreviewSchema = Schema.Struct({
2603
2765
  Fastspring: PaymentChangePlanProviderFastspringPreviewSchema,
@@ -2609,16 +2771,16 @@ const PaymentChangePlanPreviewSchema = Schema.Struct({
2609
2771
  current_plan: PaymentChangePlanCurrentPlanSchema,
2610
2772
  discount: Schema.optional(PaymentChangePlanDiscountSchema),
2611
2773
  is_product_change: Schema.NullOr(Schema.Boolean),
2612
- new_remaining_days: Schema.NullOr(Schema.Number.pipe(Schema.int(), Schema.nonNegative())),
2774
+ new_remaining_days: Schema.NullOr(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
2613
2775
  prorated: Schema.NullOr(Schema.String),
2614
2776
  status: Schema.Literal("OK"),
2615
2777
  target_plan: PaymentChangePlanTargetPlanSchema
2616
2778
  });
2617
2779
  const PaddlePaymentProviderSchema = Schema.Struct({
2618
- plan_id: Schema.Number.pipe(Schema.int(), Schema.positive()),
2780
+ plan_id: Schema.Int.check(Schema.isGreaterThan(0)),
2619
2781
  provider: Schema.Literal("Paddle"),
2620
2782
  type: Schema.Literal("credit-card"),
2621
- vendor_id: Schema.Number.pipe(Schema.int(), Schema.positive())
2783
+ vendor_id: Schema.Int.check(Schema.isGreaterThan(0))
2622
2784
  });
2623
2785
  const FastspringPaymentProviderSchema = Schema.Struct({
2624
2786
  provider: Schema.Literal("Fastspring"),
@@ -2626,7 +2788,7 @@ const FastspringPaymentProviderSchema = Schema.Struct({
2626
2788
  url: Schema.String
2627
2789
  });
2628
2790
  const OpenNodePaymentProviderSchema = Schema.Struct({
2629
- discount_percent: Schema.Number.pipe(Schema.nonNegative()),
2791
+ discount_percent: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
2630
2792
  provider: Schema.Literal("OpenNode"),
2631
2793
  type: Schema.Literal("cryptocurrency")
2632
2794
  });
@@ -2634,12 +2796,17 @@ const AcceptNanoPaymentProviderSchema = Schema.Struct({
2634
2796
  amount: Schema.String,
2635
2797
  api_host: Schema.String,
2636
2798
  currency: Schema.Literal("USD"),
2637
- discount_percent: Schema.Number.pipe(Schema.nonNegative()),
2799
+ discount_percent: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
2638
2800
  provider: Schema.Literal("AcceptNano"),
2639
2801
  state: Schema.String,
2640
2802
  type: Schema.Literal("nano")
2641
2803
  });
2642
- const PaymentProviderSchema = Schema.Union(AcceptNanoPaymentProviderSchema, FastspringPaymentProviderSchema, OpenNodePaymentProviderSchema, PaddlePaymentProviderSchema);
2804
+ const PaymentProviderSchema = Schema.Union([
2805
+ AcceptNanoPaymentProviderSchema,
2806
+ FastspringPaymentProviderSchema,
2807
+ OpenNodePaymentProviderSchema,
2808
+ PaddlePaymentProviderSchema
2809
+ ]);
2643
2810
  const PaymentChangePlanCheckoutSchema = Schema.Struct({
2644
2811
  status: Schema.Literal("OK"),
2645
2812
  urls: Schema.Array(PaymentProviderSchema)
@@ -2660,7 +2827,12 @@ const PaymentChangePlanSubscriptionUpdatedSchema = Schema.Struct({
2660
2827
  status: Schema.Literal("OK")
2661
2828
  });
2662
2829
  const PaymentChangePlanSuccessSchema = OkResponseSchema;
2663
- const PaymentChangePlanSubmitSchema = Schema.Union(PaymentChangePlanCheckoutSchema, PaymentChangePlanConfirmationSchema, PaymentChangePlanSubscriptionUpdatedSchema, PaymentChangePlanSuccessSchema);
2830
+ const PaymentChangePlanSubmitSchema = Schema.Union([
2831
+ PaymentChangePlanCheckoutSchema,
2832
+ PaymentChangePlanConfirmationSchema,
2833
+ PaymentChangePlanSubscriptionUpdatedSchema,
2834
+ PaymentChangePlanSuccessSchema
2835
+ ]);
2664
2836
  const PaymentFastspringConfirmEnvelopeSchema = Schema.Struct({
2665
2837
  confirmed: Schema.Boolean,
2666
2838
  status: Schema.Literal("OK")
@@ -2672,14 +2844,14 @@ const PaymentVoucherPlanSchema = Schema.Struct({
2672
2844
  const PaymentVoucherTargetPlanSchema = Schema.Struct({
2673
2845
  code: Schema.String,
2674
2846
  group_code: Schema.String,
2675
- hd_avail: Schema.Number.pipe(Schema.nonNegative()),
2847
+ hd_avail: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
2676
2848
  name: Schema.String,
2677
2849
  simulated_expiration: Schema.optional(Schema.NullOr(Schema.String)),
2678
2850
  type: PaymentPlanTypeSchema
2679
2851
  });
2680
2852
  const PaymentVoucherInfoSchema = Schema.Struct({
2681
2853
  current_plan: PaymentVoucherPlanSchema,
2682
- new_remaining_days: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
2854
+ new_remaining_days: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
2683
2855
  status: Schema.Literal("OK"),
2684
2856
  target_plan: PaymentVoucherTargetPlanSchema
2685
2857
  });
@@ -3082,13 +3254,13 @@ const RssFeedSchema = Schema.Struct({
3082
3254
  created_at: Schema.String,
3083
3255
  delete_old_files: Schema.Boolean,
3084
3256
  extract: Schema.Boolean,
3085
- failed_item_count: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.nonNegative())),
3086
- id: Schema.Number.pipe(Schema.int(), Schema.positive()),
3257
+ failed_item_count: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
3258
+ id: Schema.Int.check(Schema.isGreaterThan(0)),
3087
3259
  keyword: Schema.NullOr(Schema.String),
3088
3260
  last_error: Schema.NullOr(Schema.String),
3089
3261
  last_fetch: Schema.NullOr(Schema.String),
3090
- parent_dir_id: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
3091
- parentdirid: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
3262
+ parent_dir_id: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
3263
+ parentdirid: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
3092
3264
  paused: Schema.Boolean,
3093
3265
  paused_at: Schema.NullOr(Schema.String),
3094
3266
  rss_source_url: Schema.String,
@@ -3101,27 +3273,27 @@ const RssFeedParamsSchema = Schema.Struct({
3101
3273
  delete_old_files: Schema.optional(Schema.Boolean),
3102
3274
  dont_process_whole_feed: Schema.optional(Schema.Boolean),
3103
3275
  keyword: Schema.optional(Schema.NullOr(Schema.String)),
3104
- parent_dir_id: Schema.optional(Schema.Union(Schema.Number.pipe(Schema.int(), Schema.nonNegative()), Schema.Literal("newf"))),
3276
+ parent_dir_id: Schema.optional(Schema.Union([Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), Schema.Literal("newf")])),
3105
3277
  rss_source_url: Schema.String,
3106
3278
  title: Schema.String,
3107
3279
  unwanted_keywords: Schema.optional(Schema.String)
3108
3280
  });
3109
3281
  const RssFeedItemBaseSchema = Schema.Struct({
3110
3282
  detected_date: Schema.String,
3111
- id: Schema.Number.pipe(Schema.int(), Schema.positive()),
3283
+ id: Schema.Int.check(Schema.isGreaterThan(0)),
3112
3284
  processed_at: Schema.String,
3113
3285
  publish_date: Schema.NullOr(Schema.String),
3114
3286
  title: Schema.String
3115
3287
  });
3116
- const RssFeedItemSucceededSchema = Schema.extend(RssFeedItemBaseSchema, Schema.Struct({
3288
+ const RssFeedItemSucceededSchema = RssFeedItemBaseSchema.pipe(Schema.fieldsAssign({
3117
3289
  is_failed: Schema.Literal(false),
3118
- user_file_id: Schema.NullOr(Schema.Number.pipe(Schema.int(), Schema.nonNegative()))
3290
+ user_file_id: Schema.NullOr(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))
3119
3291
  }));
3120
- const RssFeedItemFailedSchema = Schema.extend(RssFeedItemBaseSchema, Schema.Struct({
3292
+ const RssFeedItemFailedSchema = RssFeedItemBaseSchema.pipe(Schema.fieldsAssign({
3121
3293
  failure_reason: Schema.String,
3122
3294
  is_failed: Schema.Literal(true)
3123
3295
  }));
3124
- const RssFeedItemSchema = Schema.Union(RssFeedItemSucceededSchema, RssFeedItemFailedSchema);
3296
+ const RssFeedItemSchema = Schema.Union([RssFeedItemSucceededSchema, RssFeedItemFailedSchema]);
3125
3297
  const RssFeedsEnvelopeSchema = Schema.Struct({
3126
3298
  feeds: Schema.Array(RssFeedSchema),
3127
3299
  status: Schema.Literal("OK")
@@ -3357,7 +3529,7 @@ const listRssFeeds = () => requestJson(RssFeedsEnvelopeSchema, {
3357
3529
  }).pipe(selectJsonField("feeds"), withOperationErrors(ListRssFeedsErrorSpec));
3358
3530
  const getRssFeed = (id) => requestJson(RssFeedEnvelopeSchema, {
3359
3531
  method: "GET",
3360
- path: `/v2/rss/${id}`
3532
+ path: `/v2/rss/${encodePathSegment(id)}`
3361
3533
  }).pipe(selectJsonField("feed"), withOperationErrors(GetRssFeedErrorSpec));
3362
3534
  const createRssFeed = (params) => requestJson(RssFeedEnvelopeSchema, {
3363
3535
  body: {
@@ -3373,98 +3545,107 @@ const updateRssFeed = (id, params) => requestJson(OkResponseSchema, {
3373
3545
  value: toUpdateBody(params)
3374
3546
  },
3375
3547
  method: "POST",
3376
- path: `/v2/rss/${id}`
3548
+ path: `/v2/rss/${encodePathSegment(id)}`
3377
3549
  }).pipe(withOperationErrors(UpdateRssFeedErrorSpec));
3378
3550
  const pauseRssFeed = (id) => requestJson(OkResponseSchema, {
3379
3551
  method: "POST",
3380
- path: `/v2/rss/${id}/pause`
3552
+ path: `/v2/rss/${encodePathSegment(id)}/pause`
3381
3553
  }).pipe(withOperationErrors(PauseRssFeedErrorSpec));
3382
3554
  const resumeRssFeed = (id) => requestJson(OkResponseSchema, {
3383
3555
  method: "POST",
3384
- path: `/v2/rss/${id}/resume`
3556
+ path: `/v2/rss/${encodePathSegment(id)}/resume`
3385
3557
  }).pipe(withOperationErrors(ResumeRssFeedErrorSpec));
3386
3558
  const deleteRssFeed = (id) => requestJson(OkResponseSchema, {
3387
3559
  method: "POST",
3388
- path: `/v2/rss/${id}/delete`
3560
+ path: `/v2/rss/${encodePathSegment(id)}/delete`
3389
3561
  }).pipe(withOperationErrors(DeleteRssFeedErrorSpec));
3390
3562
  const listRssFeedItems = (id) => requestJson(RssFeedItemsEnvelopeSchema, {
3391
3563
  method: "GET",
3392
- path: `/v2/rss/${id}/items`
3564
+ path: `/v2/rss/${encodePathSegment(id)}/items`
3393
3565
  }).pipe(selectJsonFields("feed", "items"), withOperationErrors(ListRssFeedItemsErrorSpec));
3394
3566
  const clearRssFeedLogs = (id) => requestJson(OkResponseSchema, {
3395
3567
  method: "POST",
3396
- path: `/v2/rss/${id}/clear-log`
3568
+ path: `/v2/rss/${encodePathSegment(id)}/clear-log`
3397
3569
  }).pipe(withOperationErrors(ClearRssFeedLogsErrorSpec));
3398
3570
  const retryRssFeedItem = (feedId, itemId) => requestJson(OkResponseSchema, {
3399
3571
  method: "POST",
3400
- path: `/v2/rss/${feedId}/items/${itemId}/retry`
3572
+ path: `/v2/rss/${encodePathSegment(feedId)}/items/${encodePathSegment(itemId)}/retry`
3401
3573
  }).pipe(withOperationErrors(RetryRssFeedItemErrorSpec));
3402
3574
  const retryAllRssFeedItems = (feedId) => requestJson(OkResponseSchema, {
3403
3575
  method: "POST",
3404
- path: `/v2/rss/${feedId}/retry-all`
3576
+ path: `/v2/rss/${encodePathSegment(feedId)}/retry-all`
3405
3577
  }).pipe(withOperationErrors(RetryAllRssFeedItemsErrorSpec));
3406
3578
  //#endregion
3407
3579
  //#region src/domains/sharing.ts
3408
- const SharingCloneStatusSchema = Schema.Literal("NEW", "PROCESSING", "DONE", "ERROR");
3580
+ const SharingCloneStatusSchema = Schema.Literals([
3581
+ "NEW",
3582
+ "PROCESSING",
3583
+ "DONE",
3584
+ "ERROR"
3585
+ ]);
3409
3586
  const SharingCloneInputSchema = Schema.Struct({
3410
3587
  cursor: Schema.optional(Schema.String),
3411
- excludeIds: Schema.optional(Schema.Array(Schema.Number.pipe(Schema.int(), Schema.nonNegative()))),
3412
- ids: Schema.optional(Schema.Array(Schema.Number.pipe(Schema.int(), Schema.nonNegative()))),
3413
- parentId: Schema.optional(Schema.Number.pipe(Schema.int()))
3588
+ excludeIds: Schema.optional(Schema.Array(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))),
3589
+ ids: Schema.optional(Schema.Array(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))),
3590
+ parentId: Schema.optional(Schema.Int)
3414
3591
  });
3415
3592
  const SharingCloneEnvelopeSchema = Schema.Struct({
3416
- id: Schema.Number.pipe(Schema.int(), Schema.positive()),
3593
+ id: Schema.Int.check(Schema.isGreaterThan(0)),
3417
3594
  status: Schema.Literal("OK")
3418
3595
  });
3419
- const SharingCloneInfoSchema = Schema.Union(Schema.Struct({
3420
- shared_file_clone_status: Schema.Literal("NEW", "PROCESSING", "DONE"),
3596
+ const SharingCloneInfoSchema = Schema.Union([Schema.Struct({
3597
+ shared_file_clone_status: Schema.Literals([
3598
+ "NEW",
3599
+ "PROCESSING",
3600
+ "DONE"
3601
+ ]),
3421
3602
  status: Schema.Literal("OK")
3422
3603
  }), Schema.Struct({
3423
3604
  error_msg: Schema.String,
3424
3605
  shared_file_clone_status: Schema.Literal("ERROR"),
3425
3606
  status: Schema.Literal("OK")
3426
- }));
3427
- const SharedFileSchema = Schema.extend(FileBroadSchema, Schema.Struct({ shared_with: Schema.Union(Schema.Literal("everyone"), Schema.Number.pipe(Schema.int(), Schema.nonNegative())) }));
3607
+ })]);
3608
+ const SharedFileSchema = FileBroadSchema.pipe(Schema.fieldsAssign({ shared_with: Schema.Union([Schema.Literal("everyone"), Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))]) }));
3428
3609
  const SharingShareInputSchema = Schema.Struct({
3429
3610
  cursor: Schema.optional(Schema.String),
3430
- excludeIds: Schema.optional(Schema.Array(Schema.Number.pipe(Schema.int(), Schema.nonNegative()))),
3431
- ids: Schema.optional(Schema.Array(Schema.Number.pipe(Schema.int(), Schema.nonNegative()))),
3432
- target: Schema.Union(Schema.Struct({ type: Schema.Literal("everyone") }), Schema.Struct({
3433
- friendNames: Schema.Array(Schema.String),
3611
+ excludeIds: Schema.optional(Schema.Array(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))),
3612
+ ids: Schema.optional(Schema.Array(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))),
3613
+ target: Schema.Union([Schema.Struct({ type: Schema.Literal("everyone") }), Schema.Struct({
3614
+ friendNames: Schema.Array(Schema.String).check(Schema.isMinLength(1)),
3434
3615
  type: Schema.Literal("friends")
3435
- }))
3616
+ })])
3436
3617
  });
3437
3618
  const SharedFilesEnvelopeSchema = Schema.Struct({
3438
3619
  shared: Schema.Array(SharedFileSchema),
3439
3620
  status: Schema.Literal("OK")
3440
3621
  });
3441
3622
  const SharedFileShareSchema = Schema.Struct({
3442
- share_id: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
3623
+ share_id: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
3443
3624
  user_avatar_url: Schema.String,
3444
3625
  user_name: Schema.String
3445
3626
  });
3446
- const SharedFileSharedWithSchema = Schema.Union(Schema.Struct({
3627
+ const SharedFileSharedWithSchema = Schema.Union([Schema.Struct({
3447
3628
  share_type: Schema.Literal("everyone"),
3448
3629
  status: Schema.optional(Schema.Literal("OK"))
3449
3630
  }), Schema.Struct({
3450
3631
  share_type: Schema.Literal("friends"),
3451
3632
  shares: Schema.Array(SharedFileShareSchema),
3452
3633
  status: Schema.optional(Schema.Literal("OK"))
3453
- }));
3634
+ })]);
3454
3635
  const SharingUnshareInputSchema = Schema.Struct({
3455
- fileId: Schema.Number.pipe(Schema.int(), Schema.positive()),
3456
- shares: Schema.optional(Schema.Array(Schema.Union(Schema.Number.pipe(Schema.int()), Schema.String)))
3636
+ fileId: Schema.Int.check(Schema.isGreaterThan(0)),
3637
+ shares: Schema.optional(Schema.Array(Schema.Union([Schema.Int, Schema.String])))
3457
3638
  });
3458
3639
  const PublicShareSchema = Schema.Struct({
3459
3640
  created_at: Schema.String,
3460
3641
  expiration_date: Schema.String,
3461
- id: Schema.Number.pipe(Schema.int(), Schema.positive()),
3642
+ id: Schema.Int.check(Schema.isGreaterThan(0)),
3462
3643
  owner: Schema.Struct({ name: Schema.String }),
3463
3644
  push_token: Schema.String,
3464
3645
  token: Schema.String,
3465
3646
  user_file: Schema.Struct({
3466
3647
  file_type: Schema.String,
3467
- id: Schema.Number.pipe(Schema.int()),
3648
+ id: Schema.Int,
3468
3649
  name: Schema.String
3469
3650
  })
3470
3651
  });
@@ -3477,20 +3658,20 @@ const PublicSharesEnvelopeSchema = Schema.Struct({
3477
3658
  status: Schema.optional(Schema.Literal("OK"))
3478
3659
  });
3479
3660
  const PublicShareFileListEnvelopeSchema = Schema.Struct({
3480
- breadcrumbs: Schema.optional(Schema.Array(Schema.Tuple(Schema.Number.pipe(Schema.int()), Schema.String))),
3661
+ breadcrumbs: Schema.optional(Schema.Array(Schema.Tuple([Schema.Int, Schema.String]))),
3481
3662
  cursor: Schema.NullOr(Schema.String),
3482
3663
  files: Schema.Array(FileBroadSchema),
3483
3664
  parent: Schema.NullOr(FileBroadSchema),
3484
3665
  status: Schema.Literal("OK"),
3485
- total: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.nonNegative()))
3666
+ total: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))
3486
3667
  });
3487
3668
  const PublicShareFileListContinueEnvelopeSchema = Schema.Struct({
3488
- breadcrumbs: Schema.optional(Schema.Array(Schema.Tuple(Schema.Number.pipe(Schema.int()), Schema.String))),
3669
+ breadcrumbs: Schema.optional(Schema.Array(Schema.Tuple([Schema.Int, Schema.String]))),
3489
3670
  cursor: Schema.NullOr(Schema.String),
3490
3671
  files: Schema.Array(FileBroadSchema),
3491
3672
  parent: Schema.optional(Schema.NullOr(FileBroadSchema)),
3492
3673
  status: Schema.Literal("OK"),
3493
- total: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.nonNegative()))
3674
+ total: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))
3494
3675
  });
3495
3676
  const PublicShareFileUrlEnvelopeSchema = Schema.Struct({
3496
3677
  status: Schema.optional(Schema.Literal("OK")),
@@ -3503,8 +3684,8 @@ const PublicShareListQuerySchema = Schema.Struct({
3503
3684
  hidden: Schema.optional(Schema.Literal(1)),
3504
3685
  media_info_parent: Schema.optional(Schema.Literal(1)),
3505
3686
  mp4_status_parent: Schema.optional(Schema.Literal(1)),
3506
- parent_id: Schema.optional(Schema.Number.pipe(Schema.int())),
3507
- per_page: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.positive())),
3687
+ parent_id: Schema.optional(Schema.Int),
3688
+ per_page: Schema.optional(Schema.Int.check(Schema.isGreaterThan(0))),
3508
3689
  sort: Schema.optional(Schema.String),
3509
3690
  sort_by: Schema.optional(Schema.String),
3510
3691
  stream_url_parent: Schema.optional(Schema.Literal(1)),
@@ -3704,7 +3885,11 @@ const GetPublicShareFileUrlErrorSpec = definePutioOperationErrorSpec({
3704
3885
  { statusCode: 404 }
3705
3886
  ]
3706
3887
  });
3707
- const toShareTarget = (target) => target.type === "everyone" ? "everyone" : joinCsv(target.friendNames) ?? "everyone";
3888
+ const toShareTarget = (target) => {
3889
+ if (target.type === "everyone") return Effect.succeed("everyone");
3890
+ if (target.friendNames.length === 0) return Effect.fail(new PutioValidationError({ cause: "shareFiles target.friendNames must include at least one friend" }));
3891
+ return Effect.succeed(target.friendNames.join(","));
3892
+ };
3708
3893
  const cloneSharedFiles = (input = {}) => requestJson(SharingCloneEnvelopeSchema, {
3709
3894
  body: {
3710
3895
  type: "form",
@@ -3718,18 +3903,21 @@ const cloneSharedFiles = (input = {}) => requestJson(SharingCloneEnvelopeSchema,
3718
3903
  }).pipe(selectJsonFields("id"), withOperationErrors(CreateSharingCloneErrorSpec));
3719
3904
  const getSharingCloneInfo = (id) => requestJson(SharingCloneInfoSchema, {
3720
3905
  method: "GET",
3721
- path: `/v2/sharing/clone/${id}`
3906
+ path: `/v2/sharing/clone/${encodePathSegment(id)}`
3722
3907
  }).pipe(withOperationErrors(GetSharingCloneInfoErrorSpec));
3723
- const shareFiles = (input) => requestJson(OkResponseSchema, {
3724
- body: {
3725
- type: "form",
3726
- value: {
3727
- ...toCursorSelectionForm(input),
3728
- friends: toShareTarget(input.target)
3729
- }
3730
- },
3731
- method: "POST",
3732
- path: "/v2/files/share"
3908
+ const shareFiles = (input) => Effect.gen(function* () {
3909
+ const friends = yield* toShareTarget(input.target);
3910
+ return yield* requestJson(OkResponseSchema, {
3911
+ body: {
3912
+ type: "form",
3913
+ value: {
3914
+ ...toCursorSelectionForm(input),
3915
+ friends
3916
+ }
3917
+ },
3918
+ method: "POST",
3919
+ path: "/v2/files/share"
3920
+ });
3733
3921
  }).pipe(withOperationErrors(ShareFilesErrorSpec));
3734
3922
  const listSharedFiles = () => requestJson(SharedFilesEnvelopeSchema, {
3735
3923
  method: "GET",
@@ -3737,7 +3925,7 @@ const listSharedFiles = () => requestJson(SharedFilesEnvelopeSchema, {
3737
3925
  }).pipe(selectJsonField("shared"), withOperationErrors(ListSharedFilesErrorSpec));
3738
3926
  const getSharedWith = (fileId) => requestJson(SharedFileSharedWithSchema, {
3739
3927
  method: "GET",
3740
- path: `/v2/files/${fileId}/shared-with-v2`
3928
+ path: `/v2/files/${encodePathSegment(fileId)}/shared-with-v2`
3741
3929
  }).pipe(withOperationErrors(GetSharedWithErrorSpec));
3742
3930
  const unshareFile = (input) => requestJson(OkResponseSchema, {
3743
3931
  body: {
@@ -3745,11 +3933,11 @@ const unshareFile = (input) => requestJson(OkResponseSchema, {
3745
3933
  value: { shares: joinCsv(input.shares) ?? "everyone" }
3746
3934
  },
3747
3935
  method: "POST",
3748
- path: `/v2/files/${input.fileId}/unshare`
3936
+ path: `/v2/files/${encodePathSegment(input.fileId)}/unshare`
3749
3937
  }).pipe(withOperationErrors(UnshareFileErrorSpec));
3750
3938
  const createPublicShare = (fileId) => requestJson(PublicShareEnvelopeSchema, {
3751
3939
  method: "POST",
3752
- path: `/v2/public_share/${fileId}`
3940
+ path: `/v2/public_share/${encodePathSegment(fileId)}`
3753
3941
  }).pipe(selectJsonField("public_share"), withOperationErrors(CreatePublicShareErrorSpec));
3754
3942
  const listPublicShares = () => requestJson(PublicSharesEnvelopeSchema, {
3755
3943
  method: "GET",
@@ -3757,7 +3945,7 @@ const listPublicShares = () => requestJson(PublicSharesEnvelopeSchema, {
3757
3945
  }).pipe(selectJsonField("public_shares"), withOperationErrors(ListPublicSharesErrorSpec));
3758
3946
  const deletePublicShare = (id) => requestJson(OkResponseSchema, {
3759
3947
  method: "DELETE",
3760
- path: `/v2/public_share/${id}`
3948
+ path: `/v2/public_share/${encodePathSegment(id)}`
3761
3949
  }).pipe(withOperationErrors(DeletePublicShareErrorSpec));
3762
3950
  const getPublicShare = () => requestJson(PublicShareEnvelopeSchema, {
3763
3951
  method: "GET",
@@ -3779,7 +3967,7 @@ const continuePublicShareFiles = (cursor, query = {}) => requestJson(PublicShare
3779
3967
  }).pipe(withOperationErrors(ContinuePublicShareFilesErrorSpec));
3780
3968
  const getPublicShareFileUrl = (fileId) => requestJson(PublicShareFileUrlEnvelopeSchema, {
3781
3969
  method: "GET",
3782
- path: `/v2/public_share/files/${fileId}/url`
3970
+ path: `/v2/public_share/files/${encodePathSegment(fileId)}/url`
3783
3971
  }).pipe(selectJsonField("url"), withOperationErrors(GetPublicShareFileUrlErrorSpec));
3784
3972
  //#endregion
3785
3973
  //#region src/domains/trash.ts
@@ -3793,18 +3981,18 @@ const TrashFileSchema = Schema.Struct({
3793
3981
  first_accessed_at: Schema.NullOr(Schema.String),
3794
3982
  folder_type: Schema.Literal("REGULAR"),
3795
3983
  icon: Schema.NullOr(Schema.String),
3796
- id: Schema.Number.pipe(Schema.int()),
3984
+ id: Schema.Int,
3797
3985
  name: Schema.String,
3798
- parent_id: Schema.NullOr(Schema.Number.pipe(Schema.int())),
3986
+ parent_id: Schema.NullOr(Schema.Int),
3799
3987
  screenshot: Schema.Unknown,
3800
- size: Schema.Number.pipe(Schema.nonNegative())
3988
+ size: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0))
3801
3989
  });
3802
3990
  const TrashListEnvelopeSchema = Schema.Struct({
3803
3991
  cursor: Schema.NullOr(Schema.String),
3804
3992
  files: Schema.Array(TrashFileSchema),
3805
3993
  status: Schema.Literal("OK"),
3806
- total: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
3807
- trash_size: Schema.Number.pipe(Schema.nonNegative())
3994
+ total: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
3995
+ trash_size: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0))
3808
3996
  });
3809
3997
  const TrashContinueEnvelopeSchema = Schema.Struct({
3810
3998
  cursor: Schema.NullOr(Schema.String),
@@ -3926,14 +4114,33 @@ const emptyTrash = () => requestJson(OkResponseSchema, {
3926
4114
  }).pipe(Effect.asVoid, withOperationErrors(EmptyTrashErrorSpec));
3927
4115
  //#endregion
3928
4116
  //#region src/domains/transfers.ts
3929
- const TransferTypeSchema = Schema.Literal("URL", "TORRENT", "PLAYLIST", "LIVE_STREAM", "N/A");
3930
- const TransferStatusSchema = Schema.Literal("WAITING", "PREPARING_DOWNLOAD", "IN_QUEUE", "DOWNLOADING", "WAITING_FOR_COMPLETE_QUEUE", "WAITING_FOR_DOWNLOADER", "COMPLETING", "STOPPING", "SEEDING", "COMPLETED", "ERROR", "PREPARING_SEED");
4117
+ const TransferTypeSchema = Schema.Literals([
4118
+ "URL",
4119
+ "TORRENT",
4120
+ "PLAYLIST",
4121
+ "LIVE_STREAM",
4122
+ "N/A"
4123
+ ]);
4124
+ const TransferStatusSchema = Schema.Literals([
4125
+ "WAITING",
4126
+ "PREPARING_DOWNLOAD",
4127
+ "IN_QUEUE",
4128
+ "DOWNLOADING",
4129
+ "WAITING_FOR_COMPLETE_QUEUE",
4130
+ "WAITING_FOR_DOWNLOADER",
4131
+ "COMPLETING",
4132
+ "STOPPING",
4133
+ "SEEDING",
4134
+ "COMPLETED",
4135
+ "ERROR",
4136
+ "PREPARING_SEED"
4137
+ ]);
3931
4138
  const TransferLinkSchema = Schema.Struct({
3932
4139
  label: Schema.String,
3933
4140
  url: Schema.NullOr(Schema.String)
3934
4141
  });
3935
- const NullableInt = Schema.NullOr(Schema.Number.pipe(Schema.int()));
3936
- const NullableNonNegativeNumber = Schema.NullOr(Schema.Number.pipe(Schema.nonNegative()));
4142
+ const NullableInt = Schema.NullOr(Schema.Int);
4143
+ const NullableNonNegativeNumber = Schema.NullOr(Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)));
3937
4144
  const TransferBaseSchema = Schema.Struct({
3938
4145
  availability: NullableNonNegativeNumber,
3939
4146
  callback_url: Schema.NullOr(Schema.String),
@@ -3950,7 +4157,7 @@ const TransferBaseSchema = Schema.Struct({
3950
4157
  file_id: NullableInt,
3951
4158
  finished_at: Schema.NullOr(Schema.String),
3952
4159
  hash: Schema.NullOr(Schema.String),
3953
- id: Schema.Number.pipe(Schema.int()),
4160
+ id: Schema.Int,
3954
4161
  is_private: Schema.Boolean,
3955
4162
  links: Schema.optional(Schema.Array(TransferLinkSchema)),
3956
4163
  name: Schema.String,
@@ -3959,7 +4166,7 @@ const TransferBaseSchema = Schema.Struct({
3959
4166
  peers_sending_to_us: NullableInt,
3960
4167
  percent_done: NullableNonNegativeNumber,
3961
4168
  recorded_seconds: Schema.optional(NullableNonNegativeNumber),
3962
- save_parent_id: Schema.Number.pipe(Schema.int()),
4169
+ save_parent_id: Schema.Int,
3963
4170
  seconds_seeding: NullableNonNegativeNumber,
3964
4171
  simulated: Schema.Boolean,
3965
4172
  size: NullableNonNegativeNumber,
@@ -3975,32 +4182,42 @@ const TransferBaseSchema = Schema.Struct({
3975
4182
  up_speed: NullableNonNegativeNumber,
3976
4183
  userfile_exists: Schema.optional(Schema.Boolean)
3977
4184
  });
3978
- const TransferErrorSchema = Schema.extend(TransferBaseSchema.pipe(Schema.omit("error_message", "status")), Schema.Struct({
4185
+ const TransferErrorSchema = TransferBaseSchema.mapFields(({ error_message: _errorMessage, status: _status, ...fields }) => fields).pipe(Schema.fieldsAssign({
3979
4186
  error_message: Schema.String,
3980
4187
  status: Schema.Literal("ERROR")
3981
4188
  }));
3982
- const TransferCompletedSchema = Schema.extend(TransferBaseSchema.pipe(Schema.omit("status")), Schema.Struct({ status: Schema.Literal("COMPLETED") }));
3983
- const TransferLiveSchema = Schema.extend(TransferBaseSchema.pipe(Schema.omit("recorded_seconds", "type")), Schema.Struct({
3984
- recorded_seconds: Schema.Number.pipe(Schema.nonNegative()),
4189
+ const TransferCompletedSchema = TransferBaseSchema.mapFields(({ status: _status, ...fields }) => fields).pipe(Schema.fieldsAssign({ status: Schema.Literal("COMPLETED") }));
4190
+ const TransferLiveSchema = TransferBaseSchema.mapFields(({ recorded_seconds: _recordedSeconds, type: _type, ...fields }) => fields).pipe(Schema.fieldsAssign({
4191
+ recorded_seconds: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
3985
4192
  type: Schema.Literal("LIVE_STREAM")
3986
4193
  }));
3987
- const TransferTorrentSeedingSchema = Schema.extend(TransferBaseSchema.pipe(Schema.omit("current_ratio", "seconds_seeding", "status", "type")), Schema.Struct({
3988
- current_ratio: Schema.Number.pipe(Schema.nonNegative()),
3989
- seconds_seeding: Schema.Number.pipe(Schema.nonNegative()),
3990
- status: Schema.Literal("SEEDING", "COMPLETED", "PREPARING_SEED"),
4194
+ const TransferTorrentSeedingSchema = TransferBaseSchema.mapFields(({ current_ratio: _currentRatio, seconds_seeding: _secondsSeeding, status: _status, type: _type, ...fields }) => fields).pipe(Schema.fieldsAssign({
4195
+ current_ratio: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
4196
+ seconds_seeding: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
4197
+ status: Schema.Literals([
4198
+ "SEEDING",
4199
+ "COMPLETED",
4200
+ "PREPARING_SEED"
4201
+ ]),
3991
4202
  type: Schema.Literal("TORRENT")
3992
4203
  }));
3993
- const TransferSchema = Schema.Union(TransferErrorSchema, TransferLiveSchema, TransferTorrentSeedingSchema, TransferCompletedSchema, TransferBaseSchema);
3994
- const TransfersListQuerySchema = Schema.Struct({ per_page: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.positive())) });
4204
+ const TransferSchema = Schema.Union([
4205
+ TransferErrorSchema,
4206
+ TransferLiveSchema,
4207
+ TransferTorrentSeedingSchema,
4208
+ TransferCompletedSchema,
4209
+ TransferBaseSchema
4210
+ ]);
4211
+ const TransfersListQuerySchema = Schema.Struct({ per_page: Schema.optional(Schema.Int.check(Schema.isGreaterThan(0))) });
3995
4212
  const TransferAddInputSchema = Schema.Struct({
3996
4213
  callback_url: Schema.optional(Schema.String),
3997
- save_parent_id: Schema.optional(Schema.Number.pipe(Schema.int())),
4214
+ save_parent_id: Schema.optional(Schema.Int),
3998
4215
  url: Schema.String
3999
4216
  });
4000
4217
  const TransferInfoItemSchema = Schema.Struct({
4001
4218
  error: Schema.optional(Schema.String),
4002
4219
  error_message: Schema.optional(Schema.String),
4003
- file_size: Schema.Number.pipe(Schema.nonNegative()),
4220
+ file_size: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
4004
4221
  human_size: Schema.String,
4005
4222
  name: Schema.String,
4006
4223
  type_name: Schema.String,
@@ -4009,7 +4226,7 @@ const TransferInfoItemSchema = Schema.Struct({
4009
4226
  const TransfersListEnvelopeSchema = Schema.Struct({
4010
4227
  cursor: Schema.optional(Schema.NullOr(Schema.String)),
4011
4228
  status: Schema.Literal("OK"),
4012
- total: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.nonNegative())),
4229
+ total: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
4013
4230
  transfers: Schema.Array(TransferSchema)
4014
4231
  });
4015
4232
  const TransfersContinueEnvelopeSchema = Schema.Struct({
@@ -4022,17 +4239,17 @@ const TransferEnvelopeSchema = Schema.Struct({
4022
4239
  transfer: TransferSchema
4023
4240
  });
4024
4241
  const TransferCountEnvelopeSchema = Schema.Struct({
4025
- count: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
4242
+ count: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
4026
4243
  status: Schema.Literal("OK")
4027
4244
  });
4028
4245
  const TransferInfoEnvelopeSchema = Schema.Struct({
4029
- disk_avail: Schema.Number.pipe(Schema.nonNegative()),
4246
+ disk_avail: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
4030
4247
  ret: Schema.Array(TransferInfoItemSchema),
4031
4248
  status: Schema.Literal("OK")
4032
4249
  });
4033
4250
  const TransfersAddMultiErrorSchema = Schema.Struct({
4034
4251
  error_type: Schema.String,
4035
- status_code: Schema.Number.pipe(Schema.int()),
4252
+ status_code: Schema.Int,
4036
4253
  url: Schema.String
4037
4254
  });
4038
4255
  const TransfersAddMultiEnvelopeSchema = Schema.Struct({
@@ -4041,7 +4258,7 @@ const TransfersAddMultiEnvelopeSchema = Schema.Struct({
4041
4258
  transfers: Schema.Array(TransferSchema)
4042
4259
  });
4043
4260
  const TransfersCleanEnvelopeSchema = Schema.Struct({
4044
- deleted_ids: Schema.Array(Schema.Number.pipe(Schema.int())),
4261
+ deleted_ids: Schema.Array(Schema.Int),
4045
4262
  status: Schema.Literal("OK")
4046
4263
  });
4047
4264
  const ListTransfersErrorSpec = definePutioOperationErrorSpec({
@@ -4161,7 +4378,7 @@ const continueTransfers = (cursor, query = {}) => requestJson(TransfersContinueE
4161
4378
  }).pipe(withOperationErrors(ListTransfersErrorSpec));
4162
4379
  const getTransfer = (id) => requestJson(TransferEnvelopeSchema, {
4163
4380
  method: "GET",
4164
- path: `/v2/transfers/${id}`
4381
+ path: `/v2/transfers/${encodePathSegment(id)}`
4165
4382
  }).pipe(selectJsonField("transfer"), withOperationErrors(GetTransferErrorSpec));
4166
4383
  const countTransfers = () => requestJson(TransferCountEnvelopeSchema, {
4167
4384
  method: "GET",
@@ -4256,10 +4473,15 @@ const listTunnelRoutes = () => requestJson(TunnelRoutesEnvelopeSchema, {
4256
4473
  }).pipe(selectJsonField("routes"), withOperationErrors(ListTunnelRoutesErrorSpec));
4257
4474
  //#endregion
4258
4475
  //#region src/domains/zips.ts
4259
- const ZipStatusSchema = Schema.Literal("NEW", "PROCESSING", "DONE", "ERROR");
4476
+ const ZipStatusSchema = Schema.Literals([
4477
+ "NEW",
4478
+ "PROCESSING",
4479
+ "DONE",
4480
+ "ERROR"
4481
+ ]);
4260
4482
  const ZipSummarySchema = Schema.Struct({
4261
4483
  created_at: Schema.String,
4262
- id: Schema.Number.pipe(Schema.int(), Schema.positive())
4484
+ id: Schema.Int.check(Schema.isGreaterThan(0))
4263
4485
  });
4264
4486
  const ZipsListEnvelopeSchema = Schema.Struct({
4265
4487
  status: Schema.Literal("OK"),
@@ -4267,12 +4489,12 @@ const ZipsListEnvelopeSchema = Schema.Struct({
4267
4489
  });
4268
4490
  const ZipCreateEnvelopeSchema = Schema.Struct({
4269
4491
  status: Schema.Literal("OK"),
4270
- zip_id: Schema.Number.pipe(Schema.int(), Schema.positive())
4492
+ zip_id: Schema.Int.check(Schema.isGreaterThan(0))
4271
4493
  });
4272
4494
  const ZipInfoPendingSchema = Schema.Struct({
4273
4495
  status: Schema.Literal("OK"),
4274
4496
  url: Schema.Null,
4275
- zip_status: Schema.Literal("NEW", "PROCESSING")
4497
+ zip_status: Schema.Literals(["NEW", "PROCESSING"])
4276
4498
  });
4277
4499
  const ZipInfoErrorSchema = Schema.Struct({
4278
4500
  error_msg: Schema.String,
@@ -4280,15 +4502,24 @@ const ZipInfoErrorSchema = Schema.Struct({
4280
4502
  url: Schema.Null,
4281
4503
  zip_status: Schema.Literal("ERROR")
4282
4504
  });
4505
+ const ZipMissingFileSchema = Schema.Struct({
4506
+ id: Schema.Int.check(Schema.isGreaterThan(0)),
4507
+ missing: Schema.Boolean,
4508
+ name: Schema.String
4509
+ });
4283
4510
  const ZipInfoDoneSchema = Schema.Struct({
4284
- id: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.positive())),
4285
- missing_files: Schema.Array(Schema.String),
4286
- size: Schema.Number.pipe(Schema.nonNegative()),
4511
+ id: Schema.optional(Schema.Int.check(Schema.isGreaterThan(0))),
4512
+ missing_files: Schema.Array(Schema.Union([Schema.String, ZipMissingFileSchema])),
4513
+ size: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
4287
4514
  status: Schema.Literal("OK"),
4288
4515
  url: Schema.String,
4289
4516
  zip_status: Schema.Literal("DONE")
4290
4517
  });
4291
- const ZipInfoSchema = Schema.Union(ZipInfoPendingSchema, ZipInfoErrorSchema, ZipInfoDoneSchema);
4518
+ const ZipInfoSchema = Schema.Union([
4519
+ ZipInfoPendingSchema,
4520
+ ZipInfoErrorSchema,
4521
+ ZipInfoDoneSchema
4522
+ ]);
4292
4523
  const FilesReadScopeError = {
4293
4524
  errorType: "invalid_scope",
4294
4525
  statusCode: 401
@@ -4364,11 +4595,11 @@ const createZip = (input) => requestJson(ZipCreateEnvelopeSchema, {
4364
4595
  }).pipe(selectJsonField("zip_id"), withOperationErrors(CreateZipErrorSpec));
4365
4596
  const getZip = (id) => requestJson(ZipInfoSchema, {
4366
4597
  method: "GET",
4367
- path: `/v2/zips/${id}`
4598
+ path: `/v2/zips/${encodePathSegment(id)}`
4368
4599
  }).pipe(withOperationErrors(GetZipErrorSpec));
4369
4600
  const cancelZip = (id) => requestJson(OkResponseSchema, {
4370
4601
  method: "GET",
4371
- path: `/v2/zips/${id}/cancel`
4602
+ path: `/v2/zips/${encodePathSegment(id)}/cancel`
4372
4603
  }).pipe(Effect.asVoid, withOperationErrors(CancelZipErrorSpec));
4373
4604
  //#endregion
4374
4605
  //#region src/core/client.ts
@@ -4392,8 +4623,8 @@ const disposePromiseClientRuntime = async (config) => {
4392
4623
  const rejectWithSdkFailure = (exit) => Exit.match(exit, {
4393
4624
  onSuccess: (value) => Promise.resolve(value),
4394
4625
  onFailure: (cause) => {
4395
- const failure = Cause.failureOption(cause);
4396
- if (Option.isSome(failure)) return Promise.reject(failure.value);
4626
+ const failure = cause.reasons.find(Cause.isFailReason);
4627
+ if (failure) return Promise.reject(failure.error);
4397
4628
  return Promise.reject(Cause.squash(cause));
4398
4629
  }
4399
4630
  });
@@ -4616,6 +4847,9 @@ const createPutioSdkEffectClient = () => ({
4616
4847
  list: listZips
4617
4848
  }
4618
4849
  });
4850
+ var PutioSdk = class extends Context.Service()("PutioSdk") {};
4851
+ const makePutioSdkEffectClientLayer = () => Layer.succeed(PutioSdk, createPutioSdkEffectClient());
4852
+ const makePutioSdkLiveClientLayer = (config) => Layer.mergeAll(makePutioSdkEffectClientLayer(), makePutioSdkLiveLayer(config));
4619
4853
  const createPutioSdkPromiseClient = (initialConfig = {}) => {
4620
4854
  const config = { ...initialConfig };
4621
4855
  function getInfo(query) {
@@ -4846,6 +5080,6 @@ const createPutioSdkPromiseClient = (initialConfig = {}) => {
4846
5080
  };
4847
5081
  };
4848
5082
  //#endregion
4849
- export { AccountClearOptionsSchema, AccountConfirmationSchema, AccountConfirmationsErrorSpec, AccountDiskSchema, AccountInfoBaseSchema, AccountInfoBroadSchema, AccountInfoQuerySchema, AccountSettingsSchema, AccountTwoFactorSettingsSchema, AccountWarningsSchema, AddManyTransfersErrorSpec, AddTransferErrorSpec, ApproveFriendRequestErrorSpec, AuthorizationCodeSchema, CancelZipErrorSpec, ClearEventsErrorSpec, ClearRssFeedLogsErrorSpec, ClientsErrorSpec, ConfirmFastspringOrderErrorSpec, ContinueFilesErrorSpec, ContinuePublicShareFilesErrorSpec, ContinueTrashErrorSpec, CountWaitingRequestsErrorSpec, CreateCoinbaseChargeErrorSpec, CreateDownloadLinksErrorSpec, CreateFamilyInviteErrorSpec, CreateFolderErrorSpec, CreateFriendInviteErrorSpec, CreateNanoPaymentRequestErrorSpec, CreateOAuthAppErrorSpec, CreateOpenNodeChargeErrorSpec, CreatePaddleWaitingPaymentErrorSpec, CreatePublicShareErrorSpec, CreateRssFeedErrorSpec, CreateSharingCloneErrorSpec, CreateZipErrorSpec, DEFAULT_PUTIO_API_BASE_URL, DEFAULT_PUTIO_UPLOAD_BASE_URL, DEFAULT_PUTIO_WEB_APP_URL, DeleteEventErrorSpec, DeleteOAuthAppErrorSpec, DeletePublicShareErrorSpec, DeleteRssFeedErrorSpec, DeleteTrashErrorSpec, DenyFriendRequestErrorSpec, DownloadLinksCreateInputSchema, DownloadLinksInfoSchema, DownloadLinksPayloadSchema, DownloadLinksStatusSchema, DownloadUrlErrorSpec, EmptyTrashErrorSpec, EventsListQuerySchema, FamilyInviteLookupErrorSpec, FamilyInviteSchema, FamilyMemberSchema, FileActiveConversionSchema, FileActiveConversionsErrorSpec, FileBaseSchema, FileBreadcrumbSchema, FileBroadSchema, FileConversionStatusSchema, FileExtractionSchema, FileExtractionStatusSchema, FileExtractionsErrorSpec, FileMediaInfoFormatSchema, FileMediaInfoSchema, FileMediaInfoStreamSchema, FileMediaMetadataSchema, FileMp4ErrorSpec, FileMp4MutationErrorSpec, FileQuerySchema, FileSortSchema, FileSubtitleSchema, FileSubtitlesErrorSpec, FileTypeSchema, FileUploadErrorSpec, FileWatchStatusErrorSpec, FilesListEnvelopeSchema, FilesListQuerySchema, FilesMoveErrorSchema, FilesSearchQuerySchema, FolderTypeSchema, ForgotPasswordErrorSpec, FriendBaseSchema, FriendInviteJoinedUserSchema, FriendInviteJoinedUserStatusSchema, FriendInviteLookupErrorSpec, FriendInviteSchema, FriendSchema, FriendSharedFolderErrorSpec, GenerateTOTPErrorSpec, GenerateTOTPResponseSchema, GetDownloadLinksErrorSpec, GetEventTorrentErrorSpec, GetFileErrorSpec, GetIftttStatusErrorSpec, GetOAuthAppErrorSpec, GetPaymentInfoErrorSpec, GetPaymentVoucherInfoErrorSpec, GetPublicShareErrorSpec, GetPublicShareFileUrlErrorSpec, GetRssFeedErrorSpec, GetSharedWithErrorSpec, GetSharingCloneInfoErrorSpec, GetTransferErrorSpec, GetZipErrorSpec, GiftCardLookupErrorSpec, GrantsErrorSpec, HistoryEventSchema, HistoryFileFromRssDeletedEventSchema, HistoryFileSharedEventSchema, HistoryKnownEventTypeSchema, HistoryPrivateTorrentPinEventSchema, HistoryRssFilterPausedEventSchema, HistoryTransferCallbackErrorEventSchema, HistoryTransferCompletedEventSchema, HistoryTransferErrorEventSchema, HistoryTransferFromRssErrorEventSchema, HistoryUploadEventSchema, HistoryVoucherEventSchema, HistoryZipCreatedEventSchema, JoinFamilyErrorSpec, JsonObjectSchema, JsonValueSchema, LinkDeviceErrorSpec, ListEventsErrorSpec, ListFamilyInvitesErrorSpec, ListFamilyMembersErrorSpec, ListFriendInvitesErrorSpec, ListFriendsErrorSpec, ListPaymentHistoryErrorSpec, ListPaymentInvitesErrorSpec, ListPaymentOptionsErrorSpec, ListPaymentPlansErrorSpec, ListPublicShareFilesErrorSpec, ListPublicSharesErrorSpec, ListRssFeedItemsErrorSpec, ListRssFeedsErrorSpec, ListSentRequestsErrorSpec, ListSharedFilesErrorSpec, ListTransfersErrorSpec, ListTrashErrorSpec, ListTunnelRoutesErrorSpec, ListWaitingRequestsErrorSpec, ListZipsErrorSpec, LoginErrorSpec, LoginResponseSchema, MyOAuthAppSchema, OAuthAppCreateInputSchema, OAuthAppSchema, OAuthAppSessionSchema, OAuthAppUpdateInputSchema, OAuthAppWithTokenSchema, OAuthSetIconInputSchema, OkResponseSchema, OwnedOAuthAppSchema, PasInfoSchema, PauseRssFeedErrorSpec, PaymentChangePlanPreviewSchema, PaymentChangePlanSubmitSchema, PaymentHistoryItemSchema, PaymentInfoPlanSchema, PaymentInfoSchema, PaymentInviteSchema, PaymentOptionPlanTypeSchema, PaymentOptionSchema, PaymentPlanGroupSchema, PaymentPlanTypeSchema, PaymentProviderNameSchema, PaymentProviderSchema, PaymentSubscriptionInfoSchema, PaymentTypeSchema, PaymentVoucherInfoSchema, PopularOAuthAppSchema, PreviewPaymentChangePlanErrorSpec, PublicShareListQuerySchema, PublicShareSchema, PutioApiError, PutioAuthError, PutioConfigurationError, PutioErrorEnvelopeSchema, PutioOperationError, PutioRateLimitError, PutioSdkConfig, PutioTransportError, PutioValidationError, QueryFilesErrorSpec, QueryOAuthAppsErrorSpec, ReannounceTransferErrorSpec, RecoveryCodesErrorSpec, RedeemPaymentVoucherErrorSpec, RegenerateOAuthAppTokenErrorSpec, RegenerateRecoveryCodesErrorSpec, RegisterErrorSpec, RegisterInputSchema, RemoveFamilyMemberErrorSpec, RemoveFriendErrorSpec, RenameFileErrorSpec, ReportPaymentsErrorSpec, ResetPasswordErrorSpec, RestoreTrashErrorSpec, ResumeRssFeedErrorSpec, RetryAllRssFeedItemsErrorSpec, RetryRssFeedItemErrorSpec, RetryTransferErrorSpec, RevokeAllOAuthClientsErrorSpec, RevokeOAuthClientErrorSpec, RevokeOAuthGrantErrorSpec, RssFeedItemFailedSchema, RssFeedItemSchema, RssFeedItemSucceededSchema, RssFeedParamsSchema, RssFeedSchema, SaveAccountSettingsErrorSpec, SaveAccountSettingsPayloadSchema, SearchFilesErrorSpec, SearchFriendsErrorSpec, SendFriendRequestErrorSpec, SendIftttEventErrorSpec, ShareFilesErrorSpec, SharedFileSchema, SharedFileShareSchema, SharedFileSharedWithSchema, SharingCloneInfoSchema, SharingCloneInputSchema, SharingCloneStatusSchema, SharingShareInputSchema, SharingUnshareInputSchema, StartFromErrorSpec, StopRecordingTransferErrorSpec, StopSubscriptionErrorSpec, SubmitPaymentChangePlanErrorSpec, TransferAddInputSchema, TransferBaseSchema, TransferSchema, TransferStatusSchema, TransferTypeSchema, TransfersListQuerySchema, TrashFileSchema, TunnelRouteSchema, TwoFactorRecoveryCodesSchema, UnshareFileErrorSpec, UpdateOAuthAppErrorSpec, UpdateRssFeedErrorSpec, UserSearchResultSchema, UserSubscriptionStatusSchema, ValidateTokenResponseSchema, VerifyTOTPErrorSpec, VerifyTOTPResponseSchema, VoucherLookupErrorSpec, ZipStatusSchema, addManyTransfers, addTransfer, approveFriendRequest, buildAuthLoginUrl, buildFileApiContentUrl, buildFileApiDownloadUrl, buildFileApiMp4DownloadUrl, buildFileHlsStreamUrl, buildOAuthAppIconUrl, buildOAuthAuthorizeUrl, buildPutioUrl, cancelTransfers, cancelZip, checkCodeMatch, classifyPaymentChangePlanResponse, cleanTransfers, clearAccount, clearEvents, clearRssFeedLogs, clients, cloneSharedFiles, confirmFastspringOrder, continueFiles, continuePublicShareFiles, continueSearch, continueTransfers, continueTrash, convertFileSelectionToMp4, convertFileToMp4, convertFilesToMp4, countTransfers, countWaitingRequests, createCoinbaseCharge, createDownloadLinks, createFamilyInvite, createFileUploadFormData, createFileUploadRequest, createFolder, createFriendInvite, createNanoPaymentRequest, createOAuthApp, createOpenNodeCharge, createPaddleWaitingPayment, createPublicShare, createPutioSdkEffectClient, createPutioSdkPromiseClient, createRssFeed, createZip, decodePutioErrorEnvelope, definePutioOperationErrorSpec, deleteConfigKey, deleteEvent, deleteFileExtraction, deleteFileMp4, deleteFileSelection, deleteFiles, deleteOAuthApp, deletePublicShare, deleteRssFeed, deleteTrash, denyFriendRequest, destroyAccount, emptyTrash, exists, extractFiles, fallbackPutioErrorEnvelope, findNextFile, findNextVideo, forgotPassword, generateTOTP, getAccountInfo, getAccountSettings, getApiContentUrl, getApiDownloadUrl, getApiMp4DownloadUrl, getCode, getConfigKey, getConfigKeyWith, getDownloadLinks, getDownloadUrl, getEventTorrent, getFamilyInvite, getFile, getFriendInvite, getFriendSharedFolder, getGiftCard, getHlsStreamUrl, getIftttStatus, getMp4Status, getOAuthApp, getPaymentInfo, getPaymentVoucherInfo, getPopularOAuthApps, getPublicShare, getPublicShareFileUrl, getRecoveryCodes, getRssFeed, getSharedWith, getSharingCloneInfo, getStartFrom, getTransfer, getTransferInfo, getVoucher, getZip, grants, joinFamily, linkDevice, listAccountConfirmations, listActiveMp4Conversions, listEvents, listFamilyInvites, listFamilyMembers, listFileExtractions, listFileSubtitles, listFriendInvites, listFriends, listPaymentHistory, listPaymentInvites, listPaymentOptions, listPaymentPlans, listPublicShareFiles, listPublicShares, listRssFeedItems, listRssFeeds, listSentRequests, listSharedFiles, listTransfers, listTrash, listTunnelRoutes, listWaitingRequests, listZips, login, logout, makePutioSdkConfig, makePutioSdkLayer, makePutioSdkLiveLayer, makeResponseError, mapConfigurationError, mapDecodeErrorToValidationError, mapTransportError, moveFileSelection, moveFiles, parseErrorBody, pauseRssFeed, previewPaymentChangePlan, putMp4ToMyFiles, queryFiles, queryOAuthApps, readConfig, readConfigWith, reannounceTransfer, redeemPaymentVoucher, regenerateOAuthAppToken, regenerateRecoveryCodes, register, removeFamilyMember, removeFriend, renameFile, reportPayments, requestArrayBuffer, requestJson, requestVoid, resetPassword, resetStartFrom, responseRateLimitHeaders, restoreTrash, resumeRssFeed, retryAllRssFeedItems, retryRssFeedItem, retryTransfer, revokeAllClients, revokeApp, revokeClient, saveAccountSettings, searchFiles, searchFriends, selectJsonField, selectJsonFields, sendFriendRequest, sendIftttEvent, setConfigKey, setFilesWatchStatus, setOAuthAppIcon, setStartFrom, shareFiles, stopPaymentSubscription, stopTransferRecording, submitPaymentChangePlan, unshareFile, updateOAuthApp, updateRssFeed, uploadFile, validateToken, verifyTOTP, withOperationErrors, writeConfig };
5083
+ export { AccountClearOptionsSchema, AccountConfirmationSchema, AccountConfirmationsErrorSpec, AccountDiskSchema, AccountInfoBaseSchema, AccountInfoBroadSchema, AccountInfoQuerySchema, AccountSettingsSchema, AccountTwoFactorSettingsSchema, AccountWarningsSchema, AddManyTransfersErrorSpec, AddTransferErrorSpec, ApproveFriendRequestErrorSpec, AuthorizationCodeSchema, CancelZipErrorSpec, ClearEventsErrorSpec, ClearRssFeedLogsErrorSpec, ClientsErrorSpec, ConfirmFastspringOrderErrorSpec, ContinueFilesErrorSpec, ContinuePublicShareFilesErrorSpec, ContinueTrashErrorSpec, CountWaitingRequestsErrorSpec, CreateCoinbaseChargeErrorSpec, CreateDownloadLinksErrorSpec, CreateFamilyInviteErrorSpec, CreateFolderErrorSpec, CreateFriendInviteErrorSpec, CreateNanoPaymentRequestErrorSpec, CreateOAuthAppErrorSpec, CreateOpenNodeChargeErrorSpec, CreatePaddleWaitingPaymentErrorSpec, CreatePublicShareErrorSpec, CreateRssFeedErrorSpec, CreateSharingCloneErrorSpec, CreateZipErrorSpec, DEFAULT_PUTIO_API_BASE_URL, DEFAULT_PUTIO_UPLOAD_BASE_URL, DEFAULT_PUTIO_WEB_APP_URL, DeleteEventErrorSpec, DeleteOAuthAppErrorSpec, DeletePublicShareErrorSpec, DeleteRssFeedErrorSpec, DeleteTrashErrorSpec, DenyFriendRequestErrorSpec, DownloadLinksCreateInputSchema, DownloadLinksInfoSchema, DownloadLinksPayloadSchema, DownloadLinksStatusSchema, DownloadUrlErrorSpec, EmptyTrashErrorSpec, EventsListQuerySchema, FamilyInviteLookupErrorSpec, FamilyInviteSchema, FamilyMemberSchema, FileActiveConversionSchema, FileActiveConversionsErrorSpec, FileBaseSchema, FileBreadcrumbSchema, FileBroadSchema, FileConversionStatusSchema, FileExtractionSchema, FileExtractionStatusSchema, FileExtractionsErrorSpec, FileMediaInfoFormatSchema, FileMediaInfoSchema, FileMediaInfoStreamSchema, FileMediaMetadataSchema, FileMp4ErrorSpec, FileMp4MutationErrorSpec, FileQuerySchema, FileSortSchema, FileSubtitleSchema, FileSubtitlesErrorSpec, FileTypeSchema, FileUploadErrorSpec, FileWatchStatusErrorSpec, FilesListEnvelopeSchema, FilesListQuerySchema, FilesMoveErrorSchema, FilesSearchQuerySchema, FolderTypeSchema, ForgotPasswordErrorSpec, FriendBaseSchema, FriendInviteJoinedUserSchema, FriendInviteJoinedUserStatusSchema, FriendInviteLookupErrorSpec, FriendInviteSchema, FriendSchema, FriendSharedFolderErrorSpec, GenerateTOTPErrorSpec, GenerateTOTPResponseSchema, GetDownloadLinksErrorSpec, GetEventTorrentErrorSpec, GetFileErrorSpec, GetIftttStatusErrorSpec, GetOAuthAppErrorSpec, GetPaymentInfoErrorSpec, GetPaymentVoucherInfoErrorSpec, GetPublicShareErrorSpec, GetPublicShareFileUrlErrorSpec, GetRssFeedErrorSpec, GetSharedWithErrorSpec, GetSharingCloneInfoErrorSpec, GetTransferErrorSpec, GetZipErrorSpec, GiftCardLookupErrorSpec, GrantsErrorSpec, HistoryEventSchema, HistoryFileFromRssDeletedEventSchema, HistoryFileSharedEventSchema, HistoryKnownEventTypeSchema, HistoryPrivateTorrentPinEventSchema, HistoryRssFilterPausedEventSchema, HistoryTransferCallbackErrorEventSchema, HistoryTransferCompletedEventSchema, HistoryTransferErrorEventSchema, HistoryTransferFromRssErrorEventSchema, HistoryUploadEventSchema, HistoryVoucherEventSchema, HistoryZipCreatedEventSchema, JoinFamilyErrorSpec, JsonObjectSchema, JsonValueSchema, LinkDeviceErrorSpec, ListEventsErrorSpec, ListFamilyInvitesErrorSpec, ListFamilyMembersErrorSpec, ListFriendInvitesErrorSpec, ListFriendsErrorSpec, ListPaymentHistoryErrorSpec, ListPaymentInvitesErrorSpec, ListPaymentOptionsErrorSpec, ListPaymentPlansErrorSpec, ListPublicShareFilesErrorSpec, ListPublicSharesErrorSpec, ListRssFeedItemsErrorSpec, ListRssFeedsErrorSpec, ListSentRequestsErrorSpec, ListSharedFilesErrorSpec, ListTransfersErrorSpec, ListTrashErrorSpec, ListTunnelRoutesErrorSpec, ListWaitingRequestsErrorSpec, ListZipsErrorSpec, LoginErrorSpec, LoginResponseSchema, MyOAuthAppSchema, OAuthAppCreateInputSchema, OAuthAppSchema, OAuthAppSessionSchema, OAuthAppUpdateInputSchema, OAuthAppWithTokenSchema, OAuthSetIconInputSchema, OkResponseSchema, OwnedOAuthAppSchema, PasInfoSchema, PauseRssFeedErrorSpec, PaymentChangePlanPreviewSchema, PaymentChangePlanSubmitSchema, PaymentHistoryItemSchema, PaymentInfoPlanSchema, PaymentInfoSchema, PaymentInviteSchema, PaymentOptionPlanTypeSchema, PaymentOptionSchema, PaymentPlanGroupSchema, PaymentPlanTypeSchema, PaymentProviderNameSchema, PaymentProviderSchema, PaymentSubscriptionInfoSchema, PaymentTypeSchema, PaymentVoucherInfoSchema, PopularOAuthAppSchema, PreviewPaymentChangePlanErrorSpec, PublicShareListQuerySchema, PublicShareSchema, PutioApiError, PutioAuthError, PutioConfigurationError, PutioErrorEnvelopeSchema, PutioOperationError, PutioRateLimitError, PutioSdk, PutioSdkConfig, PutioTransportError, PutioValidationError, QueryFilesErrorSpec, QueryOAuthAppsErrorSpec, ReannounceTransferErrorSpec, RecoveryCodesErrorSpec, RedeemPaymentVoucherErrorSpec, RegenerateOAuthAppTokenErrorSpec, RegenerateRecoveryCodesErrorSpec, RegisterErrorSpec, RegisterInputSchema, RemoveFamilyMemberErrorSpec, RemoveFriendErrorSpec, RenameFileErrorSpec, ReportPaymentsErrorSpec, ResetPasswordErrorSpec, RestoreTrashErrorSpec, ResumeRssFeedErrorSpec, RetryAllRssFeedItemsErrorSpec, RetryRssFeedItemErrorSpec, RetryTransferErrorSpec, RevokeAllOAuthClientsErrorSpec, RevokeOAuthClientErrorSpec, RevokeOAuthGrantErrorSpec, RssFeedItemFailedSchema, RssFeedItemSchema, RssFeedItemSucceededSchema, RssFeedParamsSchema, RssFeedSchema, SaveAccountSettingsErrorSpec, SaveAccountSettingsPayloadSchema, SearchFilesErrorSpec, SearchFriendsErrorSpec, SendFriendRequestErrorSpec, SendIftttEventErrorSpec, ShareFilesErrorSpec, SharedFileSchema, SharedFileShareSchema, SharedFileSharedWithSchema, SharingCloneInfoSchema, SharingCloneInputSchema, SharingCloneStatusSchema, SharingShareInputSchema, SharingUnshareInputSchema, StartFromErrorSpec, StopRecordingTransferErrorSpec, StopSubscriptionErrorSpec, SubmitPaymentChangePlanErrorSpec, TransferAddInputSchema, TransferBaseSchema, TransferSchema, TransferStatusSchema, TransferTypeSchema, TransfersListQuerySchema, TrashFileSchema, TunnelRouteSchema, TwoFactorRecoveryCodesSchema, UnshareFileErrorSpec, UpdateOAuthAppErrorSpec, UpdateRssFeedErrorSpec, UserSearchResultSchema, UserSubscriptionStatusSchema, ValidateTokenResponseSchema, VerifyTOTPErrorSpec, VerifyTOTPResponseSchema, VoucherLookupErrorSpec, ZipStatusSchema, addManyTransfers, addTransfer, approveFriendRequest, buildAuthLoginUrl, buildFileApiContentUrl, buildFileApiDownloadUrl, buildFileApiMp4DownloadUrl, buildFileHlsStreamUrl, buildOAuthAppIconUrl, buildOAuthAuthorizeUrl, buildPutioUrl, cancelTransfers, cancelZip, checkCodeMatch, classifyPaymentChangePlanResponse, cleanTransfers, clearAccount, clearEvents, clearRssFeedLogs, clients, cloneSharedFiles, confirmFastspringOrder, continueFiles, continuePublicShareFiles, continueSearch, continueTransfers, continueTrash, convertFileSelectionToMp4, convertFileToMp4, convertFilesToMp4, countTransfers, countWaitingRequests, createCoinbaseCharge, createDownloadLinks, createFamilyInvite, createFileUploadFormData, createFileUploadRequest, createFolder, createFriendInvite, createNanoPaymentRequest, createOAuthApp, createOpenNodeCharge, createPaddleWaitingPayment, createPublicShare, createPutioSdkEffectClient, createPutioSdkPromiseClient, createRssFeed, createZip, decodePutioErrorEnvelope, definePutioOperationErrorSpec, deleteConfigKey, deleteEvent, deleteFileExtraction, deleteFileMp4, deleteFileSelection, deleteFiles, deleteOAuthApp, deletePublicShare, deleteRssFeed, deleteTrash, denyFriendRequest, destroyAccount, emptyTrash, encodePathSegment, exists, extractFiles, fallbackPutioErrorEnvelope, findNextFile, findNextVideo, forgotPassword, generateTOTP, getAccountInfo, getAccountSettings, getApiContentUrl, getApiDownloadUrl, getApiMp4DownloadUrl, getCode, getConfigKey, getConfigKeyWith, getDownloadLinks, getDownloadUrl, getEventTorrent, getFamilyInvite, getFile, getFriendInvite, getFriendSharedFolder, getGiftCard, getHlsStreamUrl, getIftttStatus, getMp4Status, getOAuthApp, getPaymentInfo, getPaymentVoucherInfo, getPopularOAuthApps, getPublicShare, getPublicShareFileUrl, getRecoveryCodes, getRssFeed, getSharedWith, getSharingCloneInfo, getStartFrom, getTransfer, getTransferInfo, getVoucher, getZip, grants, isPutioApiError, isPutioAuthError, isPutioErrorEnvelope, isPutioOperationError, isPutioRateLimitError, joinFamily, linkDevice, listAccountConfirmations, listActiveMp4Conversions, listEvents, listFamilyInvites, listFamilyMembers, listFileExtractions, listFileSubtitles, listFriendInvites, listFriends, listPaymentHistory, listPaymentInvites, listPaymentOptions, listPaymentPlans, listPublicShareFiles, listPublicShares, listRssFeedItems, listRssFeeds, listSentRequests, listSharedFiles, listTransfers, listTrash, listTunnelRoutes, listWaitingRequests, listZips, login, logout, makePutioSdkConfig, makePutioSdkEffectClientLayer, makePutioSdkLayer, makePutioSdkLiveClientLayer, makePutioSdkLiveLayer, makeResponseError, mapConfigurationError, mapDecodeErrorToValidationError, mapTransportError, moveFileSelection, moveFiles, parseErrorBody, pauseRssFeed, previewPaymentChangePlan, putMp4ToMyFiles, queryFiles, queryOAuthApps, readConfig, readConfigWith, reannounceTransfer, redeemPaymentVoucher, regenerateOAuthAppToken, regenerateRecoveryCodes, register, removeFamilyMember, removeFriend, renameFile, reportPayments, requestArrayBuffer, requestJson, requestVoid, resetPassword, resetStartFrom, responseRateLimitHeaders, restoreTrash, resumeRssFeed, retryAllRssFeedItems, retryRssFeedItem, retryTransfer, revokeAllClients, revokeApp, revokeClient, saveAccountSettings, searchFiles, searchFriends, selectJsonField, selectJsonFields, sendFriendRequest, sendIftttEvent, setConfigKey, setFilesWatchStatus, setOAuthAppIcon, setStartFrom, shareFiles, stopPaymentSubscription, stopTransferRecording, submitPaymentChangePlan, unshareFile, updateOAuthApp, updateRssFeed, uploadFile, validateToken, verifyTOTP, withOperationErrors, writeConfig };
4850
5084
 
4851
5085
  //# sourceMappingURL=index.js.map