@putdotio/sdk 10.4.1 → 11.0.1

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
@@ -421,6 +421,17 @@ const deleteAllAppSpecificPasswords = () => requestJson(OkResponseSchema, {
421
421
  path: "/v2/app_specific_password/delete_all"
422
422
  }).pipe(Effect.asVoid, withOperationErrors(DeleteAllAppSpecificPasswordsErrorSpec));
423
423
  //#endregion
424
+ //#region src/core/validation.ts
425
+ const PositiveIntegerSchema = Schema.Int.check(Schema.isGreaterThan(0));
426
+ const NonEmptyStringSchema = Schema.String.check(Schema.isMinLength(1));
427
+ const decodeAndRun = (schema, input, run) => Schema.decodeUnknownEffect(schema, { onExcessProperty: "error" })(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap(run));
428
+ const makeCursorSelectionSchema = (idsField, excludeIdsField, fields) => Schema.Struct({
429
+ cursor: Schema.optional(NonEmptyStringSchema),
430
+ [excludeIdsField]: Schema.optional(Schema.Array(PositiveIntegerSchema)),
431
+ [idsField]: Schema.optional(Schema.Array(PositiveIntegerSchema).check(Schema.isMinLength(1))),
432
+ ...fields
433
+ }).check(Schema.makeFilter((input) => input.cursor !== void 0 || input[idsField] !== void 0, { expected: "a non-empty cursor or file ID selection" }));
434
+ //#endregion
424
435
  //#region src/domains/oauth.ts
425
436
  const OAuthAppBaseSchema = Schema.Struct({
426
437
  description: Schema.String,
@@ -760,22 +771,48 @@ const RecoveryCodesEnvelopeSchema = Schema.Struct({
760
771
  recovery_codes: TwoFactorRecoveryCodesSchema,
761
772
  status: Schema.Literal("OK")
762
773
  });
774
+ const AuthClientIdSchema = Schema.Union([NonEmptyStringSchema, PositiveIntegerSchema]);
775
+ const LoginInputSchema = Schema.Struct({
776
+ callbackUrl: Schema.optional(NonEmptyStringSchema),
777
+ clientId: AuthClientIdSchema,
778
+ clientName: Schema.optional(NonEmptyStringSchema),
779
+ clientSecret: NonEmptyStringSchema,
780
+ fingerprint: Schema.optional(NonEmptyStringSchema),
781
+ password: NonEmptyStringSchema,
782
+ username: NonEmptyStringSchema
783
+ });
763
784
  const RegisterInputSchema = Schema.Struct({
764
- client_id: Schema.Union([Schema.String, Schema.Int]),
765
- family_invite_code: Schema.optional(Schema.String),
766
- friend_invite_code: Schema.optional(Schema.String),
767
- gift_card_confirmation_code: Schema.optional(Schema.String),
768
- mail: Schema.String,
769
- password: Schema.String,
770
- plan_name: Schema.optional(Schema.String),
771
- username: Schema.String,
772
- voucher_code: Schema.optional(Schema.String)
785
+ client_id: AuthClientIdSchema,
786
+ family_invite_code: Schema.optional(NonEmptyStringSchema),
787
+ friend_invite_code: Schema.optional(NonEmptyStringSchema),
788
+ gift_card_confirmation_code: Schema.optional(NonEmptyStringSchema),
789
+ mail: NonEmptyStringSchema,
790
+ password: NonEmptyStringSchema,
791
+ plan_name: Schema.optional(NonEmptyStringSchema),
792
+ username: NonEmptyStringSchema,
793
+ voucher_code: Schema.optional(NonEmptyStringSchema)
773
794
  });
774
795
  const OAuthAuthorizationCodeExchangeInputSchema = Schema.Struct({
775
- clientId: Schema.Union([Schema.String.check(Schema.isMinLength(1)), Schema.Int.check(Schema.isGreaterThan(0))]),
776
- clientSecret: Schema.String.check(Schema.isMinLength(1)),
777
- code: Schema.String.check(Schema.isMinLength(1)),
778
- redirectUri: Schema.optional(Schema.String.check(Schema.isMinLength(1)))
796
+ clientId: AuthClientIdSchema,
797
+ clientSecret: NonEmptyStringSchema,
798
+ code: NonEmptyStringSchema,
799
+ redirectUri: Schema.optional(NonEmptyStringSchema)
800
+ });
801
+ const AuthExistsInputSchema = Schema.Struct({
802
+ key: Schema.Literals(["mail", "username"]),
803
+ value: NonEmptyStringSchema
804
+ });
805
+ const AuthResetPasswordInputSchema = Schema.Struct({
806
+ key: NonEmptyStringSchema,
807
+ password: NonEmptyStringSchema
808
+ });
809
+ const AuthGetCodeInputSchema = Schema.Struct({
810
+ appId: AuthClientIdSchema,
811
+ clientName: Schema.optional(NonEmptyStringSchema)
812
+ });
813
+ const AuthVerifyTotpInputSchema = Schema.Struct({
814
+ code: NonEmptyStringSchema,
815
+ twoFactorScopedToken: NonEmptyStringSchema
779
816
  });
780
817
  const LoginErrorSpec = definePutioOperationErrorSpec({
781
818
  domain: "auth",
@@ -1010,6 +1047,11 @@ const RegenerateRecoveryCodesErrorSpec = definePutioOperationErrorSpec({
1010
1047
  statusCode: 401
1011
1048
  }]
1012
1049
  });
1050
+ const decodeAuthInput = (operation, schema, input, run) => Schema.decodeUnknownEffect(schema, { onExcessProperty: "error" })(input).pipe(Effect.mapError(() => new PutioValidationError({ cause: {
1051
+ domain: "auth",
1052
+ operation,
1053
+ reason: "Invalid request input"
1054
+ } })), Effect.flatMap(run));
1013
1055
  const buildAuthLoginUrl = (options) => buildPutioUrl(options.webAppUrl ?? "https://app.put.io", "/authenticate", {
1014
1056
  client_id: options.clientId,
1015
1057
  client_name: options.clientName,
@@ -1023,11 +1065,7 @@ const mapOAuthAuthorizationCodeExchangeError = (error) => error instanceof Putio
1023
1065
  code: error.body.error,
1024
1066
  status: 400
1025
1067
  }) : error;
1026
- const exchangeOAuthAuthorizationCode = (input) => Schema.decodeUnknownEffect(OAuthAuthorizationCodeExchangeInputSchema)(input).pipe(Effect.mapError(() => new PutioValidationError({ cause: {
1027
- domain: "auth",
1028
- operation: "exchangeAuthorizationCode",
1029
- reason: "Invalid request input"
1030
- } })), Effect.flatMap((decodedInput) => requestJson(OAuthAuthorizationCodeResponseSchema, {
1068
+ const exchangeOAuthAuthorizationCode = (input) => decodeAuthInput("exchangeAuthorizationCode", OAuthAuthorizationCodeExchangeInputSchema, input, (decodedInput) => requestJson(OAuthAuthorizationCodeResponseSchema, {
1031
1069
  auth: { type: "none" },
1032
1070
  body: {
1033
1071
  type: "form",
@@ -1041,129 +1079,132 @@ const exchangeOAuthAuthorizationCode = (input) => Schema.decodeUnknownEffect(OAu
1041
1079
  },
1042
1080
  method: "POST",
1043
1081
  path: "/v2/oauth2/access_token"
1044
- }).pipe(selectJsonField("access_token"), Effect.mapError(mapOAuthAuthorizationCodeExchangeError))));
1045
- const login = (input) => requestJson(LoginResponseSchema, {
1082
+ }).pipe(selectJsonField("access_token"), Effect.mapError(mapOAuthAuthorizationCodeExchangeError)));
1083
+ const login = (input) => decodeAuthInput("login", LoginInputSchema, input, (decodedInput) => requestJson(LoginResponseSchema, {
1046
1084
  auth: {
1047
1085
  type: "basic",
1048
- password: input.password,
1049
- username: input.username
1086
+ password: decodedInput.password,
1087
+ username: decodedInput.username
1050
1088
  },
1051
1089
  method: "PUT",
1052
- path: input.fingerprint ? `/v2/oauth2/authorizations/clients/${encodePathSegment(input.clientId)}/${encodePathSegment(input.fingerprint)}` : `/v2/oauth2/authorizations/clients/${encodePathSegment(input.clientId)}`,
1090
+ path: decodedInput.fingerprint ? `/v2/oauth2/authorizations/clients/${encodePathSegment(decodedInput.clientId)}/${encodePathSegment(decodedInput.fingerprint)}` : `/v2/oauth2/authorizations/clients/${encodePathSegment(decodedInput.clientId)}`,
1053
1091
  query: {
1054
- callback_url: input.callbackUrl,
1055
- client_name: input.clientName,
1056
- client_secret: input.clientSecret
1092
+ callback_url: decodedInput.callbackUrl,
1093
+ client_name: decodedInput.clientName,
1094
+ client_secret: decodedInput.clientSecret
1057
1095
  }
1058
- }).pipe(selectJsonFields("access_token", "user_id"), withOperationErrors(LoginErrorSpec));
1096
+ }).pipe(selectJsonFields("access_token", "user_id"))).pipe(withOperationErrors(LoginErrorSpec));
1059
1097
  const logout = () => requestJson(OkResponseSchema, {
1060
1098
  method: "POST",
1061
1099
  path: "/v2/oauth/grants/logout"
1062
1100
  });
1063
- const register = (input) => requestJson(ResetPasswordEnvelopeSchema, {
1101
+ const register = (input) => decodeAuthInput("register", RegisterInputSchema, input, (decodedInput) => requestJson(ResetPasswordEnvelopeSchema, {
1064
1102
  auth: { type: "none" },
1065
1103
  body: {
1066
1104
  type: "form",
1067
- value: input
1105
+ value: decodedInput
1068
1106
  },
1069
1107
  method: "POST",
1070
1108
  path: "/v2/registration/register"
1071
- }).pipe(selectJsonFields("access_token"), withOperationErrors(RegisterErrorSpec));
1072
- const exists = (key, value) => requestJson(ExistsEnvelopeSchema, {
1109
+ }).pipe(selectJsonFields("access_token"))).pipe(withOperationErrors(RegisterErrorSpec));
1110
+ const exists = (key, value) => decodeAuthInput("exists", AuthExistsInputSchema, {
1111
+ key,
1112
+ value
1113
+ }, (decodedInput) => requestJson(ExistsEnvelopeSchema, {
1073
1114
  auth: { type: "none" },
1074
1115
  method: "GET",
1075
- path: `/v2/registration/exists/${encodePathSegment(key)}`,
1076
- query: { value }
1077
- }).pipe(selectJsonField("exists"));
1078
- const getVoucher = (code) => requestJson(VoucherEnvelopeSchema, {
1116
+ path: `/v2/registration/exists/${encodePathSegment(decodedInput.key)}`,
1117
+ query: { value: decodedInput.value }
1118
+ }).pipe(selectJsonField("exists")));
1119
+ const getVoucher = (code) => decodeAuthInput("getVoucher", NonEmptyStringSchema, code, (decodedCode) => requestJson(VoucherEnvelopeSchema, {
1079
1120
  auth: { type: "none" },
1080
1121
  method: "GET",
1081
- path: `/v2/registration/voucher/${encodePathSegment(code)}`
1082
- }).pipe(selectJsonField("voucher"), withOperationErrors(VoucherLookupErrorSpec));
1083
- const getGiftCard = (code) => requestJson(GiftCardEnvelopeSchema, {
1122
+ path: `/v2/registration/voucher/${encodePathSegment(decodedCode)}`
1123
+ }).pipe(selectJsonField("voucher"))).pipe(withOperationErrors(VoucherLookupErrorSpec));
1124
+ const getGiftCard = (code) => decodeAuthInput("getGiftCard", NonEmptyStringSchema, code, (decodedCode) => requestJson(GiftCardEnvelopeSchema, {
1084
1125
  auth: { type: "none" },
1085
1126
  method: "GET",
1086
- path: `/v2/registration/gift_card/${encodePathSegment(code)}`
1087
- }).pipe(selectJsonField("gift_card"), withOperationErrors(GiftCardLookupErrorSpec));
1088
- const getFamilyInvite = (code) => requestJson(FamilyInviteEnvelopeSchema, {
1127
+ path: `/v2/registration/gift_card/${encodePathSegment(decodedCode)}`
1128
+ }).pipe(selectJsonField("gift_card"))).pipe(withOperationErrors(GiftCardLookupErrorSpec));
1129
+ const getFamilyInvite = (code) => decodeAuthInput("getFamilyInvite", NonEmptyStringSchema, code, (decodedCode) => requestJson(FamilyInviteEnvelopeSchema, {
1089
1130
  auth: { type: "none" },
1090
1131
  method: "GET",
1091
- path: `/v2/registration/family/${encodePathSegment(code)}`
1092
- }).pipe(selectJsonField("invite"), withOperationErrors(FamilyInviteLookupErrorSpec));
1093
- const getFriendInvite = (code) => requestJson(FriendInviteEnvelopeSchema, {
1132
+ path: `/v2/registration/family/${encodePathSegment(decodedCode)}`
1133
+ }).pipe(selectJsonField("invite"))).pipe(withOperationErrors(FamilyInviteLookupErrorSpec));
1134
+ const getFriendInvite = (code) => decodeAuthInput("getFriendInvite", NonEmptyStringSchema, code, (decodedCode) => requestJson(FriendInviteEnvelopeSchema, {
1094
1135
  auth: { type: "none" },
1095
1136
  method: "GET",
1096
- path: `/v2/registration/friend/${encodePathSegment(code)}`
1097
- }).pipe(selectJsonField("invite"), withOperationErrors(FriendInviteLookupErrorSpec));
1098
- const forgotPassword = (mail) => requestJson(OkResponseSchema, {
1137
+ path: `/v2/registration/friend/${encodePathSegment(decodedCode)}`
1138
+ }).pipe(selectJsonField("invite"))).pipe(withOperationErrors(FriendInviteLookupErrorSpec));
1139
+ const forgotPassword = (mail) => decodeAuthInput("forgotPassword", NonEmptyStringSchema, mail, (decodedMail) => requestJson(OkResponseSchema, {
1099
1140
  auth: { type: "none" },
1100
1141
  body: {
1101
1142
  type: "form",
1102
- value: { mail }
1143
+ value: { mail: decodedMail }
1103
1144
  },
1104
1145
  method: "POST",
1105
1146
  path: "/v2/registration/password/forgot"
1106
- }).pipe(withOperationErrors(ForgotPasswordErrorSpec));
1107
- const resetPassword = (key, password) => requestJson(ResetPasswordEnvelopeSchema, {
1147
+ })).pipe(withOperationErrors(ForgotPasswordErrorSpec));
1148
+ const resetPassword = (key, password) => decodeAuthInput("resetPassword", AuthResetPasswordInputSchema, {
1149
+ key,
1150
+ password
1151
+ }, (decodedInput) => requestJson(ResetPasswordEnvelopeSchema, {
1108
1152
  auth: { type: "none" },
1109
1153
  body: {
1110
1154
  type: "form",
1111
- value: {
1112
- key,
1113
- password
1114
- }
1155
+ value: decodedInput
1115
1156
  },
1116
1157
  method: "POST",
1117
1158
  path: "/v2/registration/password/reset"
1118
- }).pipe(selectJsonFields("access_token"), withOperationErrors(ResetPasswordErrorSpec));
1119
- const getCode = (input) => requestJson(AuthorizationCodeEnvelopeSchema, {
1159
+ }).pipe(selectJsonFields("access_token"))).pipe(withOperationErrors(ResetPasswordErrorSpec));
1160
+ const getCode = (input) => decodeAuthInput("getCode", AuthGetCodeInputSchema, input, (decodedInput) => requestJson(AuthorizationCodeEnvelopeSchema, {
1120
1161
  auth: { type: "none" },
1121
1162
  method: "GET",
1122
1163
  path: "/v2/oauth2/oob/code",
1123
1164
  query: {
1124
- app_id: input.appId,
1125
- client_name: input.clientName
1165
+ app_id: decodedInput.appId,
1166
+ client_name: decodedInput.clientName
1126
1167
  }
1127
- }).pipe(selectJsonFields("code", "qr_code_url"));
1128
- const checkCodeMatch = (code) => requestJson(CodeMatchEnvelopeSchema, {
1168
+ }).pipe(selectJsonFields("code", "qr_code_url")));
1169
+ const checkCodeMatch = (code) => decodeAuthInput("checkCodeMatch", NonEmptyStringSchema, code, (decodedCode) => requestJson(CodeMatchEnvelopeSchema, {
1129
1170
  auth: { type: "none" },
1130
1171
  method: "GET",
1131
- path: `/v2/oauth2/oob/code/${encodePathSegment(code)}`
1132
- }).pipe(selectJsonField("oauth_token"));
1133
- const linkDevice = (code) => requestJson(LinkDeviceEnvelopeSchema, {
1172
+ path: `/v2/oauth2/oob/code/${encodePathSegment(decodedCode)}`
1173
+ }).pipe(selectJsonField("oauth_token")));
1174
+ const linkDevice = (code) => decodeAuthInput("linkDevice", NonEmptyStringSchema, code, (decodedCode) => requestJson(LinkDeviceEnvelopeSchema, {
1134
1175
  body: {
1135
1176
  type: "form",
1136
- value: { code }
1177
+ value: { code: decodedCode }
1137
1178
  },
1138
1179
  method: "POST",
1139
1180
  path: "/v2/oauth2/oob/code"
1140
- }).pipe(selectJsonField("app"), withOperationErrors(LinkDeviceErrorSpec));
1181
+ }).pipe(selectJsonField("app"))).pipe(withOperationErrors(LinkDeviceErrorSpec));
1141
1182
  const grants = () => requestJson(GrantsEnvelopeSchema, {
1142
1183
  method: "GET",
1143
1184
  path: "/v2/oauth/grants/"
1144
1185
  }).pipe(selectJsonField("apps"), withOperationErrors(GrantsErrorSpec));
1145
- const revokeApp = (id) => requestJson(OkResponseSchema, {
1186
+ const revokeApp = (id) => decodeAuthInput("revokeApp", PositiveIntegerSchema, id, (decodedId) => requestJson(OkResponseSchema, {
1146
1187
  method: "POST",
1147
- path: `/v2/oauth/grants/${encodePathSegment(id)}/delete`
1148
- }).pipe(withOperationErrors(RevokeOAuthGrantErrorSpec));
1188
+ path: `/v2/oauth/grants/${encodePathSegment(decodedId)}/delete`
1189
+ })).pipe(withOperationErrors(RevokeOAuthGrantErrorSpec));
1149
1190
  const clients = () => requestJson(ClientsEnvelopeSchema, {
1150
1191
  method: "GET",
1151
1192
  path: "/v2/oauth/clients/"
1152
1193
  }).pipe(selectJsonField("clients"), withOperationErrors(ClientsErrorSpec));
1153
- const revokeClient = (id) => requestJson(OkResponseSchema, {
1194
+ const revokeClient = (id) => decodeAuthInput("revokeClient", PositiveIntegerSchema, id, (decodedId) => requestJson(OkResponseSchema, {
1154
1195
  method: "POST",
1155
- path: `/v2/oauth/clients/${encodePathSegment(id)}/delete`
1156
- }).pipe(withOperationErrors(RevokeOAuthClientErrorSpec));
1196
+ path: `/v2/oauth/clients/${encodePathSegment(decodedId)}/delete`
1197
+ })).pipe(withOperationErrors(RevokeOAuthClientErrorSpec));
1157
1198
  const revokeAllClients = () => requestJson(OkResponseSchema, {
1158
1199
  method: "POST",
1159
1200
  path: "/v2/oauth/clients/delete-all"
1160
1201
  }).pipe(withOperationErrors(RevokeAllOAuthClientsErrorSpec));
1161
- const validateToken = (token) => requestJson(ValidateTokenResponseSchema, {
1202
+ const validateToken = (token) => decodeAuthInput("validateToken", NonEmptyStringSchema, token, (decodedToken) => requestJson(ValidateTokenResponseSchema, {
1162
1203
  auth: { type: "none" },
1163
1204
  method: "GET",
1164
1205
  path: "/v2/oauth2/validate",
1165
- query: { oauth_token: token }
1166
- });
1206
+ query: { oauth_token: decodedToken }
1207
+ }));
1167
1208
  const generateTOTP = () => requestJson(GenerateTOTPEnvelopeSchema, {
1168
1209
  method: "POST",
1169
1210
  path: "/v2/two_factor/generate/totp"
@@ -1172,19 +1213,22 @@ const generateTOTP = () => requestJson(GenerateTOTPEnvelopeSchema, {
1172
1213
  secret,
1173
1214
  uri
1174
1215
  })), withOperationErrors(GenerateTOTPErrorSpec));
1175
- const verifyTOTP = (twoFactorScopedToken, code) => requestJson(VerifyTOTPEnvelopeSchema, {
1216
+ const verifyTOTP = (twoFactorScopedToken, code) => decodeAuthInput("verifyTOTP", AuthVerifyTotpInputSchema, {
1217
+ code,
1218
+ twoFactorScopedToken
1219
+ }, (decodedInput) => requestJson(VerifyTOTPEnvelopeSchema, {
1176
1220
  auth: { type: "none" },
1177
1221
  body: {
1178
1222
  type: "form",
1179
- value: { code }
1223
+ value: { code: decodedInput.code }
1180
1224
  },
1181
1225
  method: "POST",
1182
1226
  path: "/v2/two_factor/verify/totp",
1183
- query: { oauth_token: twoFactorScopedToken }
1227
+ query: { oauth_token: decodedInput.twoFactorScopedToken }
1184
1228
  }).pipe(Effect.map(({ token, user_id }) => ({
1185
1229
  token,
1186
1230
  user_id
1187
- })), withOperationErrors(VerifyTOTPErrorSpec));
1231
+ })))).pipe(withOperationErrors(VerifyTOTPErrorSpec));
1188
1232
  const getRecoveryCodes = () => requestJson(RecoveryCodesEnvelopeSchema, {
1189
1233
  method: "GET",
1190
1234
  path: "/v2/two_factor/recovery_codes"
@@ -1383,16 +1427,6 @@ const deleteConfigKey = (key) => Schema.decodeUnknownEffect(ConfigKeySchema)(key
1383
1427
  path: `/v2/config/${encodePathSegment(decodedKey)}`
1384
1428
  })));
1385
1429
  //#endregion
1386
- //#region src/core/validation.ts
1387
- const PositiveIntegerSchema = Schema.Int.check(Schema.isGreaterThan(0));
1388
- const NonEmptyStringSchema = Schema.String.check(Schema.isMinLength(1));
1389
- const decodeAndRun = (schema, input, run) => Schema.decodeUnknownEffect(schema)(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap(run));
1390
- const makeCursorSelectionSchema = (idsField, excludeIdsField) => Schema.Struct({
1391
- cursor: Schema.optional(NonEmptyStringSchema),
1392
- [excludeIdsField]: Schema.optional(Schema.Array(PositiveIntegerSchema)),
1393
- [idsField]: Schema.optional(Schema.Array(PositiveIntegerSchema).check(Schema.isMinLength(1)))
1394
- }).check(Schema.makeFilter((input) => input.cursor !== void 0 || input[idsField] !== void 0, { expected: "a non-empty cursor or file ID selection" }));
1395
- //#endregion
1396
1430
  //#region src/domains/download-links.ts
1397
1431
  const DownloadLinksStatusSchema = Schema.Literals([
1398
1432
  "NEW",
@@ -1400,7 +1434,7 @@ const DownloadLinksStatusSchema = Schema.Literals([
1400
1434
  "DONE",
1401
1435
  "ERROR"
1402
1436
  ]);
1403
- const DownloadLinksCreateInputSchema = makeCursorSelectionSchema("ids", "excludeIds");
1437
+ const DownloadLinksCreateInputSchema = makeCursorSelectionSchema("ids", "excludeIds", {});
1404
1438
  const DownloadLinksPayloadSchema = Schema.Struct({
1405
1439
  download_links: Schema.Array(Schema.String),
1406
1440
  media_links: Schema.Array(Schema.String),
@@ -1784,6 +1818,17 @@ const IFTTTStatusEnvelopeSchema = Schema.Struct({
1784
1818
  enabled: Schema.Boolean,
1785
1819
  status: Schema.Literal("OK")
1786
1820
  });
1821
+ const IftttPlaybackIngredientsSchema = Schema.Struct({
1822
+ file_id: PositiveIntegerSchema,
1823
+ file_name: NonEmptyStringSchema,
1824
+ file_type: NonEmptyStringSchema
1825
+ });
1826
+ const isIftttPlaybackIngredients = Schema.is(IftttPlaybackIngredientsSchema);
1827
+ const IftttEventInputSchema = Schema.Struct({
1828
+ clientName: Schema.optional(NonEmptyStringSchema),
1829
+ eventType: NonEmptyStringSchema,
1830
+ ingredients: JsonObjectSchema
1831
+ }).check(Schema.makeFilter((input) => input.eventType !== "playback_started" && input.eventType !== "playback_stopped" ? true : isIftttPlaybackIngredients(input.ingredients), { expected: "complete playback ingredients for playback events" }));
1787
1832
  const GetIftttStatusErrorSpec = definePutioOperationErrorSpec({
1788
1833
  domain: "ifttt",
1789
1834
  operation: "getStatus",
@@ -1813,18 +1858,18 @@ const getIftttStatus = () => requestJson(IFTTTStatusEnvelopeSchema, {
1813
1858
  method: "GET",
1814
1859
  path: "/v2/ifttt-client/status"
1815
1860
  }).pipe(selectJsonFields("enabled"), withOperationErrors(GetIftttStatusErrorSpec));
1816
- const sendIftttEvent = (input) => requestJson(OkResponseSchema, {
1861
+ const sendIftttEvent = (input) => decodeAndRun(IftttEventInputSchema, input, (decodedInput) => requestJson(OkResponseSchema, {
1817
1862
  body: {
1818
1863
  type: "form",
1819
1864
  value: {
1820
- client_name: input.clientName,
1821
- event_type: input.eventType,
1822
- ingredients: input.ingredients
1865
+ client_name: decodedInput.clientName,
1866
+ event_type: decodedInput.eventType,
1867
+ ingredients: decodedInput.ingredients
1823
1868
  }
1824
1869
  },
1825
1870
  method: "POST",
1826
1871
  path: "/v2/ifttt-client/event"
1827
- }).pipe(Effect.asVoid, withOperationErrors(SendIftttEventErrorSpec));
1872
+ })).pipe(Effect.asVoid, withOperationErrors(SendIftttEventErrorSpec));
1828
1873
  //#endregion
1829
1874
  //#region src/domains/files.ts
1830
1875
  const RequestedFlag = Schema.Literal(1);
@@ -1968,8 +2013,7 @@ const FilesListQuerySchema = FileQuerySchema.mapFields(({ codecs: _codecs, media
1968
2013
  }));
1969
2014
  const FilesSearchQuerySchema = Schema.Struct({
1970
2015
  per_page: Schema.optional(Schema.Int.check(Schema.isGreaterThan(0))),
1971
- query: Schema.String,
1972
- type: Schema.optional(Schema.Union([FileTypeSchema, Schema.Array(FileTypeSchema)]))
2016
+ query: Schema.String
1973
2017
  });
1974
2018
  const FileBreadcrumbSchema = Schema.Tuple([Schema.Int, Schema.String]);
1975
2019
  const FileEnvelopeSchema = Schema.Struct({
@@ -1998,18 +2042,42 @@ const FilesSearchEnvelopeSchema = Schema.Struct({
1998
2042
  status: Schema.Literal("OK"),
1999
2043
  total: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))
2000
2044
  });
2001
- Schema.Struct({
2002
- name: Schema.optional(Schema.String),
2003
- parent_id: Schema.optional(Schema.Int),
2004
- path: Schema.optional(Schema.String)
2045
+ const FilesListInputSchema = Schema.Struct({
2046
+ parent: Schema.Union([NonNegativeFileIdSchema, Schema.Literal("friends")]),
2047
+ query: FilesListQuerySchema
2005
2048
  });
2006
- Schema.Struct({
2007
- file_id: Schema.Int,
2008
- name: Schema.String
2049
+ const FilesContinueInputSchema = Schema.Struct({
2050
+ cursor: NonEmptyStringSchema,
2051
+ query: Schema.Struct({ per_page: Schema.optional(PositiveIntegerSchema) })
2009
2052
  });
2010
- Schema.Struct({
2011
- file_id: Schema.Int,
2012
- time: Schema.Number
2053
+ const FileGetInputSchema = Schema.Struct({
2054
+ id: NonNegativeFileIdSchema,
2055
+ query: Schema.optional(FileQuerySchema)
2056
+ });
2057
+ const FilesSearchContinueInputSchema = Schema.Struct({
2058
+ cursor: NonEmptyStringSchema,
2059
+ query: Schema.Struct({ per_page: Schema.optional(PositiveIntegerSchema) })
2060
+ });
2061
+ const FileSubtitlesInputSchema = Schema.Struct({
2062
+ fileId: PositiveFileIdSchema,
2063
+ options: Schema.Struct({ languages: Schema.optional(Schema.Array(NonEmptyStringSchema).check(Schema.isMinLength(1))) })
2064
+ });
2065
+ const FileNextInputSchema = Schema.Struct({
2066
+ fileId: PositiveFileIdSchema,
2067
+ fileType: FileTypeSchema
2068
+ });
2069
+ const FileCreateFolderInputSchema = Schema.Struct({
2070
+ name: Schema.optional(NonEmptyStringSchema),
2071
+ parent_id: Schema.optional(NonNegativeFileIdSchema),
2072
+ path: Schema.optional(NonEmptyStringSchema)
2073
+ }).check(Schema.makeFilter((input) => input.name !== void 0 || input.path !== void 0, { expected: "a non-empty folder name or path" }));
2074
+ const FileRenameInputSchema = Schema.Struct({
2075
+ file_id: PositiveFileIdSchema,
2076
+ name: NonEmptyStringSchema
2077
+ });
2078
+ const FileStartFromSetInputSchema = Schema.Struct({
2079
+ file_id: PositiveFileIdSchema,
2080
+ time: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0))
2013
2081
  });
2014
2082
  const FileStartFromEnvelopeSchema = Schema.Struct({
2015
2083
  start_from: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
@@ -2129,10 +2197,51 @@ const FileExtractionsEnvelopeSchema = Schema.Struct({
2129
2197
  extractions: Schema.Array(FileExtractionSchema),
2130
2198
  status: Schema.optional(Schema.Literal("OK"))
2131
2199
  });
2132
- Schema.Struct({
2133
- cursor: Schema.optional(Schema.String),
2134
- excludeIds: Schema.optional(Schema.Array(Schema.Int)),
2135
- ids: Schema.optional(Schema.Array(Schema.Int))
2200
+ const FilesBulkSelectionSchema = Schema.Struct({
2201
+ cursor: Schema.optional(NonEmptyStringSchema),
2202
+ excludeIds: Schema.optional(Schema.Array(PositiveIntegerSchema)),
2203
+ ids: Schema.optional(Schema.Array(PositiveIntegerSchema).check(Schema.isMinLength(1)))
2204
+ }).check(Schema.makeFilter((input) => input.cursor !== void 0 || input.ids !== void 0, { expected: "a non-empty cursor or file ID selection" }));
2205
+ const FilesDeleteOptionsSchema = Schema.Struct({
2206
+ ignoreFileOwner: Schema.optional(Schema.Boolean),
2207
+ partialDelete: Schema.optional(Schema.Boolean),
2208
+ skipTrash: Schema.optional(Schema.Boolean)
2209
+ });
2210
+ const FilesSelectionDeleteOptionsSchema = Schema.Struct({
2211
+ partialDelete: Schema.optional(Schema.Boolean),
2212
+ skipTrash: Schema.optional(Schema.Boolean)
2213
+ });
2214
+ const FilesIdsInputSchema = Schema.Array(PositiveFileIdSchema).check(Schema.isMinLength(1));
2215
+ const FilesMoveInputSchema = Schema.Struct({
2216
+ ids: FilesIdsInputSchema,
2217
+ parentId: NonNegativeFileIdSchema
2218
+ });
2219
+ const FilesMoveSelectionInputSchema = Schema.Struct({
2220
+ parentId: NonNegativeFileIdSchema,
2221
+ selection: FilesBulkSelectionSchema
2222
+ });
2223
+ const FilesWatchStatusInputSchema = makeCursorSelectionSchema("ids", "excludeIds", { watched: Schema.Boolean });
2224
+ const FilesExtractInputSchema = makeCursorSelectionSchema("ids", "excludeIds", { password: Schema.optional(NonEmptyStringSchema) });
2225
+ const FileUploadInputSchema = Schema.Struct({
2226
+ file: Schema.instanceOf(Blob),
2227
+ fileName: Schema.optional(NonEmptyStringSchema),
2228
+ parentId: Schema.optional(NonNegativeFileIdSchema)
2229
+ });
2230
+ const FileUploadOptionsSchema = Schema.Struct({ oauthToken: Schema.optional(NonEmptyStringSchema) });
2231
+ const FileDirectAccessOptionsSchema = Schema.Struct({
2232
+ oauthToken: Schema.optional(NonEmptyStringSchema),
2233
+ useTunnel: Schema.optional(Schema.Boolean)
2234
+ });
2235
+ const FileApiDownloadUrlOptionsSchema = FileDirectAccessOptionsSchema.pipe(Schema.fieldsAssign({ name: Schema.optional(NonEmptyStringSchema) }));
2236
+ const FileApiMp4DownloadUrlOptionsSchema = FileDirectAccessOptionsSchema.pipe(Schema.fieldsAssign({
2237
+ convert: Schema.optional(Schema.Boolean),
2238
+ name: Schema.optional(NonEmptyStringSchema)
2239
+ }));
2240
+ const FileHlsStreamUrlOptionsSchema = Schema.Struct({
2241
+ maxSubtitleCount: Schema.optional(PositiveIntegerSchema),
2242
+ oauthToken: Schema.optional(NonEmptyStringSchema),
2243
+ playOriginal: Schema.optional(Schema.Boolean),
2244
+ subtitleLanguages: Schema.optional(Schema.Array(NonEmptyStringSchema).check(Schema.isMinLength(1)))
2136
2245
  });
2137
2246
  const FilesNextFileSchema = Schema.Struct({
2138
2247
  id: Schema.Int,
@@ -2422,14 +2531,6 @@ const FileUploadErrorSpec = definePutioOperationErrorSpec({
2422
2531
  const missingFieldError = (field) => new PutioValidationError({ cause: `Expected put.io to include "${field}" because it was requested` });
2423
2532
  const failMissingField = (field) => Effect.fail(missingFieldError(field));
2424
2533
  const widenValidationError = (effect) => effect;
2425
- const normalizeFilesSearchQuery = (query) => {
2426
- const type = query.type === void 0 || typeof query.type === "string" ? query.type : joinCsv(query.type);
2427
- return {
2428
- per_page: query.per_page,
2429
- query: query.query,
2430
- type
2431
- };
2432
- };
2433
2534
  const hasStreamUrl = (value) => "stream_url" in value;
2434
2535
  const hasMp4StreamUrl = (value) => "mp4_stream_url" in value;
2435
2536
  const hasMp4StreamUrlWhenAvailable = (value) => !value.is_mp4_available || hasMp4StreamUrl(value);
@@ -2497,32 +2598,38 @@ const ensureFileQueryFields = (effect, query) => Effect.gen(function* () {
2497
2598
  if (query.media_info === 1 && !hasMediaInfo(file)) return yield* failMissingField("media_info");
2498
2599
  return file;
2499
2600
  });
2500
- const queryFiles = (parent, query = {}) => requestJson(FilesListEnvelopeSchema, {
2601
+ const queryFiles = (parent, query = {}) => decodeAndRun(FilesListInputSchema, {
2602
+ parent,
2603
+ query
2604
+ }, (decodedInput) => requestJson(FilesListEnvelopeSchema, {
2501
2605
  method: "GET",
2502
- path: parent === "friends" ? "/v2/files/list/items-shared-with-you" : "/v2/files/list",
2503
- query: parent === "friends" ? query : {
2504
- ...query,
2505
- parent_id: parent
2606
+ path: decodedInput.parent === "friends" ? "/v2/files/list/items-shared-with-you" : "/v2/files/list",
2607
+ query: decodedInput.parent === "friends" ? decodedInput.query : {
2608
+ ...decodedInput.query,
2609
+ parent_id: decodedInput.parent
2506
2610
  }
2507
- }).pipe(withOperationErrors(QueryFilesErrorSpec));
2508
- const continueFiles = (cursor, query = {}) => requestJson(FilesListContinueEnvelopeSchema, {
2611
+ })).pipe(withOperationErrors(QueryFilesErrorSpec));
2612
+ const continueFiles = (cursor, query = {}) => decodeAndRun(FilesContinueInputSchema, {
2613
+ cursor,
2614
+ query
2615
+ }, (decodedInput) => requestJson(FilesListContinueEnvelopeSchema, {
2509
2616
  body: {
2510
2617
  type: "form",
2511
- value: { cursor }
2618
+ value: { cursor: decodedInput.cursor }
2512
2619
  },
2513
2620
  method: "POST",
2514
2621
  path: "/v2/files/list/continue",
2515
- query
2516
- }).pipe(withOperationErrors(ContinueFilesErrorSpec));
2622
+ query: decodedInput.query
2623
+ })).pipe(withOperationErrors(ContinueFilesErrorSpec));
2517
2624
  function getFile(input) {
2518
- if (input.query === null) return Effect.fail(new PutioValidationError({ cause: "getFile query must be an object when provided" }));
2519
- const effect = requestJson(FileEnvelopeSchema, {
2520
- method: "GET",
2521
- path: `/v2/files/${encodePathSegment(input.id)}`,
2522
- query: input.query
2523
- }).pipe(selectJsonField("file"), withOperationErrors(GetFileErrorSpec));
2524
- if (input.query === void 0) return effect;
2525
- return ensureFileQueryFields(effect, input.query);
2625
+ return decodeAndRun(FileGetInputSchema, input, (decodedInput) => {
2626
+ const effect = requestJson(FileEnvelopeSchema, {
2627
+ method: "GET",
2628
+ path: `/v2/files/${encodePathSegment(decodedInput.id)}`,
2629
+ query: decodedInput.query
2630
+ }).pipe(selectJsonField("file"), withOperationErrors(GetFileErrorSpec));
2631
+ return decodedInput.query === void 0 ? effect : ensureFileQueryFields(effect, decodedInput.query);
2632
+ });
2526
2633
  }
2527
2634
  function getFileChild(input) {
2528
2635
  return Schema.decodeUnknownEffect(FileGetChildInputSchema)(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => {
@@ -2564,20 +2671,23 @@ const canWriteFile = (fileId) => Schema.decodeUnknownEffect(PositiveFileIdSchema
2564
2671
  method: "GET",
2565
2672
  path: `/v2/files/${encodePathSegment(decodedFileId)}/can-write`
2566
2673
  })), selectJsonField("user_id"), withOperationErrors(CanWriteFileErrorSpec));
2567
- const searchFiles = (query) => requestJson(FilesSearchEnvelopeSchema, {
2674
+ const searchFiles = (query) => Schema.decodeUnknownEffect(FilesSearchQuerySchema)(query).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedQuery) => requestJson(FilesSearchEnvelopeSchema, {
2568
2675
  method: "GET",
2569
2676
  path: "/v2/files/search",
2570
- query: normalizeFilesSearchQuery(query)
2571
- }).pipe(withOperationErrors(SearchFilesErrorSpec));
2572
- const continueSearch = (cursor, query = {}) => requestJson(FilesSearchEnvelopeSchema, {
2677
+ query: decodedQuery
2678
+ })), withOperationErrors(SearchFilesErrorSpec));
2679
+ const continueSearch = (cursor, query = {}) => decodeAndRun(FilesSearchContinueInputSchema, {
2680
+ cursor,
2681
+ query
2682
+ }, (decodedInput) => requestJson(FilesSearchEnvelopeSchema, {
2573
2683
  body: {
2574
2684
  type: "form",
2575
- value: { cursor }
2685
+ value: { cursor: decodedInput.cursor }
2576
2686
  },
2577
2687
  method: "POST",
2578
2688
  path: "/v2/files/search/continue",
2579
- query
2580
- }).pipe(withOperationErrors(SearchFilesErrorSpec));
2689
+ query: decodedInput.query
2690
+ })).pipe(withOperationErrors(SearchFilesErrorSpec));
2581
2691
  const setFileSort = (input) => Schema.decodeUnknownEffect(FileSetSortInputSchema)(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(OkResponseSchema, {
2582
2692
  body: {
2583
2693
  type: "form",
@@ -2593,203 +2703,263 @@ const resetFileSortSettings = () => requestJson(OkResponseSchema, {
2593
2703
  method: "POST",
2594
2704
  path: "/v2/files/remove-sort-by-settings"
2595
2705
  }).pipe(Effect.asVoid);
2596
- const createFolder = (input) => requestJson(FileEnvelopeSchema, {
2706
+ const createFolder = (input) => decodeAndRun(FileCreateFolderInputSchema, input, (decodedInput) => requestJson(FileEnvelopeSchema, {
2597
2707
  body: {
2598
2708
  type: "form",
2599
- value: input
2709
+ value: decodedInput
2600
2710
  },
2601
2711
  method: "POST",
2602
2712
  path: "/v2/files/create-folder"
2603
- }).pipe(selectJsonField("file"), withOperationErrors(CreateFolderErrorSpec));
2604
- const renameFile = (input) => requestJson(OkResponseSchema, {
2713
+ })).pipe(selectJsonField("file"), withOperationErrors(CreateFolderErrorSpec));
2714
+ const renameFile = (input) => decodeAndRun(FileRenameInputSchema, input, (decodedInput) => requestJson(OkResponseSchema, {
2605
2715
  body: {
2606
2716
  type: "form",
2607
- value: input
2717
+ value: decodedInput
2608
2718
  },
2609
2719
  method: "POST",
2610
2720
  path: "/v2/files/rename"
2611
- }).pipe(withOperationErrors(RenameFileErrorSpec));
2612
- const deleteFiles = (ids, options = {}) => requestJson(FileDeleteResultEnvelopeSchema, {
2721
+ })).pipe(withOperationErrors(RenameFileErrorSpec));
2722
+ const deleteFiles = (ids, options = {}) => decodeAndRun(Schema.Struct({
2723
+ ids: FilesIdsInputSchema,
2724
+ options: FilesDeleteOptionsSchema
2725
+ }), {
2726
+ ids,
2727
+ options
2728
+ }, (decodedInput) => requestJson(FileDeleteResultEnvelopeSchema, {
2613
2729
  body: {
2614
2730
  type: "form",
2615
- value: { file_ids: joinCsv(ids) }
2731
+ value: { file_ids: joinCsv(decodedInput.ids) }
2616
2732
  },
2617
2733
  method: "POST",
2618
2734
  path: "/v2/files/delete",
2619
2735
  query: {
2620
- partial_delete: options.partialDelete,
2736
+ partial_delete: decodedInput.options.partialDelete,
2621
2737
  skip_nonexistents: true,
2622
- skip_owner_check: options.ignoreFileOwner,
2623
- skip_trash: options.skipTrash
2738
+ skip_owner_check: decodedInput.options.ignoreFileOwner,
2739
+ skip_trash: decodedInput.options.skipTrash
2624
2740
  }
2625
- });
2626
- const deleteFileSelection = (selection, options = {}) => requestJson(FileDeleteResultEnvelopeSchema, {
2741
+ }));
2742
+ const deleteFileSelection = (selection, options = {}) => decodeAndRun(Schema.Struct({
2743
+ options: FilesSelectionDeleteOptionsSchema,
2744
+ selection: FilesBulkSelectionSchema
2745
+ }), {
2746
+ options,
2747
+ selection
2748
+ }, (decodedInput) => requestJson(FileDeleteResultEnvelopeSchema, {
2627
2749
  body: {
2628
2750
  type: "form",
2629
- value: toCursorSelectionForm(selection)
2751
+ value: toCursorSelectionForm(decodedInput.selection)
2630
2752
  },
2631
2753
  method: "POST",
2632
2754
  path: "/v2/files/delete",
2633
2755
  query: {
2634
- partial_delete: options.partialDelete,
2756
+ partial_delete: decodedInput.options.partialDelete,
2635
2757
  skip_nonexistents: true,
2636
- skip_trash: options.skipTrash
2758
+ skip_trash: decodedInput.options.skipTrash
2637
2759
  }
2638
- });
2639
- const moveFiles = (ids, parentId) => requestJson(FilesMoveEnvelopeSchema, {
2760
+ }));
2761
+ const moveFiles = (ids, parentId) => decodeAndRun(FilesMoveInputSchema, {
2762
+ ids,
2763
+ parentId
2764
+ }, (decodedInput) => requestJson(FilesMoveEnvelopeSchema, {
2640
2765
  body: {
2641
2766
  type: "form",
2642
2767
  value: {
2643
- file_ids: joinCsv(ids),
2644
- parent_id: parentId
2768
+ file_ids: joinCsv(decodedInput.ids),
2769
+ parent_id: decodedInput.parentId
2645
2770
  }
2646
2771
  },
2647
2772
  method: "POST",
2648
2773
  path: "/v2/files/move"
2649
- }).pipe(selectJsonField("errors"));
2650
- const moveFileSelection = (selection, parentId) => requestJson(FilesMoveEnvelopeSchema, {
2774
+ })).pipe(selectJsonField("errors"));
2775
+ const moveFileSelection = (selection, parentId) => decodeAndRun(FilesMoveSelectionInputSchema, {
2776
+ parentId,
2777
+ selection
2778
+ }, (decodedInput) => requestJson(FilesMoveEnvelopeSchema, {
2651
2779
  body: {
2652
2780
  type: "form",
2653
2781
  value: {
2654
- ...toCursorSelectionForm(selection),
2655
- parent_id: parentId
2782
+ ...toCursorSelectionForm(decodedInput.selection),
2783
+ parent_id: decodedInput.parentId
2656
2784
  }
2657
2785
  },
2658
2786
  method: "POST",
2659
2787
  path: "/v2/files/move"
2660
- }).pipe(selectJsonField("errors"));
2661
- const getStartFrom = (fileId) => requestJson(FileStartFromEnvelopeSchema, {
2788
+ })).pipe(selectJsonField("errors"));
2789
+ const getStartFrom = (fileId) => decodeAndRun(PositiveFileIdSchema, fileId, (decodedFileId) => requestJson(FileStartFromEnvelopeSchema, {
2662
2790
  method: "GET",
2663
- path: `/v2/files/${encodePathSegment(fileId)}/start-from`
2664
- }).pipe(selectJsonField("start_from"), withOperationErrors(StartFromErrorSpec));
2665
- const getDownloadUrl = (fileId) => requestJson(FileDownloadUrlEnvelopeSchema, {
2791
+ path: `/v2/files/${encodePathSegment(decodedFileId)}/start-from`
2792
+ })).pipe(selectJsonField("start_from"), withOperationErrors(StartFromErrorSpec));
2793
+ const getDownloadUrl = (fileId) => decodeAndRun(PositiveFileIdSchema, fileId, (decodedFileId) => requestJson(FileDownloadUrlEnvelopeSchema, {
2666
2794
  method: "GET",
2667
- path: `/v2/files/${encodePathSegment(fileId)}/url`
2668
- }).pipe(selectJsonField("url"), withOperationErrors(DownloadUrlErrorSpec));
2669
- const getApiDownloadUrl = (fileId, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => buildFileApiDownloadUrl(config.baseUrl ?? "https://api.put.io", fileId, {
2670
- ...options,
2795
+ path: `/v2/files/${encodePathSegment(decodedFileId)}/url`
2796
+ })).pipe(selectJsonField("url"), withOperationErrors(DownloadUrlErrorSpec));
2797
+ const getApiDownloadUrl = (fileId, options = {}) => decodeAndRun(Schema.Struct({
2798
+ fileId: PositiveFileIdSchema,
2799
+ options: FileApiDownloadUrlOptionsSchema
2800
+ }), {
2801
+ fileId,
2802
+ options
2803
+ }, (decoded) => resolveRouteContext(decoded.options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => buildFileApiDownloadUrl(config.baseUrl ?? "https://api.put.io", decoded.fileId, {
2804
+ ...decoded.options,
2671
2805
  oauthToken
2672
- })));
2673
- const getApiContentUrl = (fileId, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => buildFileApiContentUrl(config.baseUrl ?? "https://api.put.io", fileId, {
2674
- ...options,
2806
+ }))));
2807
+ const getApiContentUrl = (fileId, options = {}) => decodeAndRun(Schema.Struct({
2808
+ fileId: PositiveFileIdSchema,
2809
+ options: FileDirectAccessOptionsSchema
2810
+ }), {
2811
+ fileId,
2812
+ options
2813
+ }, (decoded) => resolveRouteContext(decoded.options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => buildFileApiContentUrl(config.baseUrl ?? "https://api.put.io", decoded.fileId, {
2814
+ ...decoded.options,
2675
2815
  oauthToken
2676
- })));
2677
- const getApiMp4DownloadUrl = (fileId, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => buildFileApiMp4DownloadUrl(config.baseUrl ?? "https://api.put.io", fileId, {
2678
- ...options,
2816
+ }))));
2817
+ const getApiMp4DownloadUrl = (fileId, options = {}) => decodeAndRun(Schema.Struct({
2818
+ fileId: PositiveFileIdSchema,
2819
+ options: FileApiMp4DownloadUrlOptionsSchema
2820
+ }), {
2821
+ fileId,
2822
+ options
2823
+ }, (decoded) => resolveRouteContext(decoded.options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => buildFileApiMp4DownloadUrl(config.baseUrl ?? "https://api.put.io", decoded.fileId, {
2824
+ ...decoded.options,
2679
2825
  oauthToken
2680
- })));
2681
- const getHlsStreamUrl = (fileId, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => buildFileHlsStreamUrl(config.baseUrl ?? "https://api.put.io", fileId, {
2682
- ...options,
2826
+ }))));
2827
+ const getHlsStreamUrl = (fileId, options = {}) => decodeAndRun(Schema.Struct({
2828
+ fileId: PositiveFileIdSchema,
2829
+ options: FileHlsStreamUrlOptionsSchema
2830
+ }), {
2831
+ fileId,
2832
+ options
2833
+ }, (decoded) => resolveRouteContext(decoded.options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => buildFileHlsStreamUrl(config.baseUrl ?? "https://api.put.io", decoded.fileId, {
2834
+ ...decoded.options,
2683
2835
  oauthToken
2684
- })));
2685
- const listFileSubtitles = (fileId, options = {}) => requestJson(FileSubtitlesEnvelopeSchema, {
2836
+ }))));
2837
+ const listFileSubtitles = (fileId, options = {}) => decodeAndRun(FileSubtitlesInputSchema, {
2838
+ fileId,
2839
+ options
2840
+ }, (decodedInput) => requestJson(FileSubtitlesEnvelopeSchema, {
2686
2841
  method: "GET",
2687
- path: `/v2/files/${encodePathSegment(fileId)}/subtitles`,
2688
- query: options.languages ? { languages: joinCsv(options.languages) } : void 0
2689
- }).pipe(withOperationErrors(FileSubtitlesErrorSpec));
2690
- const setStartFrom = (input) => requestJson(OkResponseSchema, {
2842
+ path: `/v2/files/${encodePathSegment(decodedInput.fileId)}/subtitles`,
2843
+ query: decodedInput.options.languages ? { languages: joinCsv(decodedInput.options.languages) } : void 0
2844
+ })).pipe(withOperationErrors(FileSubtitlesErrorSpec));
2845
+ const setStartFrom = (input) => decodeAndRun(FileStartFromSetInputSchema, input, (decodedInput) => requestJson(OkResponseSchema, {
2691
2846
  body: {
2692
2847
  type: "form",
2693
- value: { time: input.time }
2848
+ value: { time: decodedInput.time }
2694
2849
  },
2695
2850
  method: "POST",
2696
- path: `/v2/files/${encodePathSegment(input.file_id)}/start-from`
2697
- }).pipe(withOperationErrors(StartFromErrorSpec));
2698
- const resetStartFrom = (fileId) => requestJson(OkResponseSchema, {
2851
+ path: `/v2/files/${encodePathSegment(decodedInput.file_id)}/start-from`
2852
+ })).pipe(withOperationErrors(StartFromErrorSpec));
2853
+ const resetStartFrom = (fileId) => decodeAndRun(PositiveFileIdSchema, fileId, (decodedFileId) => requestJson(OkResponseSchema, {
2699
2854
  method: "POST",
2700
- path: `/v2/files/${encodePathSegment(fileId)}/start-from/delete`
2701
- }).pipe(withOperationErrors(StartFromErrorSpec));
2702
- const getMp4Status = (fileId) => requestJson(FileConversionStatusEnvelopeSchema, {
2855
+ path: `/v2/files/${encodePathSegment(decodedFileId)}/start-from/delete`
2856
+ })).pipe(withOperationErrors(StartFromErrorSpec));
2857
+ const getMp4Status = (fileId) => decodeAndRun(PositiveFileIdSchema, fileId, (decodedFileId) => requestJson(FileConversionStatusEnvelopeSchema, {
2703
2858
  method: "GET",
2704
- path: `/v2/files/${encodePathSegment(fileId)}/mp4`
2705
- }).pipe(selectJsonField("mp4"), withOperationErrors(FileMp4ErrorSpec));
2706
- const convertFileToMp4 = (fileId) => requestJson(FileConversionStatusEnvelopeSchema, {
2859
+ path: `/v2/files/${encodePathSegment(decodedFileId)}/mp4`
2860
+ })).pipe(selectJsonField("mp4"), withOperationErrors(FileMp4ErrorSpec));
2861
+ const convertFileToMp4 = (fileId) => decodeAndRun(PositiveFileIdSchema, fileId, (decodedFileId) => requestJson(FileConversionStatusEnvelopeSchema, {
2707
2862
  method: "POST",
2708
- path: `/v2/files/${encodePathSegment(fileId)}/mp4`
2709
- }).pipe(selectJsonField("mp4"), withOperationErrors(FileMp4ErrorSpec));
2710
- const deleteFileMp4 = (fileId) => requestVoid({
2863
+ path: `/v2/files/${encodePathSegment(decodedFileId)}/mp4`
2864
+ })).pipe(selectJsonField("mp4"), withOperationErrors(FileMp4ErrorSpec));
2865
+ const deleteFileMp4 = (fileId) => decodeAndRun(PositiveFileIdSchema, fileId, (decodedFileId) => requestVoid({
2711
2866
  method: "DELETE",
2712
- path: `/v2/files/${encodePathSegment(fileId)}/mp4`
2713
- }).pipe(withOperationErrors(FileMp4MutationErrorSpec));
2714
- const putMp4ToMyFiles = (fileId) => requestVoid({
2867
+ path: `/v2/files/${encodePathSegment(decodedFileId)}/mp4`
2868
+ })).pipe(withOperationErrors(FileMp4MutationErrorSpec));
2869
+ const putMp4ToMyFiles = (fileId) => decodeAndRun(PositiveFileIdSchema, fileId, (decodedFileId) => requestVoid({
2715
2870
  method: "GET",
2716
- path: `/v2/files/${encodePathSegment(fileId)}/put-mp4-to-my-folders`
2717
- }).pipe(withOperationErrors(FileMp4MutationErrorSpec));
2718
- const convertFilesToMp4 = (ids) => requestJson(FilesBulkConvertEnvelopeSchema, {
2871
+ path: `/v2/files/${encodePathSegment(decodedFileId)}/put-mp4-to-my-folders`
2872
+ })).pipe(withOperationErrors(FileMp4MutationErrorSpec));
2873
+ const convertFilesToMp4 = (ids) => decodeAndRun(FilesIdsInputSchema, ids, (decodedIds) => requestJson(FilesBulkConvertEnvelopeSchema, {
2719
2874
  body: {
2720
2875
  type: "form",
2721
- value: { file_ids: joinCsv(ids) }
2876
+ value: { file_ids: joinCsv(decodedIds) }
2722
2877
  },
2723
2878
  method: "POST",
2724
2879
  path: "/v2/files/convert_mp4"
2725
- }).pipe(selectJsonField("count"));
2726
- const convertFileSelectionToMp4 = (selection) => requestJson(FilesBulkConvertEnvelopeSchema, {
2880
+ })).pipe(selectJsonField("count"));
2881
+ const convertFileSelectionToMp4 = (selection) => decodeAndRun(FilesBulkSelectionSchema, selection, (decodedSelection) => requestJson(FilesBulkConvertEnvelopeSchema, {
2727
2882
  body: {
2728
2883
  type: "form",
2729
- value: toCursorSelectionForm(selection)
2884
+ value: toCursorSelectionForm(decodedSelection)
2730
2885
  },
2731
2886
  method: "POST",
2732
2887
  path: "/v2/files/convert_mp4"
2733
- }).pipe(selectJsonField("count"));
2888
+ })).pipe(selectJsonField("count"));
2734
2889
  const listActiveMp4Conversions = () => requestJson(FileActiveConversionsEnvelopeSchema, {
2735
2890
  method: "GET",
2736
2891
  path: "/v2/mp4/queue"
2737
2892
  }).pipe(selectJsonField("mp4s"), withOperationErrors(FileActiveConversionsErrorSpec));
2738
- const setFilesWatchStatus = (selection) => requestVoid({
2893
+ const setFilesWatchStatus = (selection) => decodeAndRun(FilesWatchStatusInputSchema, selection, (decodedSelection) => requestVoid({
2739
2894
  body: {
2740
2895
  type: "form",
2741
2896
  value: {
2742
- ...toCursorSelectionForm(selection),
2743
- watched: selection.watched
2897
+ ...toCursorSelectionForm(decodedSelection),
2898
+ watched: decodedSelection.watched
2744
2899
  }
2745
2900
  },
2746
2901
  method: "POST",
2747
2902
  path: "/v2/files/watch-status"
2748
- }).pipe(withOperationErrors(FileWatchStatusErrorSpec));
2749
- const extractFiles = (selection) => requestJson(FileExtractionsEnvelopeSchema, {
2903
+ })).pipe(withOperationErrors(FileWatchStatusErrorSpec));
2904
+ const extractFiles = (selection) => decodeAndRun(FilesExtractInputSchema, selection, (decodedSelection) => requestJson(FileExtractionsEnvelopeSchema, {
2750
2905
  body: {
2751
2906
  type: "form",
2752
2907
  value: {
2753
- ...toCursorSelectionForm(selection, "user_file_ids"),
2754
- password: selection.password
2908
+ ...toCursorSelectionForm(decodedSelection, "user_file_ids"),
2909
+ password: decodedSelection.password
2755
2910
  }
2756
2911
  },
2757
2912
  method: "POST",
2758
2913
  path: "/v2/files/extract"
2759
- }).pipe(selectJsonField("extractions"), withOperationErrors(FileExtractionsErrorSpec));
2914
+ })).pipe(selectJsonField("extractions"), withOperationErrors(FileExtractionsErrorSpec));
2760
2915
  const listFileExtractions = () => requestJson(FileExtractionsEnvelopeSchema, {
2761
2916
  method: "GET",
2762
2917
  path: "/v2/files/extract"
2763
2918
  }).pipe(selectJsonField("extractions"), withOperationErrors(FileExtractionsErrorSpec));
2764
- const deleteFileExtraction = (extractionId) => requestVoid({
2919
+ const deleteFileExtraction = (extractionId) => decodeAndRun(PositiveIntegerSchema, extractionId, (decodedExtractionId) => requestVoid({
2765
2920
  method: "DELETE",
2766
- path: `/v2/files/extract/${encodePathSegment(extractionId)}`
2767
- });
2768
- const findNextFile = (fileId, fileType) => requestJson(FilesNextFileEnvelopeSchema, {
2921
+ path: `/v2/files/extract/${encodePathSegment(decodedExtractionId)}`
2922
+ }));
2923
+ const findNextFile = (fileId, fileType) => decodeAndRun(FileNextInputSchema, {
2924
+ fileId,
2925
+ fileType
2926
+ }, (decodedInput) => requestJson(FilesNextFileEnvelopeSchema, {
2769
2927
  method: "GET",
2770
- path: `/v2/files/${encodePathSegment(fileId)}/next-file`,
2771
- query: { file_type: fileType }
2772
- }).pipe(selectJsonField("next_file"));
2773
- const findNextVideo = (fileId) => requestJson(FilesNextVideoEnvelopeSchema, {
2928
+ path: `/v2/files/${encodePathSegment(decodedInput.fileId)}/next-file`,
2929
+ query: { file_type: decodedInput.fileType }
2930
+ })).pipe(selectJsonField("next_file"));
2931
+ const findNextVideo = (fileId) => decodeAndRun(PositiveFileIdSchema, fileId, (decodedFileId) => requestJson(FilesNextVideoEnvelopeSchema, {
2774
2932
  method: "GET",
2775
- path: `/v2/files/${encodePathSegment(fileId)}/next-video`
2776
- }).pipe(selectJsonField("next_video"));
2777
- const createFileUploadRequest = (input, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => ({
2778
- body: createFileUploadFormData(input),
2933
+ path: `/v2/files/${encodePathSegment(decodedFileId)}/next-video`
2934
+ })).pipe(selectJsonField("next_video"));
2935
+ const createFileUploadRequest = (input, options = {}) => decodeAndRun(Schema.Struct({
2936
+ input: FileUploadInputSchema,
2937
+ options: FileUploadOptionsSchema
2938
+ }), {
2939
+ input,
2940
+ options
2941
+ }, (decoded) => resolveRouteContext(decoded.options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => ({
2942
+ body: createFileUploadFormData(decoded.input),
2779
2943
  method: "POST",
2780
2944
  url: buildPutioUrl(config.uploadBaseUrl ?? "https://upload.put.io", "/v2/files/upload", { oauth_token: oauthToken })
2781
- })));
2782
- const uploadFile = (input, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.flatMap(({ config, oauthToken }) => requestJson(FileUploadEnvelopeSchema, {
2945
+ }))));
2946
+ const uploadFile = (input, options = {}) => decodeAndRun(Schema.Struct({
2947
+ input: FileUploadInputSchema,
2948
+ options: FileUploadOptionsSchema
2949
+ }), {
2950
+ input,
2951
+ options
2952
+ }, (decoded) => resolveRouteContext(decoded.options.oauthToken).pipe(Effect.flatMap(({ config, oauthToken }) => requestJson(FileUploadEnvelopeSchema, {
2783
2953
  auth: { type: "none" },
2784
2954
  baseUrl: config.uploadBaseUrl ?? "https://upload.put.io",
2785
2955
  body: {
2786
2956
  type: "form-data",
2787
- value: createFileUploadFormData(input)
2957
+ value: createFileUploadFormData(decoded.input)
2788
2958
  },
2789
2959
  method: "POST",
2790
2960
  path: "/v2/files/upload",
2791
2961
  query: { oauth_token: oauthToken }
2792
- })), Effect.map(toUploadResult), withOperationErrors(FileUploadErrorSpec));
2962
+ })))).pipe(Effect.map(toUploadResult), withOperationErrors(FileUploadErrorSpec));
2793
2963
  //#endregion
2794
2964
  //#region src/domains/friend-invites.ts
2795
2965
  const FriendInviteJoinedUserStatusSchema = Schema.Literals([
@@ -3300,10 +3470,23 @@ const PaymentOpenNodeChargeEnvelopeSchema = Schema.Struct({
3300
3470
  opennode: Schema.Struct({ checkout_url: Schema.String }),
3301
3471
  status: Schema.Literal("OK")
3302
3472
  });
3303
- const PaymentCoinbaseChargeEnvelopeSchema = Schema.Struct({
3304
- coinbase: Schema.Struct({ code: Schema.String }),
3305
- status: Schema.Literal("OK")
3473
+ const PaymentHistoryQuerySchema = Schema.Struct({ unreported_only: Schema.optional(Schema.Boolean) });
3474
+ const PaymentChangePlanPreviewInputSchema = Schema.Struct({
3475
+ coupon_code: Schema.optional(NonEmptyStringSchema),
3476
+ payment_type: Schema.optional(PaymentTypeSchema),
3477
+ plan_path: NonEmptyStringSchema
3478
+ });
3479
+ const PaymentChangePlanSubmitInputSchema = Schema.Struct({
3480
+ confirmation_code: Schema.optional(NonEmptyStringSchema),
3481
+ coupon_code: Schema.optional(NonEmptyStringSchema),
3482
+ payment_type: Schema.optional(PaymentTypeSchema),
3483
+ plan_path: NonEmptyStringSchema
3306
3484
  });
3485
+ const PaymentPaddleWaitingPaymentInputSchema = Schema.Struct({
3486
+ checkout_id: NonEmptyStringSchema,
3487
+ product_id: Schema.Union([NonEmptyStringSchema, PositiveIntegerSchema])
3488
+ });
3489
+ const PaymentIdsSchema = Schema.Array(PositiveIntegerSchema).check(Schema.isMinLength(1));
3307
3490
  const RestrictedPaymentError = {
3308
3491
  errorType: "invalid_scope",
3309
3492
  statusCode: 401
@@ -3573,18 +3756,6 @@ const CreatePaddleBillingUpdatePaymentMethodTransactionErrorSpec = definePutioOp
3573
3756
  { statusCode: 404 }
3574
3757
  ]
3575
3758
  });
3576
- const CreateCoinbaseChargeErrorSpec = definePutioOperationErrorSpec({
3577
- domain: "payment",
3578
- operation: "createCoinbaseCharge",
3579
- knownErrors: [
3580
- {
3581
- errorType: "PAYMENT_UNKNOWN_PLAN",
3582
- statusCode: 400
3583
- },
3584
- ...CommonPaymentActionErrors,
3585
- { statusCode: 400 }
3586
- ]
3587
- });
3588
3759
  const CreateOpenNodeChargeErrorSpec = definePutioOperationErrorSpec({
3589
3760
  domain: "payment",
3590
3761
  operation: "createOpenNodeCharge",
@@ -3628,91 +3799,83 @@ const listPaymentOptions = () => requestJson(PaymentOptionsEnvelopeSchema, {
3628
3799
  method: "GET",
3629
3800
  path: "/v2/payment/options"
3630
3801
  }).pipe(selectJsonField("options"), withOperationErrors(ListPaymentOptionsErrorSpec));
3631
- const listPaymentHistory = (query) => requestJson(PaymentHistoryEnvelopeSchema, {
3802
+ const listPaymentHistory = (query = {}) => decodeAndRun(PaymentHistoryQuerySchema, query, (decodedQuery) => requestJson(PaymentHistoryEnvelopeSchema, {
3632
3803
  method: "GET",
3633
3804
  path: "/v2/payment/history",
3634
- query
3635
- }).pipe(selectJsonField("payments"), withOperationErrors(ListPaymentHistoryErrorSpec));
3805
+ query: decodedQuery
3806
+ }).pipe(selectJsonField("payments"))).pipe(withOperationErrors(ListPaymentHistoryErrorSpec));
3636
3807
  const listPaymentInvites = () => requestJson(PaymentInvitesEnvelopeSchema, {
3637
3808
  method: "GET",
3638
3809
  path: "/v2/payment/invites"
3639
3810
  }).pipe(selectJsonField("vouchers"), withOperationErrors(ListPaymentInvitesErrorSpec));
3640
- const previewPaymentChangePlan = (input) => requestJson(PaymentChangePlanPreviewSchema, {
3811
+ const previewPaymentChangePlan = (input) => decodeAndRun(PaymentChangePlanPreviewInputSchema, input, (decodedInput) => requestJson(PaymentChangePlanPreviewSchema, {
3641
3812
  method: "GET",
3642
- path: `/v2/payment/change_plan/${encodeURIComponent(input.plan_path)}`,
3813
+ path: `/v2/payment/change_plan/${encodeURIComponent(decodedInput.plan_path)}`,
3643
3814
  query: {
3644
- coupon_code: input.coupon_code,
3645
- payment_type: input.payment_type
3815
+ coupon_code: decodedInput.coupon_code,
3816
+ payment_type: decodedInput.payment_type
3646
3817
  }
3647
- }).pipe(withOperationErrors(PreviewPaymentChangePlanErrorSpec));
3648
- const submitPaymentChangePlan = (input) => requestJson(PaymentChangePlanSubmitSchema, {
3818
+ })).pipe(withOperationErrors(PreviewPaymentChangePlanErrorSpec));
3819
+ const submitPaymentChangePlan = (input) => decodeAndRun(PaymentChangePlanSubmitInputSchema, input, (decodedInput) => requestJson(PaymentChangePlanSubmitSchema, {
3649
3820
  body: {
3650
3821
  type: "form",
3651
3822
  value: {
3652
- confirmation_code: input.confirmation_code,
3653
- payment_type: input.payment_type
3823
+ confirmation_code: decodedInput.confirmation_code,
3824
+ payment_type: decodedInput.payment_type
3654
3825
  }
3655
3826
  },
3656
3827
  method: "POST",
3657
- path: `/v2/payment/change_plan/${encodeURIComponent(input.plan_path)}`,
3658
- query: { coupon_code: input.coupon_code }
3659
- }).pipe(withOperationErrors(SubmitPaymentChangePlanErrorSpec));
3660
- const confirmFastspringOrder = (reference) => requestJson(PaymentFastspringConfirmEnvelopeSchema, {
3828
+ path: `/v2/payment/change_plan/${encodeURIComponent(decodedInput.plan_path)}`,
3829
+ query: { coupon_code: decodedInput.coupon_code }
3830
+ })).pipe(withOperationErrors(SubmitPaymentChangePlanErrorSpec));
3831
+ const confirmFastspringOrder = (reference) => decodeAndRun(NonEmptyStringSchema, reference, (decodedReference) => requestJson(PaymentFastspringConfirmEnvelopeSchema, {
3661
3832
  method: "GET",
3662
- path: `/v2/payment/fs-confirm/${encodeURIComponent(reference)}`
3663
- }).pipe(selectJsonField("confirmed"), withOperationErrors(ConfirmFastspringOrderErrorSpec));
3833
+ path: `/v2/payment/fs-confirm/${encodeURIComponent(decodedReference)}`
3834
+ }).pipe(selectJsonField("confirmed"))).pipe(withOperationErrors(ConfirmFastspringOrderErrorSpec));
3664
3835
  const stopPaymentSubscription = () => requestJson(OkResponseSchema, {
3665
3836
  method: "POST",
3666
3837
  path: "/v2/payment/stop_subscription"
3667
3838
  }).pipe(Effect.asVoid, withOperationErrors(StopSubscriptionErrorSpec));
3668
- const getPaymentVoucherInfo = (code) => requestJson(PaymentVoucherInfoSchema, {
3839
+ const getPaymentVoucherInfo = (code) => decodeAndRun(NonEmptyStringSchema, code, (decodedCode) => requestJson(PaymentVoucherInfoSchema, {
3669
3840
  method: "GET",
3670
- path: `/v2/payment/redeem_voucher/${encodeURIComponent(code)}`
3671
- }).pipe(withOperationErrors(GetPaymentVoucherInfoErrorSpec));
3672
- const redeemPaymentVoucher = (code) => requestJson(OkResponseSchema, {
3841
+ path: `/v2/payment/redeem_voucher/${encodeURIComponent(decodedCode)}`
3842
+ })).pipe(withOperationErrors(GetPaymentVoucherInfoErrorSpec));
3843
+ const redeemPaymentVoucher = (code) => decodeAndRun(NonEmptyStringSchema, code, (decodedCode) => requestJson(OkResponseSchema, {
3673
3844
  method: "POST",
3674
- path: `/v2/payment/redeem_voucher/${encodeURIComponent(code)}`
3675
- }).pipe(Effect.asVoid, withOperationErrors(RedeemPaymentVoucherErrorSpec));
3676
- const reportPayments = (paymentIds) => requestJson(OkResponseSchema, {
3845
+ path: `/v2/payment/redeem_voucher/${encodeURIComponent(decodedCode)}`
3846
+ })).pipe(Effect.asVoid, withOperationErrors(RedeemPaymentVoucherErrorSpec));
3847
+ const reportPayments = (paymentIds) => decodeAndRun(PaymentIdsSchema, paymentIds, (decodedPaymentIds) => requestJson(OkResponseSchema, {
3677
3848
  body: {
3678
3849
  type: "form",
3679
- value: { payment_ids: joinCsv(paymentIds) }
3850
+ value: { payment_ids: joinCsv(decodedPaymentIds) }
3680
3851
  },
3681
3852
  method: "POST",
3682
3853
  path: "/v2/payment/report"
3683
- }).pipe(Effect.asVoid, withOperationErrors(ReportPaymentsErrorSpec));
3684
- const createPaddleWaitingPayment = (input) => requestJson(OkResponseSchema, {
3854
+ })).pipe(Effect.asVoid, withOperationErrors(ReportPaymentsErrorSpec));
3855
+ const createPaddleWaitingPayment = (input) => decodeAndRun(PaymentPaddleWaitingPaymentInputSchema, input, (decodedInput) => requestJson(OkResponseSchema, {
3685
3856
  body: {
3686
3857
  type: "form",
3687
- value: input
3858
+ value: decodedInput
3688
3859
  },
3689
3860
  method: "POST",
3690
3861
  path: "/v2/payment/paddle_waiting_payment"
3691
- }).pipe(Effect.asVoid, withOperationErrors(CreatePaddleWaitingPaymentErrorSpec));
3692
- const getPaddleBillingInvoiceUrl = (paymentId) => requestJson(PaymentPaddleBillingInvoiceEnvelopeSchema, {
3862
+ })).pipe(Effect.asVoid, withOperationErrors(CreatePaddleWaitingPaymentErrorSpec));
3863
+ const getPaddleBillingInvoiceUrl = (paymentId) => decodeAndRun(PositiveIntegerSchema, paymentId, (decodedPaymentId) => requestJson(PaymentPaddleBillingInvoiceEnvelopeSchema, {
3693
3864
  method: "GET",
3694
- path: `/v2/payment/methods/paddle_billing/invoice/${encodeURIComponent(paymentId)}`
3695
- }).pipe(selectJsonField("url"), withOperationErrors(GetPaddleBillingInvoiceUrlErrorSpec));
3696
- const createPaddleBillingUpdatePaymentMethodTransaction = (userSubscriptionId) => requestJson(PaymentPaddleBillingUpdatePaymentMethodEnvelopeSchema, {
3865
+ path: `/v2/payment/methods/paddle_billing/invoice/${encodeURIComponent(decodedPaymentId)}`
3866
+ }).pipe(selectJsonField("url"))).pipe(withOperationErrors(GetPaddleBillingInvoiceUrlErrorSpec));
3867
+ const createPaddleBillingUpdatePaymentMethodTransaction = (userSubscriptionId) => decodeAndRun(PositiveIntegerSchema, userSubscriptionId, (decodedUserSubscriptionId) => requestJson(PaymentPaddleBillingUpdatePaymentMethodEnvelopeSchema, {
3697
3868
  method: "GET",
3698
- path: `/v2/payment/methods/paddle_billing/update_payment_method/${encodeURIComponent(userSubscriptionId)}`
3699
- }).pipe(selectJsonField("transaction_id"), withOperationErrors(CreatePaddleBillingUpdatePaymentMethodTransactionErrorSpec));
3700
- const createCoinbaseCharge = (planPath) => requestJson(PaymentCoinbaseChargeEnvelopeSchema, {
3869
+ path: `/v2/payment/methods/paddle_billing/update_payment_method/${encodeURIComponent(decodedUserSubscriptionId)}`
3870
+ }).pipe(selectJsonField("transaction_id"))).pipe(withOperationErrors(CreatePaddleBillingUpdatePaymentMethodTransactionErrorSpec));
3871
+ const createOpenNodeCharge = (planPath) => decodeAndRun(NonEmptyStringSchema, planPath, (decodedPlanPath) => requestJson(PaymentOpenNodeChargeEnvelopeSchema, {
3701
3872
  body: {
3702
3873
  type: "form",
3703
- value: { plan_fs_path: planPath }
3704
- },
3705
- method: "POST",
3706
- path: "/v2/payment/methods/coinbase/charge"
3707
- }).pipe(selectJsonField("coinbase"), Effect.map(({ code }) => code), withOperationErrors(CreateCoinbaseChargeErrorSpec));
3708
- const createOpenNodeCharge = (planPath) => requestJson(PaymentOpenNodeChargeEnvelopeSchema, {
3709
- body: {
3710
- type: "form",
3711
- value: { plan_fs_path: planPath }
3874
+ value: { plan_fs_path: decodedPlanPath }
3712
3875
  },
3713
3876
  method: "POST",
3714
3877
  path: "/v2/payment/methods/opennode/charge"
3715
- }).pipe(selectJsonField("opennode"), Effect.map(({ checkout_url }) => checkout_url), withOperationErrors(CreateOpenNodeChargeErrorSpec));
3878
+ }).pipe(selectJsonField("opennode"), Effect.map(({ checkout_url }) => checkout_url))).pipe(withOperationErrors(CreateOpenNodeChargeErrorSpec));
3716
3879
  //#endregion
3717
3880
  //#region src/domains/podcast.ts
3718
3881
  const PodcastLinkTypeSchema = Schema.Literals([
@@ -4642,7 +4805,7 @@ const emptyTrash = () => requestJson(OkResponseSchema, {
4642
4805
  }).pipe(Effect.asVoid, withOperationErrors(EmptyTrashErrorSpec));
4643
4806
  //#endregion
4644
4807
  //#region src/domains/transfers.ts
4645
- const TransferIdSchema = Schema.Int.check(Schema.isGreaterThan(0));
4808
+ const TransferIdSchema = PositiveIntegerSchema;
4646
4809
  const TransferIdsSchema = Schema.Array(TransferIdSchema).check(Schema.isMinLength(1));
4647
4810
  const TransferTypeSchema = Schema.Literals([
4648
4811
  "URL",
@@ -4738,12 +4901,20 @@ const TransferSchema = Schema.Union([
4738
4901
  TransferCompletedSchema,
4739
4902
  TransferBaseSchema
4740
4903
  ]);
4741
- const TransfersListQuerySchema = Schema.Struct({ per_page: Schema.optional(Schema.Int.check(Schema.isGreaterThan(0))) });
4904
+ const TransfersListQuerySchema = Schema.Struct({ per_page: Schema.optional(PositiveIntegerSchema) });
4742
4905
  const TransferAddInputSchema = Schema.Struct({
4743
- callback_url: Schema.optional(Schema.String),
4744
- save_parent_id: Schema.optional(Schema.Int),
4745
- url: Schema.String
4906
+ callback_url: Schema.optional(NonEmptyStringSchema),
4907
+ save_parent_id: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
4908
+ url: NonEmptyStringSchema
4909
+ });
4910
+ const TransferContinueInputSchema = Schema.Struct({
4911
+ cursor: NonEmptyStringSchema,
4912
+ query: TransfersListQuerySchema
4746
4913
  });
4914
+ const TransferInfoUrlSchema = Schema.String.check(Schema.isMinLength(1), Schema.isPattern(/^[^\r\n]+$/));
4915
+ const TransferInfoUrlsSchema = Schema.Array(TransferInfoUrlSchema).check(Schema.isMinLength(1));
4916
+ const TransferAddManyInputSchema = Schema.Array(TransferAddInputSchema).check(Schema.isMinLength(1));
4917
+ const TransferCleanIdsSchema = Schema.Array(TransferIdSchema);
4747
4918
  const TrackerSchema = Schema.String.check(Schema.isPattern(/^[^,\s]+$/));
4748
4919
  const TransferAddTrackersInputSchema = Schema.Struct({
4749
4920
  trackers: Schema.Array(TrackerSchema).check(Schema.isMinLength(1)),
@@ -4964,112 +5135,115 @@ const StopRecordingTransferErrorSpec = definePutioOperationErrorSpec({
4964
5135
  { statusCode: 404 }
4965
5136
  ]
4966
5137
  });
4967
- const listTransfers = (query = {}) => requestJson(TransfersListEnvelopeSchema, {
5138
+ const listTransfers = (query = {}) => decodeAndRun(TransfersListQuerySchema, query, (decodedQuery) => requestJson(TransfersListEnvelopeSchema, {
4968
5139
  method: "GET",
4969
5140
  path: "/v2/transfers/list",
5141
+ query: decodedQuery
5142
+ })).pipe(withOperationErrors(ListTransfersErrorSpec));
5143
+ const continueTransfers = (cursor, query = {}) => decodeAndRun(TransferContinueInputSchema, {
5144
+ cursor,
4970
5145
  query
4971
- }).pipe(withOperationErrors(ListTransfersErrorSpec));
4972
- const continueTransfers = (cursor, query = {}) => requestJson(TransfersContinueEnvelopeSchema, {
5146
+ }, (decodedInput) => requestJson(TransfersContinueEnvelopeSchema, {
4973
5147
  body: {
4974
5148
  type: "form",
4975
- value: { cursor }
5149
+ value: { cursor: decodedInput.cursor }
4976
5150
  },
4977
5151
  method: "POST",
4978
5152
  path: "/v2/transfers/list/continue",
4979
- query
4980
- }).pipe(withOperationErrors(ListTransfersErrorSpec));
4981
- const getTransfer = (id) => requestJson(TransferEnvelopeSchema, {
5153
+ query: decodedInput.query
5154
+ })).pipe(withOperationErrors(ListTransfersErrorSpec));
5155
+ const getTransfer = (id) => decodeAndRun(TransferIdSchema, id, (decodedId) => requestJson(TransferEnvelopeSchema, {
4982
5156
  method: "GET",
4983
- path: `/v2/transfers/${encodePathSegment(id)}`
4984
- }).pipe(selectJsonField("transfer"), withOperationErrors(GetTransferErrorSpec));
4985
- const getTransferTorrent = (id) => Schema.decodeUnknownEffect(TransferIdSchema)(id).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedId) => requestArrayBuffer({
5157
+ path: `/v2/transfers/${encodePathSegment(decodedId)}`
5158
+ }).pipe(selectJsonField("transfer"))).pipe(withOperationErrors(GetTransferErrorSpec));
5159
+ const getTransferTorrent = (id) => decodeAndRun(TransferIdSchema, id, (decodedId) => requestArrayBuffer({
4986
5160
  method: "GET",
4987
5161
  path: `/v2/transfers/${encodePathSegment(decodedId)}/torrent`
4988
- })), withOperationErrors(GetTransferTorrentErrorSpec));
5162
+ })).pipe(withOperationErrors(GetTransferTorrentErrorSpec));
4989
5163
  const countTransfers = () => requestJson(TransferCountEnvelopeSchema, {
4990
5164
  method: "GET",
4991
5165
  path: "/v2/transfers/count"
4992
5166
  }).pipe(selectJsonField("count"));
4993
- const getTransferInfo = (urls) => requestJson(TransferInfoEnvelopeSchema, {
5167
+ const getTransferInfo = (urls) => decodeAndRun(TransferInfoUrlsSchema, urls, (decodedUrls) => requestJson(TransferInfoEnvelopeSchema, {
4994
5168
  body: {
4995
5169
  type: "form",
4996
- value: { urls: urls.join("\n") }
5170
+ value: { urls: decodedUrls.join("\n") }
4997
5171
  },
4998
5172
  method: "POST",
4999
5173
  path: "/v2/transfers/info"
5000
- }).pipe(selectJsonFields("disk_avail", "ret"));
5001
- const addTransfer = (input) => requestJson(TransferEnvelopeSchema, {
5174
+ }).pipe(selectJsonFields("disk_avail", "ret")));
5175
+ const addTransfer = (input) => decodeAndRun(TransferAddInputSchema, input, (decodedInput) => requestJson(TransferEnvelopeSchema, {
5002
5176
  body: {
5003
5177
  type: "form",
5004
- value: input
5178
+ value: decodedInput
5005
5179
  },
5006
5180
  method: "POST",
5007
5181
  path: "/v2/transfers/add"
5008
- }).pipe(selectJsonField("transfer"), withOperationErrors(AddTransferErrorSpec));
5009
- const addManyTransfers = (inputs) => requestJson(TransfersAddMultiEnvelopeSchema, {
5182
+ }).pipe(selectJsonField("transfer"))).pipe(withOperationErrors(AddTransferErrorSpec));
5183
+ const addManyTransfers = (inputs) => decodeAndRun(TransferAddManyInputSchema, inputs, (decodedInputs) => requestJson(TransfersAddMultiEnvelopeSchema, {
5010
5184
  body: {
5011
5185
  type: "form",
5012
- value: { urls: JSON.stringify(inputs) }
5186
+ value: { urls: JSON.stringify(decodedInputs) }
5013
5187
  },
5014
5188
  method: "POST",
5015
5189
  path: "/v2/transfers/add-multi"
5016
- }).pipe(selectJsonFields("errors", "transfers"), withOperationErrors(AddManyTransfersErrorSpec));
5017
- const addTransferTrackers = (input) => Schema.decodeUnknownEffect(TransferAddTrackersInputSchema)(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(OkResponseSchema, {
5190
+ }).pipe(selectJsonFields("errors", "transfers"))).pipe(withOperationErrors(AddManyTransfersErrorSpec));
5191
+ const addTransferTrackers = (input) => decodeAndRun(TransferAddTrackersInputSchema, input, (decodedInput) => requestJson(OkResponseSchema, {
5018
5192
  body: {
5019
5193
  type: "form",
5020
5194
  value: { trackers: joinCsv(decodedInput.trackers) }
5021
5195
  },
5022
5196
  method: "POST",
5023
5197
  path: `/v2/transfers/add-trackers/${encodePathSegment(decodedInput.transferId)}`
5024
- })), Effect.asVoid, withOperationErrors(AddTransferTrackersErrorSpec));
5025
- const cancelTransfers = (ids) => requestJson(OkResponseSchema, {
5198
+ })).pipe(Effect.asVoid, withOperationErrors(AddTransferTrackersErrorSpec));
5199
+ const cancelTransfers = (ids) => decodeAndRun(TransferIdsSchema, ids, (decodedIds) => requestJson(OkResponseSchema, {
5026
5200
  body: {
5027
5201
  type: "form",
5028
- value: { transfer_ids: joinCsv(ids) }
5202
+ value: { transfer_ids: joinCsv(decodedIds) }
5029
5203
  },
5030
5204
  method: "POST",
5031
5205
  path: "/v2/transfers/cancel"
5032
- });
5033
- const cleanTransfers = (ids = []) => requestJson(TransfersCleanEnvelopeSchema, {
5206
+ }));
5207
+ const cleanTransfers = (ids = []) => decodeAndRun(TransferCleanIdsSchema, ids, (decodedIds) => requestJson(TransfersCleanEnvelopeSchema, {
5034
5208
  body: {
5035
5209
  type: "form",
5036
- value: ids.length > 0 ? { transfer_ids: joinCsv(ids) } : {}
5210
+ value: decodedIds.length > 0 ? { transfer_ids: joinCsv(decodedIds) } : {}
5037
5211
  },
5038
5212
  method: "POST",
5039
5213
  path: "/v2/transfers/clean"
5040
- }).pipe(selectJsonFields("deleted_ids"));
5041
- const removeTransfers = (input) => Schema.decodeUnknownEffect(TransferRemoveInputSchema)(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(OkResponseSchema, {
5214
+ }).pipe(selectJsonFields("deleted_ids")));
5215
+ const removeTransfers = (input) => decodeAndRun(TransferRemoveInputSchema, input, (decodedInput) => requestJson(OkResponseSchema, {
5042
5216
  body: {
5043
5217
  type: "form",
5044
5218
  value: decodedInput.ids !== void 0 ? { transfer_ids: joinCsv(decodedInput.ids) } : { remove_filter: decodedInput.filter }
5045
5219
  },
5046
5220
  method: "POST",
5047
5221
  path: "/v2/transfers/remove"
5048
- })), Effect.asVoid, withOperationErrors(RemoveTransfersErrorSpec));
5049
- const retryTransfer = (id) => requestJson(TransferEnvelopeSchema, {
5222
+ })).pipe(Effect.asVoid, withOperationErrors(RemoveTransfersErrorSpec));
5223
+ const retryTransfer = (id) => decodeAndRun(TransferIdSchema, id, (decodedId) => requestJson(TransferEnvelopeSchema, {
5050
5224
  body: {
5051
5225
  type: "form",
5052
- value: { id }
5226
+ value: { id: decodedId }
5053
5227
  },
5054
5228
  method: "POST",
5055
5229
  path: "/v2/transfers/retry"
5056
- }).pipe(selectJsonField("transfer"), withOperationErrors(RetryTransferErrorSpec));
5057
- const reannounceTransfer = (id) => requestJson(OkResponseSchema, {
5230
+ }).pipe(selectJsonField("transfer"))).pipe(withOperationErrors(RetryTransferErrorSpec));
5231
+ const reannounceTransfer = (id) => decodeAndRun(TransferIdSchema, id, (decodedId) => requestJson(OkResponseSchema, {
5058
5232
  body: {
5059
5233
  type: "form",
5060
- value: { id }
5234
+ value: { id: decodedId }
5061
5235
  },
5062
5236
  method: "POST",
5063
5237
  path: "/v2/transfers/reannounce"
5064
- }).pipe(withOperationErrors(ReannounceTransferErrorSpec));
5065
- const stopTransferRecording = (id) => requestJson(OkResponseSchema, {
5238
+ })).pipe(withOperationErrors(ReannounceTransferErrorSpec));
5239
+ const stopTransferRecording = (id) => decodeAndRun(TransferIdSchema, id, (decodedId) => requestJson(OkResponseSchema, {
5066
5240
  body: {
5067
5241
  type: "form",
5068
- value: { transfer_id: id }
5242
+ value: { transfer_id: decodedId }
5069
5243
  },
5070
5244
  method: "POST",
5071
5245
  path: "/v2/transfers/stop-recording"
5072
- }).pipe(withOperationErrors(StopRecordingTransferErrorSpec));
5246
+ })).pipe(withOperationErrors(StopRecordingTransferErrorSpec));
5073
5247
  //#endregion
5074
5248
  //#region src/domains/tunnel.ts
5075
5249
  const TunnelRouteSchema = Schema.Struct({
@@ -5142,7 +5316,7 @@ const ZipInfoSchema = Schema.Union([
5142
5316
  ZipInfoErrorSchema,
5143
5317
  ZipInfoDoneSchema
5144
5318
  ]);
5145
- const CreateZipInputSchema = makeCursorSelectionSchema("file_ids", "exclude_ids");
5319
+ const CreateZipInputSchema = makeCursorSelectionSchema("file_ids", "exclude_ids", {});
5146
5320
  const FilesReadScopeError = {
5147
5321
  errorType: "invalid_scope",
5148
5322
  statusCode: 401
@@ -5421,7 +5595,6 @@ const createPutioSdkEffectClient = () => ({
5421
5595
  listPlans: listPaymentPlans,
5422
5596
  methods: {
5423
5597
  addPaddleWaitingPayment: createPaddleWaitingPayment,
5424
- createCoinbaseCharge,
5425
5598
  createOpenNodeCharge,
5426
5599
  createPaddleBillingUpdatePaymentMethodTransaction,
5427
5600
  getPaddleBillingInvoiceUrl
@@ -5694,7 +5867,6 @@ const createPutioSdkPromiseClient = (initialConfig = {}) => {
5694
5867
  listPlans: () => provideSdk(config, listPaymentPlans()),
5695
5868
  methods: {
5696
5869
  addPaddleWaitingPayment: (input) => provideSdk(config, createPaddleWaitingPayment(input)),
5697
- createCoinbaseCharge: (planPath) => provideSdk(config, createCoinbaseCharge(planPath)),
5698
5870
  createOpenNodeCharge: (planPath) => provideSdk(config, createOpenNodeCharge(planPath)),
5699
5871
  createPaddleBillingUpdatePaymentMethodTransaction: (userSubscriptionId) => provideSdk(config, createPaddleBillingUpdatePaymentMethodTransaction(userSubscriptionId)),
5700
5872
  getPaddleBillingInvoiceUrl: (paymentId) => provideSdk(config, getPaddleBillingInvoiceUrl(paymentId))
@@ -5772,6 +5944,6 @@ const createPutioSdkPromiseClient = (initialConfig = {}) => {
5772
5944
  };
5773
5945
  };
5774
5946
  //#endregion
5775
- export { AccountClearOptionsSchema, AccountConfirmationSchema, AccountConfirmationsErrorSpec, AccountDiskSchema, AccountInfoBaseSchema, AccountInfoBroadSchema, AccountInfoQuerySchema, AccountSettingsSchema, AccountSubtitleLanguageSchema, AccountTwoFactorSettingsSchema, AccountWarningsSchema, AddManyTransfersErrorSpec, AddTransferErrorSpec, AddTransferTrackersErrorSpec, AppSpecificPasswordSchema, ApproveFriendRequestErrorSpec, AuthorizationCodeSchema, CanWriteFileErrorSpec, CancelZipErrorSpec, ClearEventsErrorSpec, ClearRssFeedLogsErrorSpec, ClientsErrorSpec, ConfirmFastspringOrderErrorSpec, ContinueFilesErrorSpec, ContinuePublicShareFilesErrorSpec, ContinueTrashErrorSpec, CopyFileErrorSpec, CountWaitingRequestsErrorSpec, CreateAppSpecificPasswordErrorSpec, CreateAppSpecificPasswordInputSchema, CreateCoinbaseChargeErrorSpec, CreateDownloadLinksErrorSpec, CreateFamilyInviteErrorSpec, CreateFolderErrorSpec, CreateFriendInviteErrorSpec, CreateOAuthAppErrorSpec, CreateOpenNodeChargeErrorSpec, CreatePaddleBillingUpdatePaymentMethodTransactionErrorSpec, CreatePaddleWaitingPaymentErrorSpec, CreatePublicShareErrorSpec, CreateRssFeedErrorSpec, CreateSharingCloneErrorSpec, CreateZipErrorSpec, DEFAULT_PUTIO_API_BASE_URL, DEFAULT_PUTIO_UPLOAD_BASE_URL, DEFAULT_PUTIO_WEB_APP_URL, DeleteAllAppSpecificPasswordsErrorSpec, DeleteAppSpecificPasswordErrorSpec, DeleteEventErrorSpec, DeleteOAuthAppErrorSpec, DeletePublicShareErrorSpec, DeleteRssFeedErrorSpec, DeleteTrashErrorSpec, DenyFriendRequestErrorSpec, DownloadLinksCreateInputSchema, DownloadLinksInfoSchema, DownloadLinksPayloadSchema, DownloadLinksStatusSchema, DownloadUrlErrorSpec, EmptyTrashErrorSpec, EventsListQuerySchema, FamilyInviteLookupErrorSpec, FamilyInviteSchema, FamilyMemberSchema, FileActiveConversionSchema, FileActiveConversionsErrorSpec, FileBaseSchema, FileBreadcrumbSchema, FileBroadSchema, FileConversionStatusSchema, FileCopyInputSchema, FileExtractionSchema, FileExtractionStatusSchema, FileExtractionsErrorSpec, FileGetChildInputSchema, FileMediaInfoFormatSchema, FileMediaInfoSchema, FileMediaInfoStreamSchema, FileMediaMetadataSchema, FileMp4ErrorSpec, FileMp4MutationErrorSpec, FileQuerySchema, FileSetSortInputSchema, FileSortSchema, FileSubtitleSchema, FileSubtitlesErrorSpec, FileTouchInputSchema, FileTypeSchema, FileUploadErrorSpec, FileWatchStatusErrorSpec, FilesListEnvelopeSchema, FilesListQuerySchema, FilesMoveErrorSchema, FilesSearchQuerySchema, FolderTypeSchema, ForgotPasswordErrorSpec, FriendBaseSchema, FriendInviteJoinedUserSchema, FriendInviteJoinedUserStatusSchema, FriendInviteLookupErrorSpec, FriendInviteSchema, FriendSchema, FriendSharedFolderErrorSpec, GenerateTOTPErrorSpec, GenerateTOTPResponseSchema, GetDownloadLinksErrorSpec, GetEventTorrentErrorSpec, GetFileChildErrorSpec, GetFileErrorSpec, GetIftttStatusErrorSpec, GetOAuthAppErrorSpec, GetPaddleBillingInvoiceUrlErrorSpec, GetPaymentInfoErrorSpec, GetPaymentVoucherInfoErrorSpec, GetPublicShareErrorSpec, GetPublicShareFileUrlErrorSpec, GetRssFeedErrorSpec, GetSharedWithErrorSpec, GetSharingCloneInfoErrorSpec, GetTransferErrorSpec, GetTransferTorrentErrorSpec, GetZipErrorSpec, GiftCardLookupErrorSpec, GrantsErrorSpec, HistoryEventSchema, HistoryFileFromRssDeletedEventSchema, HistoryFileSharedEventSchema, HistoryKnownEventTypeSchema, HistoryPrivateTorrentPinEventSchema, HistoryRssFilterPausedEventSchema, HistoryTransferCallbackErrorEventSchema, HistoryTransferCompletedEventSchema, HistoryTransferErrorEventSchema, HistoryTransferFromRssErrorEventSchema, HistoryUploadEventSchema, HistoryVoucherEventSchema, HistoryZipCreatedEventSchema, JoinFamilyErrorSpec, JsonObjectSchema, JsonValueSchema, LinkDeviceErrorSpec, ListAppSpecificPasswordsErrorSpec, 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, OAuthAuthorizationCodeExchangeError, OAuthAuthorizationCodeExchangeErrorCodeSchema, OAuthAuthorizationCodeExchangeInputSchema, OAuthSetIconInputSchema, OkResponseSchema, OwnedOAuthAppSchema, PasInfoSchema, PauseRssFeedErrorSpec, PaymentChangePlanPreviewSchema, PaymentChangePlanSubmitSchema, PaymentHistoryItemSchema, PaymentInfoPlanSchema, PaymentInfoSchema, PaymentInviteSchema, PaymentOptionPlanTypeSchema, PaymentOptionSchema, PaymentPlanGroupSchema, PaymentPlanTypeSchema, PaymentProviderNameSchema, PaymentProviderSchema, PaymentSubscriptionInfoSchema, PaymentTypeSchema, PaymentVoucherInfoSchema, PodcastGetLinksInputSchema, PodcastLinkTypeSchema, PodcastLinksSchema, PopularOAuthAppSchema, PreviewPaymentChangePlanErrorSpec, PublicShareListQuerySchema, PublicShareSchema, PutioApiError, PutioAuthError, PutioConfigurationError, PutioErrorEnvelopeSchema, PutioHttpClient, PutioOperationError, PutioRateLimitError, PutioSdk, PutioSdkConfig, PutioTransportError, PutioValidationError, QueryFilesErrorSpec, QueryOAuthAppsErrorSpec, ReannounceTransferErrorSpec, RecoveryCodesErrorSpec, RedeemPaymentVoucherErrorSpec, RegenerateOAuthAppTokenErrorSpec, RegenerateRecoveryCodesErrorSpec, RegisterErrorSpec, RegisterInputSchema, RemoveFamilyMemberErrorSpec, RemoveFriendErrorSpec, RemoveTransfersErrorSpec, 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, TouchFilesErrorSpec, TransferAddInputSchema, TransferAddTrackersInputSchema, TransferBaseSchema, TransferRemoveInputSchema, TransferSchema, TransferStatusSchema, TransferTypeSchema, TransfersListQuerySchema, TrashFileSchema, TunnelRouteSchema, TwoFactorRecoveryCodesSchema, UnshareFileErrorSpec, UpdateOAuthAppErrorSpec, UpdateRssFeedErrorSpec, UserSearchResultSchema, UserSubscriptionStatusSchema, ValidateTokenResponseSchema, VerifyTOTPErrorSpec, VerifyTOTPResponseSchema, VoucherLookupErrorSpec, ZipStatusSchema, addManyTransfers, addTransfer, addTransferTrackers, approveFriendRequest, buildAuthLoginUrl, buildFileApiContentUrl, buildFileApiDownloadUrl, buildFileApiMp4DownloadUrl, buildFileHlsStreamUrl, buildOAuthAppIconUrl, buildOAuthAuthorizeUrl, buildPutioUrl, canWriteFile, cancelTransfers, cancelZip, checkCodeMatch, classifyPaymentChangePlanResponse, cleanTransfers, clearAccount, clearEvents, clearRssFeedLogs, clients, cloneSharedFiles, confirmFastspringOrder, continueFiles, continuePublicShareFiles, continueSearch, continueTransfers, continueTrash, convertFileSelectionToMp4, convertFileToMp4, convertFilesToMp4, copyFile, countTransfers, countWaitingRequests, createAppSpecificPassword, createCoinbaseCharge, createDownloadLinks, createFamilyInvite, createFileUploadFormData, createFileUploadRequest, createFolder, createFriendInvite, createOAuthApp, createOpenNodeCharge, createPaddleBillingUpdatePaymentMethodTransaction, createPaddleWaitingPayment, createPublicShare, createPutioSdkEffectClient, createPutioSdkPromiseClient, createRssFeed, createZip, decodePutioErrorEnvelope, definePutioOperationErrorSpec, deleteAllAppSpecificPasswords, deleteAppSpecificPassword, deleteConfigKey, deleteEvent, deleteFileExtraction, deleteFileMp4, deleteFileSelection, deleteFiles, deleteOAuthApp, deletePublicShare, deleteRssFeed, deleteTrash, denyFriendRequest, destroyAccount, emptyTrash, encodePathSegment, exchangeOAuthAuthorizationCode, exists, extractFiles, fallbackPutioErrorEnvelope, findNextFile, findNextVideo, forgotPassword, generateTOTP, getAccountInfo, getAccountSettings, getApiContentUrl, getApiDownloadUrl, getApiMp4DownloadUrl, getCode, getConfigKey, getConfigKeyWith, getDownloadLinks, getDownloadUrl, getEventTorrent, getFamilyInvite, getFile, getFileChild, getFriendInvite, getFriendSharedFolder, getGiftCard, getHlsStreamUrl, getIftttStatus, getMp4Status, getOAuthApp, getPaddleBillingInvoiceUrl, getPaymentInfo, getPaymentVoucherInfo, getPodcastLinks, getPopularOAuthApps, getPublicShare, getPublicShareFileUrl, getRecoveryCodes, getRssFeed, getSharedWith, getSharingCloneInfo, getStartFrom, getTransfer, getTransferInfo, getTransferTorrent, getVoucher, getZip, grants, isPutioApiError, isPutioAuthError, isPutioErrorEnvelope, isPutioOperationError, isPutioRateLimitError, joinFamily, linkDevice, listAccountConfirmations, listAccountSubtitleLanguages, listActiveMp4Conversions, listAppSpecificPasswords, listEvents, listFamilyInvites, listFamilyMembers, listFileExtractions, listFileSubtitles, listFriendInvites, listFriends, listPaymentHistory, listPaymentInvites, listPaymentOptions, listPaymentPlans, listPublicShareFiles, listPublicShares, listRssFeedItems, listRssFeeds, listSentRequests, listSharedFiles, listTransfers, listTrash, listTunnelRoutes, listWaitingRequests, listZips, login, logout, makePutioFetchClient, makePutioFetchLayer, 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, removeTransfers, renameFile, reportPayments, requestArrayBuffer, requestJson, requestVoid, resetFileSortSettings, resetPassword, resetStartFrom, responseRateLimitHeaders, restoreTrash, resumeRssFeed, retryAllRssFeedItems, retryRssFeedItem, retryTransfer, revokeAllClients, revokeApp, revokeClient, saveAccountSettings, searchFiles, searchFriends, selectJsonField, selectJsonFields, sendFriendRequest, sendIftttEvent, setConfigKey, setFileSort, setFilesWatchStatus, setOAuthAppIcon, setStartFrom, shareFiles, stopPaymentSubscription, stopTransferRecording, submitPaymentChangePlan, touchFiles, unshareFile, updateOAuthApp, updateRssFeed, uploadFile, validateToken, verifyTOTP, withOperationErrors, writeConfig };
5947
+ export { AccountClearOptionsSchema, AccountConfirmationSchema, AccountConfirmationsErrorSpec, AccountDiskSchema, AccountInfoBaseSchema, AccountInfoBroadSchema, AccountInfoQuerySchema, AccountSettingsSchema, AccountSubtitleLanguageSchema, AccountTwoFactorSettingsSchema, AccountWarningsSchema, AddManyTransfersErrorSpec, AddTransferErrorSpec, AddTransferTrackersErrorSpec, AppSpecificPasswordSchema, ApproveFriendRequestErrorSpec, AuthorizationCodeSchema, CanWriteFileErrorSpec, CancelZipErrorSpec, ClearEventsErrorSpec, ClearRssFeedLogsErrorSpec, ClientsErrorSpec, ConfirmFastspringOrderErrorSpec, ContinueFilesErrorSpec, ContinuePublicShareFilesErrorSpec, ContinueTrashErrorSpec, CopyFileErrorSpec, CountWaitingRequestsErrorSpec, CreateAppSpecificPasswordErrorSpec, CreateAppSpecificPasswordInputSchema, CreateDownloadLinksErrorSpec, CreateFamilyInviteErrorSpec, CreateFolderErrorSpec, CreateFriendInviteErrorSpec, CreateOAuthAppErrorSpec, CreateOpenNodeChargeErrorSpec, CreatePaddleBillingUpdatePaymentMethodTransactionErrorSpec, CreatePaddleWaitingPaymentErrorSpec, CreatePublicShareErrorSpec, CreateRssFeedErrorSpec, CreateSharingCloneErrorSpec, CreateZipErrorSpec, DEFAULT_PUTIO_API_BASE_URL, DEFAULT_PUTIO_UPLOAD_BASE_URL, DEFAULT_PUTIO_WEB_APP_URL, DeleteAllAppSpecificPasswordsErrorSpec, DeleteAppSpecificPasswordErrorSpec, DeleteEventErrorSpec, DeleteOAuthAppErrorSpec, DeletePublicShareErrorSpec, DeleteRssFeedErrorSpec, DeleteTrashErrorSpec, DenyFriendRequestErrorSpec, DownloadLinksCreateInputSchema, DownloadLinksInfoSchema, DownloadLinksPayloadSchema, DownloadLinksStatusSchema, DownloadUrlErrorSpec, EmptyTrashErrorSpec, EventsListQuerySchema, FamilyInviteLookupErrorSpec, FamilyInviteSchema, FamilyMemberSchema, FileActiveConversionSchema, FileActiveConversionsErrorSpec, FileBaseSchema, FileBreadcrumbSchema, FileBroadSchema, FileConversionStatusSchema, FileCopyInputSchema, FileExtractionSchema, FileExtractionStatusSchema, FileExtractionsErrorSpec, FileGetChildInputSchema, FileMediaInfoFormatSchema, FileMediaInfoSchema, FileMediaInfoStreamSchema, FileMediaMetadataSchema, FileMp4ErrorSpec, FileMp4MutationErrorSpec, FileQuerySchema, FileSetSortInputSchema, FileSortSchema, FileSubtitleSchema, FileSubtitlesErrorSpec, FileTouchInputSchema, FileTypeSchema, FileUploadErrorSpec, FileWatchStatusErrorSpec, FilesListEnvelopeSchema, FilesListQuerySchema, FilesMoveErrorSchema, FilesSearchQuerySchema, FolderTypeSchema, ForgotPasswordErrorSpec, FriendBaseSchema, FriendInviteJoinedUserSchema, FriendInviteJoinedUserStatusSchema, FriendInviteLookupErrorSpec, FriendInviteSchema, FriendSchema, FriendSharedFolderErrorSpec, GenerateTOTPErrorSpec, GenerateTOTPResponseSchema, GetDownloadLinksErrorSpec, GetEventTorrentErrorSpec, GetFileChildErrorSpec, GetFileErrorSpec, GetIftttStatusErrorSpec, GetOAuthAppErrorSpec, GetPaddleBillingInvoiceUrlErrorSpec, GetPaymentInfoErrorSpec, GetPaymentVoucherInfoErrorSpec, GetPublicShareErrorSpec, GetPublicShareFileUrlErrorSpec, GetRssFeedErrorSpec, GetSharedWithErrorSpec, GetSharingCloneInfoErrorSpec, GetTransferErrorSpec, GetTransferTorrentErrorSpec, GetZipErrorSpec, GiftCardLookupErrorSpec, GrantsErrorSpec, HistoryEventSchema, HistoryFileFromRssDeletedEventSchema, HistoryFileSharedEventSchema, HistoryKnownEventTypeSchema, HistoryPrivateTorrentPinEventSchema, HistoryRssFilterPausedEventSchema, HistoryTransferCallbackErrorEventSchema, HistoryTransferCompletedEventSchema, HistoryTransferErrorEventSchema, HistoryTransferFromRssErrorEventSchema, HistoryUploadEventSchema, HistoryVoucherEventSchema, HistoryZipCreatedEventSchema, JoinFamilyErrorSpec, JsonObjectSchema, JsonValueSchema, LinkDeviceErrorSpec, ListAppSpecificPasswordsErrorSpec, 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, OAuthAuthorizationCodeExchangeError, OAuthAuthorizationCodeExchangeErrorCodeSchema, OAuthAuthorizationCodeExchangeInputSchema, OAuthSetIconInputSchema, OkResponseSchema, OwnedOAuthAppSchema, PasInfoSchema, PauseRssFeedErrorSpec, PaymentChangePlanPreviewSchema, PaymentChangePlanSubmitSchema, PaymentHistoryItemSchema, PaymentInfoPlanSchema, PaymentInfoSchema, PaymentInviteSchema, PaymentOptionPlanTypeSchema, PaymentOptionSchema, PaymentPlanGroupSchema, PaymentPlanTypeSchema, PaymentProviderNameSchema, PaymentProviderSchema, PaymentSubscriptionInfoSchema, PaymentTypeSchema, PaymentVoucherInfoSchema, PodcastGetLinksInputSchema, PodcastLinkTypeSchema, PodcastLinksSchema, PopularOAuthAppSchema, PreviewPaymentChangePlanErrorSpec, PublicShareListQuerySchema, PublicShareSchema, PutioApiError, PutioAuthError, PutioConfigurationError, PutioErrorEnvelopeSchema, PutioHttpClient, PutioOperationError, PutioRateLimitError, PutioSdk, PutioSdkConfig, PutioTransportError, PutioValidationError, QueryFilesErrorSpec, QueryOAuthAppsErrorSpec, ReannounceTransferErrorSpec, RecoveryCodesErrorSpec, RedeemPaymentVoucherErrorSpec, RegenerateOAuthAppTokenErrorSpec, RegenerateRecoveryCodesErrorSpec, RegisterErrorSpec, RegisterInputSchema, RemoveFamilyMemberErrorSpec, RemoveFriendErrorSpec, RemoveTransfersErrorSpec, 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, TouchFilesErrorSpec, TransferAddInputSchema, TransferAddTrackersInputSchema, TransferBaseSchema, TransferRemoveInputSchema, TransferSchema, TransferStatusSchema, TransferTypeSchema, TransfersListQuerySchema, TrashFileSchema, TunnelRouteSchema, TwoFactorRecoveryCodesSchema, UnshareFileErrorSpec, UpdateOAuthAppErrorSpec, UpdateRssFeedErrorSpec, UserSearchResultSchema, UserSubscriptionStatusSchema, ValidateTokenResponseSchema, VerifyTOTPErrorSpec, VerifyTOTPResponseSchema, VoucherLookupErrorSpec, ZipStatusSchema, addManyTransfers, addTransfer, addTransferTrackers, approveFriendRequest, buildAuthLoginUrl, buildFileApiContentUrl, buildFileApiDownloadUrl, buildFileApiMp4DownloadUrl, buildFileHlsStreamUrl, buildOAuthAppIconUrl, buildOAuthAuthorizeUrl, buildPutioUrl, canWriteFile, cancelTransfers, cancelZip, checkCodeMatch, classifyPaymentChangePlanResponse, cleanTransfers, clearAccount, clearEvents, clearRssFeedLogs, clients, cloneSharedFiles, confirmFastspringOrder, continueFiles, continuePublicShareFiles, continueSearch, continueTransfers, continueTrash, convertFileSelectionToMp4, convertFileToMp4, convertFilesToMp4, copyFile, countTransfers, countWaitingRequests, createAppSpecificPassword, createDownloadLinks, createFamilyInvite, createFileUploadFormData, createFileUploadRequest, createFolder, createFriendInvite, createOAuthApp, createOpenNodeCharge, createPaddleBillingUpdatePaymentMethodTransaction, createPaddleWaitingPayment, createPublicShare, createPutioSdkEffectClient, createPutioSdkPromiseClient, createRssFeed, createZip, decodePutioErrorEnvelope, definePutioOperationErrorSpec, deleteAllAppSpecificPasswords, deleteAppSpecificPassword, deleteConfigKey, deleteEvent, deleteFileExtraction, deleteFileMp4, deleteFileSelection, deleteFiles, deleteOAuthApp, deletePublicShare, deleteRssFeed, deleteTrash, denyFriendRequest, destroyAccount, emptyTrash, encodePathSegment, exchangeOAuthAuthorizationCode, exists, extractFiles, fallbackPutioErrorEnvelope, findNextFile, findNextVideo, forgotPassword, generateTOTP, getAccountInfo, getAccountSettings, getApiContentUrl, getApiDownloadUrl, getApiMp4DownloadUrl, getCode, getConfigKey, getConfigKeyWith, getDownloadLinks, getDownloadUrl, getEventTorrent, getFamilyInvite, getFile, getFileChild, getFriendInvite, getFriendSharedFolder, getGiftCard, getHlsStreamUrl, getIftttStatus, getMp4Status, getOAuthApp, getPaddleBillingInvoiceUrl, getPaymentInfo, getPaymentVoucherInfo, getPodcastLinks, getPopularOAuthApps, getPublicShare, getPublicShareFileUrl, getRecoveryCodes, getRssFeed, getSharedWith, getSharingCloneInfo, getStartFrom, getTransfer, getTransferInfo, getTransferTorrent, getVoucher, getZip, grants, isPutioApiError, isPutioAuthError, isPutioErrorEnvelope, isPutioOperationError, isPutioRateLimitError, joinFamily, linkDevice, listAccountConfirmations, listAccountSubtitleLanguages, listActiveMp4Conversions, listAppSpecificPasswords, listEvents, listFamilyInvites, listFamilyMembers, listFileExtractions, listFileSubtitles, listFriendInvites, listFriends, listPaymentHistory, listPaymentInvites, listPaymentOptions, listPaymentPlans, listPublicShareFiles, listPublicShares, listRssFeedItems, listRssFeeds, listSentRequests, listSharedFiles, listTransfers, listTrash, listTunnelRoutes, listWaitingRequests, listZips, login, logout, makePutioFetchClient, makePutioFetchLayer, 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, removeTransfers, renameFile, reportPayments, requestArrayBuffer, requestJson, requestVoid, resetFileSortSettings, resetPassword, resetStartFrom, responseRateLimitHeaders, restoreTrash, resumeRssFeed, retryAllRssFeedItems, retryRssFeedItem, retryTransfer, revokeAllClients, revokeApp, revokeClient, saveAccountSettings, searchFiles, searchFriends, selectJsonField, selectJsonFields, sendFriendRequest, sendIftttEvent, setConfigKey, setFileSort, setFilesWatchStatus, setOAuthAppIcon, setStartFrom, shareFiles, stopPaymentSubscription, stopTransferRecording, submitPaymentChangePlan, touchFiles, unshareFile, updateOAuthApp, updateRssFeed, uploadFile, validateToken, verifyTOTP, withOperationErrors, writeConfig };
5776
5948
 
5777
5949
  //# sourceMappingURL=index.js.map