@putdotio/sdk 11.0.0 → 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-B-7FgtEO.d.ts → index-DVcfPFyy.d.ts} +51 -41
- package/dist/index.d.ts +2 -2
- package/dist/index.js +516 -309
- package/dist/index.js.map +1 -1
- package/dist/utilities.d.ts +1 -1
- package/package.json +2 -1
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:
|
|
765
|
-
family_invite_code: Schema.optional(
|
|
766
|
-
friend_invite_code: Schema.optional(
|
|
767
|
-
gift_card_confirmation_code: Schema.optional(
|
|
768
|
-
mail:
|
|
769
|
-
password:
|
|
770
|
-
plan_name: Schema.optional(
|
|
771
|
-
username:
|
|
772
|
-
voucher_code: Schema.optional(
|
|
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:
|
|
776
|
-
clientSecret:
|
|
777
|
-
code:
|
|
778
|
-
redirectUri: Schema.optional(
|
|
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) =>
|
|
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:
|
|
1049
|
-
username:
|
|
1086
|
+
password: decodedInput.password,
|
|
1087
|
+
username: decodedInput.username
|
|
1050
1088
|
},
|
|
1051
1089
|
method: "PUT",
|
|
1052
|
-
path:
|
|
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:
|
|
1055
|
-
client_name:
|
|
1056
|
-
client_secret:
|
|
1092
|
+
callback_url: decodedInput.callbackUrl,
|
|
1093
|
+
client_name: decodedInput.clientName,
|
|
1094
|
+
client_secret: decodedInput.clientSecret
|
|
1057
1095
|
}
|
|
1058
|
-
}).pipe(selectJsonFields("access_token", "user_id")
|
|
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:
|
|
1105
|
+
value: decodedInput
|
|
1068
1106
|
},
|
|
1069
1107
|
method: "POST",
|
|
1070
1108
|
path: "/v2/registration/register"
|
|
1071
|
-
}).pipe(selectJsonFields("access_token")
|
|
1072
|
-
const exists = (key, value) =>
|
|
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(
|
|
1082
|
-
}).pipe(selectJsonField("voucher")
|
|
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(
|
|
1087
|
-
}).pipe(selectJsonField("gift_card")
|
|
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(
|
|
1092
|
-
}).pipe(selectJsonField("invite")
|
|
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(
|
|
1097
|
-
}).pipe(selectJsonField("invite")
|
|
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) =>
|
|
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")
|
|
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:
|
|
1125
|
-
client_name:
|
|
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(
|
|
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")
|
|
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(
|
|
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(
|
|
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:
|
|
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) =>
|
|
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
|
-
}))
|
|
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:
|
|
1821
|
-
event_type:
|
|
1822
|
-
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);
|
|
@@ -1997,18 +2042,42 @@ const FilesSearchEnvelopeSchema = Schema.Struct({
|
|
|
1997
2042
|
status: Schema.Literal("OK"),
|
|
1998
2043
|
total: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))
|
|
1999
2044
|
});
|
|
2000
|
-
Schema.Struct({
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
path: Schema.optional(Schema.String)
|
|
2045
|
+
const FilesListInputSchema = Schema.Struct({
|
|
2046
|
+
parent: Schema.Union([NonNegativeFileIdSchema, Schema.Literal("friends")]),
|
|
2047
|
+
query: FilesListQuerySchema
|
|
2004
2048
|
});
|
|
2005
|
-
Schema.Struct({
|
|
2006
|
-
|
|
2007
|
-
|
|
2049
|
+
const FilesContinueInputSchema = Schema.Struct({
|
|
2050
|
+
cursor: NonEmptyStringSchema,
|
|
2051
|
+
query: Schema.Struct({ per_page: Schema.optional(PositiveIntegerSchema) })
|
|
2008
2052
|
});
|
|
2009
|
-
Schema.Struct({
|
|
2010
|
-
|
|
2011
|
-
|
|
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))
|
|
2012
2081
|
});
|
|
2013
2082
|
const FileStartFromEnvelopeSchema = Schema.Struct({
|
|
2014
2083
|
start_from: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
@@ -2128,10 +2197,51 @@ const FileExtractionsEnvelopeSchema = Schema.Struct({
|
|
|
2128
2197
|
extractions: Schema.Array(FileExtractionSchema),
|
|
2129
2198
|
status: Schema.optional(Schema.Literal("OK"))
|
|
2130
2199
|
});
|
|
2131
|
-
Schema.Struct({
|
|
2132
|
-
cursor: Schema.optional(
|
|
2133
|
-
excludeIds: Schema.optional(Schema.Array(
|
|
2134
|
-
ids: Schema.optional(Schema.Array(Schema.
|
|
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)))
|
|
2135
2245
|
});
|
|
2136
2246
|
const FilesNextFileSchema = Schema.Struct({
|
|
2137
2247
|
id: Schema.Int,
|
|
@@ -2488,32 +2598,38 @@ const ensureFileQueryFields = (effect, query) => Effect.gen(function* () {
|
|
|
2488
2598
|
if (query.media_info === 1 && !hasMediaInfo(file)) return yield* failMissingField("media_info");
|
|
2489
2599
|
return file;
|
|
2490
2600
|
});
|
|
2491
|
-
const queryFiles = (parent, query = {}) =>
|
|
2601
|
+
const queryFiles = (parent, query = {}) => decodeAndRun(FilesListInputSchema, {
|
|
2602
|
+
parent,
|
|
2603
|
+
query
|
|
2604
|
+
}, (decodedInput) => requestJson(FilesListEnvelopeSchema, {
|
|
2492
2605
|
method: "GET",
|
|
2493
|
-
path: parent === "friends" ? "/v2/files/list/items-shared-with-you" : "/v2/files/list",
|
|
2494
|
-
query: parent === "friends" ? query : {
|
|
2495
|
-
...query,
|
|
2496
|
-
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
|
|
2497
2610
|
}
|
|
2498
|
-
}).pipe(withOperationErrors(QueryFilesErrorSpec));
|
|
2499
|
-
const continueFiles = (cursor, query = {}) =>
|
|
2611
|
+
})).pipe(withOperationErrors(QueryFilesErrorSpec));
|
|
2612
|
+
const continueFiles = (cursor, query = {}) => decodeAndRun(FilesContinueInputSchema, {
|
|
2613
|
+
cursor,
|
|
2614
|
+
query
|
|
2615
|
+
}, (decodedInput) => requestJson(FilesListContinueEnvelopeSchema, {
|
|
2500
2616
|
body: {
|
|
2501
2617
|
type: "form",
|
|
2502
|
-
value: { cursor }
|
|
2618
|
+
value: { cursor: decodedInput.cursor }
|
|
2503
2619
|
},
|
|
2504
2620
|
method: "POST",
|
|
2505
2621
|
path: "/v2/files/list/continue",
|
|
2506
|
-
query
|
|
2507
|
-
}).pipe(withOperationErrors(ContinueFilesErrorSpec));
|
|
2622
|
+
query: decodedInput.query
|
|
2623
|
+
})).pipe(withOperationErrors(ContinueFilesErrorSpec));
|
|
2508
2624
|
function getFile(input) {
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
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
|
+
});
|
|
2517
2633
|
}
|
|
2518
2634
|
function getFileChild(input) {
|
|
2519
2635
|
return Schema.decodeUnknownEffect(FileGetChildInputSchema)(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => {
|
|
@@ -2560,15 +2676,18 @@ const searchFiles = (query) => Schema.decodeUnknownEffect(FilesSearchQuerySchema
|
|
|
2560
2676
|
path: "/v2/files/search",
|
|
2561
2677
|
query: decodedQuery
|
|
2562
2678
|
})), withOperationErrors(SearchFilesErrorSpec));
|
|
2563
|
-
const continueSearch = (cursor, query = {}) =>
|
|
2679
|
+
const continueSearch = (cursor, query = {}) => decodeAndRun(FilesSearchContinueInputSchema, {
|
|
2680
|
+
cursor,
|
|
2681
|
+
query
|
|
2682
|
+
}, (decodedInput) => requestJson(FilesSearchEnvelopeSchema, {
|
|
2564
2683
|
body: {
|
|
2565
2684
|
type: "form",
|
|
2566
|
-
value: { cursor }
|
|
2685
|
+
value: { cursor: decodedInput.cursor }
|
|
2567
2686
|
},
|
|
2568
2687
|
method: "POST",
|
|
2569
2688
|
path: "/v2/files/search/continue",
|
|
2570
|
-
query
|
|
2571
|
-
}).pipe(withOperationErrors(SearchFilesErrorSpec));
|
|
2689
|
+
query: decodedInput.query
|
|
2690
|
+
})).pipe(withOperationErrors(SearchFilesErrorSpec));
|
|
2572
2691
|
const setFileSort = (input) => Schema.decodeUnknownEffect(FileSetSortInputSchema)(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(OkResponseSchema, {
|
|
2573
2692
|
body: {
|
|
2574
2693
|
type: "form",
|
|
@@ -2584,203 +2703,263 @@ const resetFileSortSettings = () => requestJson(OkResponseSchema, {
|
|
|
2584
2703
|
method: "POST",
|
|
2585
2704
|
path: "/v2/files/remove-sort-by-settings"
|
|
2586
2705
|
}).pipe(Effect.asVoid);
|
|
2587
|
-
const createFolder = (input) => requestJson(FileEnvelopeSchema, {
|
|
2706
|
+
const createFolder = (input) => decodeAndRun(FileCreateFolderInputSchema, input, (decodedInput) => requestJson(FileEnvelopeSchema, {
|
|
2588
2707
|
body: {
|
|
2589
2708
|
type: "form",
|
|
2590
|
-
value:
|
|
2709
|
+
value: decodedInput
|
|
2591
2710
|
},
|
|
2592
2711
|
method: "POST",
|
|
2593
2712
|
path: "/v2/files/create-folder"
|
|
2594
|
-
}).pipe(selectJsonField("file"), withOperationErrors(CreateFolderErrorSpec));
|
|
2595
|
-
const renameFile = (input) => requestJson(OkResponseSchema, {
|
|
2713
|
+
})).pipe(selectJsonField("file"), withOperationErrors(CreateFolderErrorSpec));
|
|
2714
|
+
const renameFile = (input) => decodeAndRun(FileRenameInputSchema, input, (decodedInput) => requestJson(OkResponseSchema, {
|
|
2596
2715
|
body: {
|
|
2597
2716
|
type: "form",
|
|
2598
|
-
value:
|
|
2717
|
+
value: decodedInput
|
|
2599
2718
|
},
|
|
2600
2719
|
method: "POST",
|
|
2601
2720
|
path: "/v2/files/rename"
|
|
2602
|
-
}).pipe(withOperationErrors(RenameFileErrorSpec));
|
|
2603
|
-
const deleteFiles = (ids, options = {}) =>
|
|
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, {
|
|
2604
2729
|
body: {
|
|
2605
2730
|
type: "form",
|
|
2606
|
-
value: { file_ids: joinCsv(ids) }
|
|
2731
|
+
value: { file_ids: joinCsv(decodedInput.ids) }
|
|
2607
2732
|
},
|
|
2608
2733
|
method: "POST",
|
|
2609
2734
|
path: "/v2/files/delete",
|
|
2610
2735
|
query: {
|
|
2611
|
-
partial_delete: options.partialDelete,
|
|
2736
|
+
partial_delete: decodedInput.options.partialDelete,
|
|
2612
2737
|
skip_nonexistents: true,
|
|
2613
|
-
skip_owner_check: options.ignoreFileOwner,
|
|
2614
|
-
skip_trash: options.skipTrash
|
|
2738
|
+
skip_owner_check: decodedInput.options.ignoreFileOwner,
|
|
2739
|
+
skip_trash: decodedInput.options.skipTrash
|
|
2615
2740
|
}
|
|
2616
|
-
});
|
|
2617
|
-
const deleteFileSelection = (selection, options = {}) =>
|
|
2741
|
+
}));
|
|
2742
|
+
const deleteFileSelection = (selection, options = {}) => decodeAndRun(Schema.Struct({
|
|
2743
|
+
options: FilesSelectionDeleteOptionsSchema,
|
|
2744
|
+
selection: FilesBulkSelectionSchema
|
|
2745
|
+
}), {
|
|
2746
|
+
options,
|
|
2747
|
+
selection
|
|
2748
|
+
}, (decodedInput) => requestJson(FileDeleteResultEnvelopeSchema, {
|
|
2618
2749
|
body: {
|
|
2619
2750
|
type: "form",
|
|
2620
|
-
value: toCursorSelectionForm(selection)
|
|
2751
|
+
value: toCursorSelectionForm(decodedInput.selection)
|
|
2621
2752
|
},
|
|
2622
2753
|
method: "POST",
|
|
2623
2754
|
path: "/v2/files/delete",
|
|
2624
2755
|
query: {
|
|
2625
|
-
partial_delete: options.partialDelete,
|
|
2756
|
+
partial_delete: decodedInput.options.partialDelete,
|
|
2626
2757
|
skip_nonexistents: true,
|
|
2627
|
-
skip_trash: options.skipTrash
|
|
2758
|
+
skip_trash: decodedInput.options.skipTrash
|
|
2628
2759
|
}
|
|
2629
|
-
});
|
|
2630
|
-
const moveFiles = (ids, parentId) =>
|
|
2760
|
+
}));
|
|
2761
|
+
const moveFiles = (ids, parentId) => decodeAndRun(FilesMoveInputSchema, {
|
|
2762
|
+
ids,
|
|
2763
|
+
parentId
|
|
2764
|
+
}, (decodedInput) => requestJson(FilesMoveEnvelopeSchema, {
|
|
2631
2765
|
body: {
|
|
2632
2766
|
type: "form",
|
|
2633
2767
|
value: {
|
|
2634
|
-
file_ids: joinCsv(ids),
|
|
2635
|
-
parent_id: parentId
|
|
2768
|
+
file_ids: joinCsv(decodedInput.ids),
|
|
2769
|
+
parent_id: decodedInput.parentId
|
|
2636
2770
|
}
|
|
2637
2771
|
},
|
|
2638
2772
|
method: "POST",
|
|
2639
2773
|
path: "/v2/files/move"
|
|
2640
|
-
}).pipe(selectJsonField("errors"));
|
|
2641
|
-
const moveFileSelection = (selection, parentId) =>
|
|
2774
|
+
})).pipe(selectJsonField("errors"));
|
|
2775
|
+
const moveFileSelection = (selection, parentId) => decodeAndRun(FilesMoveSelectionInputSchema, {
|
|
2776
|
+
parentId,
|
|
2777
|
+
selection
|
|
2778
|
+
}, (decodedInput) => requestJson(FilesMoveEnvelopeSchema, {
|
|
2642
2779
|
body: {
|
|
2643
2780
|
type: "form",
|
|
2644
2781
|
value: {
|
|
2645
|
-
...toCursorSelectionForm(selection),
|
|
2646
|
-
parent_id: parentId
|
|
2782
|
+
...toCursorSelectionForm(decodedInput.selection),
|
|
2783
|
+
parent_id: decodedInput.parentId
|
|
2647
2784
|
}
|
|
2648
2785
|
},
|
|
2649
2786
|
method: "POST",
|
|
2650
2787
|
path: "/v2/files/move"
|
|
2651
|
-
}).pipe(selectJsonField("errors"));
|
|
2652
|
-
const getStartFrom = (fileId) => requestJson(FileStartFromEnvelopeSchema, {
|
|
2788
|
+
})).pipe(selectJsonField("errors"));
|
|
2789
|
+
const getStartFrom = (fileId) => decodeAndRun(PositiveFileIdSchema, fileId, (decodedFileId) => requestJson(FileStartFromEnvelopeSchema, {
|
|
2653
2790
|
method: "GET",
|
|
2654
|
-
path: `/v2/files/${encodePathSegment(
|
|
2655
|
-
}).pipe(selectJsonField("start_from"), withOperationErrors(StartFromErrorSpec));
|
|
2656
|
-
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, {
|
|
2657
2794
|
method: "GET",
|
|
2658
|
-
path: `/v2/files/${encodePathSegment(
|
|
2659
|
-
}).pipe(selectJsonField("url"), withOperationErrors(DownloadUrlErrorSpec));
|
|
2660
|
-
const getApiDownloadUrl = (fileId, options = {}) =>
|
|
2661
|
-
|
|
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,
|
|
2662
2805
|
oauthToken
|
|
2663
|
-
})));
|
|
2664
|
-
const getApiContentUrl = (fileId, options = {}) =>
|
|
2665
|
-
|
|
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,
|
|
2666
2815
|
oauthToken
|
|
2667
|
-
})));
|
|
2668
|
-
const getApiMp4DownloadUrl = (fileId, options = {}) =>
|
|
2669
|
-
|
|
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,
|
|
2670
2825
|
oauthToken
|
|
2671
|
-
})));
|
|
2672
|
-
const getHlsStreamUrl = (fileId, options = {}) =>
|
|
2673
|
-
|
|
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,
|
|
2674
2835
|
oauthToken
|
|
2675
|
-
})));
|
|
2676
|
-
const listFileSubtitles = (fileId, options = {}) =>
|
|
2836
|
+
}))));
|
|
2837
|
+
const listFileSubtitles = (fileId, options = {}) => decodeAndRun(FileSubtitlesInputSchema, {
|
|
2838
|
+
fileId,
|
|
2839
|
+
options
|
|
2840
|
+
}, (decodedInput) => requestJson(FileSubtitlesEnvelopeSchema, {
|
|
2677
2841
|
method: "GET",
|
|
2678
|
-
path: `/v2/files/${encodePathSegment(fileId)}/subtitles`,
|
|
2679
|
-
query: options.languages ? { languages: joinCsv(options.languages) } : void 0
|
|
2680
|
-
}).pipe(withOperationErrors(FileSubtitlesErrorSpec));
|
|
2681
|
-
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, {
|
|
2682
2846
|
body: {
|
|
2683
2847
|
type: "form",
|
|
2684
|
-
value: { time:
|
|
2848
|
+
value: { time: decodedInput.time }
|
|
2685
2849
|
},
|
|
2686
2850
|
method: "POST",
|
|
2687
|
-
path: `/v2/files/${encodePathSegment(
|
|
2688
|
-
}).pipe(withOperationErrors(StartFromErrorSpec));
|
|
2689
|
-
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, {
|
|
2690
2854
|
method: "POST",
|
|
2691
|
-
path: `/v2/files/${encodePathSegment(
|
|
2692
|
-
}).pipe(withOperationErrors(StartFromErrorSpec));
|
|
2693
|
-
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, {
|
|
2694
2858
|
method: "GET",
|
|
2695
|
-
path: `/v2/files/${encodePathSegment(
|
|
2696
|
-
}).pipe(selectJsonField("mp4"), withOperationErrors(FileMp4ErrorSpec));
|
|
2697
|
-
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, {
|
|
2698
2862
|
method: "POST",
|
|
2699
|
-
path: `/v2/files/${encodePathSegment(
|
|
2700
|
-
}).pipe(selectJsonField("mp4"), withOperationErrors(FileMp4ErrorSpec));
|
|
2701
|
-
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({
|
|
2702
2866
|
method: "DELETE",
|
|
2703
|
-
path: `/v2/files/${encodePathSegment(
|
|
2704
|
-
}).pipe(withOperationErrors(FileMp4MutationErrorSpec));
|
|
2705
|
-
const putMp4ToMyFiles = (fileId) => requestVoid({
|
|
2867
|
+
path: `/v2/files/${encodePathSegment(decodedFileId)}/mp4`
|
|
2868
|
+
})).pipe(withOperationErrors(FileMp4MutationErrorSpec));
|
|
2869
|
+
const putMp4ToMyFiles = (fileId) => decodeAndRun(PositiveFileIdSchema, fileId, (decodedFileId) => requestVoid({
|
|
2706
2870
|
method: "GET",
|
|
2707
|
-
path: `/v2/files/${encodePathSegment(
|
|
2708
|
-
}).pipe(withOperationErrors(FileMp4MutationErrorSpec));
|
|
2709
|
-
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, {
|
|
2710
2874
|
body: {
|
|
2711
2875
|
type: "form",
|
|
2712
|
-
value: { file_ids: joinCsv(
|
|
2876
|
+
value: { file_ids: joinCsv(decodedIds) }
|
|
2713
2877
|
},
|
|
2714
2878
|
method: "POST",
|
|
2715
2879
|
path: "/v2/files/convert_mp4"
|
|
2716
|
-
}).pipe(selectJsonField("count"));
|
|
2717
|
-
const convertFileSelectionToMp4 = (selection) => requestJson(FilesBulkConvertEnvelopeSchema, {
|
|
2880
|
+
})).pipe(selectJsonField("count"));
|
|
2881
|
+
const convertFileSelectionToMp4 = (selection) => decodeAndRun(FilesBulkSelectionSchema, selection, (decodedSelection) => requestJson(FilesBulkConvertEnvelopeSchema, {
|
|
2718
2882
|
body: {
|
|
2719
2883
|
type: "form",
|
|
2720
|
-
value: toCursorSelectionForm(
|
|
2884
|
+
value: toCursorSelectionForm(decodedSelection)
|
|
2721
2885
|
},
|
|
2722
2886
|
method: "POST",
|
|
2723
2887
|
path: "/v2/files/convert_mp4"
|
|
2724
|
-
}).pipe(selectJsonField("count"));
|
|
2888
|
+
})).pipe(selectJsonField("count"));
|
|
2725
2889
|
const listActiveMp4Conversions = () => requestJson(FileActiveConversionsEnvelopeSchema, {
|
|
2726
2890
|
method: "GET",
|
|
2727
2891
|
path: "/v2/mp4/queue"
|
|
2728
2892
|
}).pipe(selectJsonField("mp4s"), withOperationErrors(FileActiveConversionsErrorSpec));
|
|
2729
|
-
const setFilesWatchStatus = (selection) => requestVoid({
|
|
2893
|
+
const setFilesWatchStatus = (selection) => decodeAndRun(FilesWatchStatusInputSchema, selection, (decodedSelection) => requestVoid({
|
|
2730
2894
|
body: {
|
|
2731
2895
|
type: "form",
|
|
2732
2896
|
value: {
|
|
2733
|
-
...toCursorSelectionForm(
|
|
2734
|
-
watched:
|
|
2897
|
+
...toCursorSelectionForm(decodedSelection),
|
|
2898
|
+
watched: decodedSelection.watched
|
|
2735
2899
|
}
|
|
2736
2900
|
},
|
|
2737
2901
|
method: "POST",
|
|
2738
2902
|
path: "/v2/files/watch-status"
|
|
2739
|
-
}).pipe(withOperationErrors(FileWatchStatusErrorSpec));
|
|
2740
|
-
const extractFiles = (selection) => requestJson(FileExtractionsEnvelopeSchema, {
|
|
2903
|
+
})).pipe(withOperationErrors(FileWatchStatusErrorSpec));
|
|
2904
|
+
const extractFiles = (selection) => decodeAndRun(FilesExtractInputSchema, selection, (decodedSelection) => requestJson(FileExtractionsEnvelopeSchema, {
|
|
2741
2905
|
body: {
|
|
2742
2906
|
type: "form",
|
|
2743
2907
|
value: {
|
|
2744
|
-
...toCursorSelectionForm(
|
|
2745
|
-
password:
|
|
2908
|
+
...toCursorSelectionForm(decodedSelection, "user_file_ids"),
|
|
2909
|
+
password: decodedSelection.password
|
|
2746
2910
|
}
|
|
2747
2911
|
},
|
|
2748
2912
|
method: "POST",
|
|
2749
2913
|
path: "/v2/files/extract"
|
|
2750
|
-
}).pipe(selectJsonField("extractions"), withOperationErrors(FileExtractionsErrorSpec));
|
|
2914
|
+
})).pipe(selectJsonField("extractions"), withOperationErrors(FileExtractionsErrorSpec));
|
|
2751
2915
|
const listFileExtractions = () => requestJson(FileExtractionsEnvelopeSchema, {
|
|
2752
2916
|
method: "GET",
|
|
2753
2917
|
path: "/v2/files/extract"
|
|
2754
2918
|
}).pipe(selectJsonField("extractions"), withOperationErrors(FileExtractionsErrorSpec));
|
|
2755
|
-
const deleteFileExtraction = (extractionId) => requestVoid({
|
|
2919
|
+
const deleteFileExtraction = (extractionId) => decodeAndRun(PositiveIntegerSchema, extractionId, (decodedExtractionId) => requestVoid({
|
|
2756
2920
|
method: "DELETE",
|
|
2757
|
-
path: `/v2/files/extract/${encodePathSegment(
|
|
2758
|
-
});
|
|
2759
|
-
const findNextFile = (fileId, fileType) =>
|
|
2921
|
+
path: `/v2/files/extract/${encodePathSegment(decodedExtractionId)}`
|
|
2922
|
+
}));
|
|
2923
|
+
const findNextFile = (fileId, fileType) => decodeAndRun(FileNextInputSchema, {
|
|
2924
|
+
fileId,
|
|
2925
|
+
fileType
|
|
2926
|
+
}, (decodedInput) => requestJson(FilesNextFileEnvelopeSchema, {
|
|
2760
2927
|
method: "GET",
|
|
2761
|
-
path: `/v2/files/${encodePathSegment(fileId)}/next-file`,
|
|
2762
|
-
query: { file_type: fileType }
|
|
2763
|
-
}).pipe(selectJsonField("next_file"));
|
|
2764
|
-
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, {
|
|
2765
2932
|
method: "GET",
|
|
2766
|
-
path: `/v2/files/${encodePathSegment(
|
|
2767
|
-
}).pipe(selectJsonField("next_video"));
|
|
2768
|
-
const createFileUploadRequest = (input, options = {}) =>
|
|
2769
|
-
|
|
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),
|
|
2770
2943
|
method: "POST",
|
|
2771
2944
|
url: buildPutioUrl(config.uploadBaseUrl ?? "https://upload.put.io", "/v2/files/upload", { oauth_token: oauthToken })
|
|
2772
|
-
})));
|
|
2773
|
-
const uploadFile = (input, options = {}) =>
|
|
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, {
|
|
2774
2953
|
auth: { type: "none" },
|
|
2775
2954
|
baseUrl: config.uploadBaseUrl ?? "https://upload.put.io",
|
|
2776
2955
|
body: {
|
|
2777
2956
|
type: "form-data",
|
|
2778
|
-
value: createFileUploadFormData(input)
|
|
2957
|
+
value: createFileUploadFormData(decoded.input)
|
|
2779
2958
|
},
|
|
2780
2959
|
method: "POST",
|
|
2781
2960
|
path: "/v2/files/upload",
|
|
2782
2961
|
query: { oauth_token: oauthToken }
|
|
2783
|
-
}))
|
|
2962
|
+
})))).pipe(Effect.map(toUploadResult), withOperationErrors(FileUploadErrorSpec));
|
|
2784
2963
|
//#endregion
|
|
2785
2964
|
//#region src/domains/friend-invites.ts
|
|
2786
2965
|
const FriendInviteJoinedUserStatusSchema = Schema.Literals([
|
|
@@ -3291,6 +3470,23 @@ const PaymentOpenNodeChargeEnvelopeSchema = Schema.Struct({
|
|
|
3291
3470
|
opennode: Schema.Struct({ checkout_url: Schema.String }),
|
|
3292
3471
|
status: Schema.Literal("OK")
|
|
3293
3472
|
});
|
|
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
|
|
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));
|
|
3294
3490
|
const RestrictedPaymentError = {
|
|
3295
3491
|
errorType: "invalid_scope",
|
|
3296
3492
|
statusCode: 401
|
|
@@ -3603,83 +3799,83 @@ const listPaymentOptions = () => requestJson(PaymentOptionsEnvelopeSchema, {
|
|
|
3603
3799
|
method: "GET",
|
|
3604
3800
|
path: "/v2/payment/options"
|
|
3605
3801
|
}).pipe(selectJsonField("options"), withOperationErrors(ListPaymentOptionsErrorSpec));
|
|
3606
|
-
const listPaymentHistory = (query) => requestJson(PaymentHistoryEnvelopeSchema, {
|
|
3802
|
+
const listPaymentHistory = (query = {}) => decodeAndRun(PaymentHistoryQuerySchema, query, (decodedQuery) => requestJson(PaymentHistoryEnvelopeSchema, {
|
|
3607
3803
|
method: "GET",
|
|
3608
3804
|
path: "/v2/payment/history",
|
|
3609
|
-
query
|
|
3610
|
-
}).pipe(selectJsonField("payments")
|
|
3805
|
+
query: decodedQuery
|
|
3806
|
+
}).pipe(selectJsonField("payments"))).pipe(withOperationErrors(ListPaymentHistoryErrorSpec));
|
|
3611
3807
|
const listPaymentInvites = () => requestJson(PaymentInvitesEnvelopeSchema, {
|
|
3612
3808
|
method: "GET",
|
|
3613
3809
|
path: "/v2/payment/invites"
|
|
3614
3810
|
}).pipe(selectJsonField("vouchers"), withOperationErrors(ListPaymentInvitesErrorSpec));
|
|
3615
|
-
const previewPaymentChangePlan = (input) => requestJson(PaymentChangePlanPreviewSchema, {
|
|
3811
|
+
const previewPaymentChangePlan = (input) => decodeAndRun(PaymentChangePlanPreviewInputSchema, input, (decodedInput) => requestJson(PaymentChangePlanPreviewSchema, {
|
|
3616
3812
|
method: "GET",
|
|
3617
|
-
path: `/v2/payment/change_plan/${encodeURIComponent(
|
|
3813
|
+
path: `/v2/payment/change_plan/${encodeURIComponent(decodedInput.plan_path)}`,
|
|
3618
3814
|
query: {
|
|
3619
|
-
coupon_code:
|
|
3620
|
-
payment_type:
|
|
3815
|
+
coupon_code: decodedInput.coupon_code,
|
|
3816
|
+
payment_type: decodedInput.payment_type
|
|
3621
3817
|
}
|
|
3622
|
-
}).pipe(withOperationErrors(PreviewPaymentChangePlanErrorSpec));
|
|
3623
|
-
const submitPaymentChangePlan = (input) => requestJson(PaymentChangePlanSubmitSchema, {
|
|
3818
|
+
})).pipe(withOperationErrors(PreviewPaymentChangePlanErrorSpec));
|
|
3819
|
+
const submitPaymentChangePlan = (input) => decodeAndRun(PaymentChangePlanSubmitInputSchema, input, (decodedInput) => requestJson(PaymentChangePlanSubmitSchema, {
|
|
3624
3820
|
body: {
|
|
3625
3821
|
type: "form",
|
|
3626
3822
|
value: {
|
|
3627
|
-
confirmation_code:
|
|
3628
|
-
payment_type:
|
|
3823
|
+
confirmation_code: decodedInput.confirmation_code,
|
|
3824
|
+
payment_type: decodedInput.payment_type
|
|
3629
3825
|
}
|
|
3630
3826
|
},
|
|
3631
3827
|
method: "POST",
|
|
3632
|
-
path: `/v2/payment/change_plan/${encodeURIComponent(
|
|
3633
|
-
query: { coupon_code:
|
|
3634
|
-
}).pipe(withOperationErrors(SubmitPaymentChangePlanErrorSpec));
|
|
3635
|
-
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, {
|
|
3636
3832
|
method: "GET",
|
|
3637
|
-
path: `/v2/payment/fs-confirm/${encodeURIComponent(
|
|
3638
|
-
}).pipe(selectJsonField("confirmed")
|
|
3833
|
+
path: `/v2/payment/fs-confirm/${encodeURIComponent(decodedReference)}`
|
|
3834
|
+
}).pipe(selectJsonField("confirmed"))).pipe(withOperationErrors(ConfirmFastspringOrderErrorSpec));
|
|
3639
3835
|
const stopPaymentSubscription = () => requestJson(OkResponseSchema, {
|
|
3640
3836
|
method: "POST",
|
|
3641
3837
|
path: "/v2/payment/stop_subscription"
|
|
3642
3838
|
}).pipe(Effect.asVoid, withOperationErrors(StopSubscriptionErrorSpec));
|
|
3643
|
-
const getPaymentVoucherInfo = (code) => requestJson(PaymentVoucherInfoSchema, {
|
|
3839
|
+
const getPaymentVoucherInfo = (code) => decodeAndRun(NonEmptyStringSchema, code, (decodedCode) => requestJson(PaymentVoucherInfoSchema, {
|
|
3644
3840
|
method: "GET",
|
|
3645
|
-
path: `/v2/payment/redeem_voucher/${encodeURIComponent(
|
|
3646
|
-
}).pipe(withOperationErrors(GetPaymentVoucherInfoErrorSpec));
|
|
3647
|
-
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, {
|
|
3648
3844
|
method: "POST",
|
|
3649
|
-
path: `/v2/payment/redeem_voucher/${encodeURIComponent(
|
|
3650
|
-
}).pipe(Effect.asVoid, withOperationErrors(RedeemPaymentVoucherErrorSpec));
|
|
3651
|
-
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, {
|
|
3652
3848
|
body: {
|
|
3653
3849
|
type: "form",
|
|
3654
|
-
value: { payment_ids: joinCsv(
|
|
3850
|
+
value: { payment_ids: joinCsv(decodedPaymentIds) }
|
|
3655
3851
|
},
|
|
3656
3852
|
method: "POST",
|
|
3657
3853
|
path: "/v2/payment/report"
|
|
3658
|
-
}).pipe(Effect.asVoid, withOperationErrors(ReportPaymentsErrorSpec));
|
|
3659
|
-
const createPaddleWaitingPayment = (input) => requestJson(OkResponseSchema, {
|
|
3854
|
+
})).pipe(Effect.asVoid, withOperationErrors(ReportPaymentsErrorSpec));
|
|
3855
|
+
const createPaddleWaitingPayment = (input) => decodeAndRun(PaymentPaddleWaitingPaymentInputSchema, input, (decodedInput) => requestJson(OkResponseSchema, {
|
|
3660
3856
|
body: {
|
|
3661
3857
|
type: "form",
|
|
3662
|
-
value:
|
|
3858
|
+
value: decodedInput
|
|
3663
3859
|
},
|
|
3664
3860
|
method: "POST",
|
|
3665
3861
|
path: "/v2/payment/paddle_waiting_payment"
|
|
3666
|
-
}).pipe(Effect.asVoid, withOperationErrors(CreatePaddleWaitingPaymentErrorSpec));
|
|
3667
|
-
const getPaddleBillingInvoiceUrl = (paymentId) => requestJson(PaymentPaddleBillingInvoiceEnvelopeSchema, {
|
|
3862
|
+
})).pipe(Effect.asVoid, withOperationErrors(CreatePaddleWaitingPaymentErrorSpec));
|
|
3863
|
+
const getPaddleBillingInvoiceUrl = (paymentId) => decodeAndRun(PositiveIntegerSchema, paymentId, (decodedPaymentId) => requestJson(PaymentPaddleBillingInvoiceEnvelopeSchema, {
|
|
3668
3864
|
method: "GET",
|
|
3669
|
-
path: `/v2/payment/methods/paddle_billing/invoice/${encodeURIComponent(
|
|
3670
|
-
}).pipe(selectJsonField("url")
|
|
3671
|
-
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, {
|
|
3672
3868
|
method: "GET",
|
|
3673
|
-
path: `/v2/payment/methods/paddle_billing/update_payment_method/${encodeURIComponent(
|
|
3674
|
-
}).pipe(selectJsonField("transaction_id")
|
|
3675
|
-
const createOpenNodeCharge = (planPath) => requestJson(PaymentOpenNodeChargeEnvelopeSchema, {
|
|
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, {
|
|
3676
3872
|
body: {
|
|
3677
3873
|
type: "form",
|
|
3678
|
-
value: { plan_fs_path:
|
|
3874
|
+
value: { plan_fs_path: decodedPlanPath }
|
|
3679
3875
|
},
|
|
3680
3876
|
method: "POST",
|
|
3681
3877
|
path: "/v2/payment/methods/opennode/charge"
|
|
3682
|
-
}).pipe(selectJsonField("opennode"), Effect.map(({ checkout_url }) => checkout_url)
|
|
3878
|
+
}).pipe(selectJsonField("opennode"), Effect.map(({ checkout_url }) => checkout_url))).pipe(withOperationErrors(CreateOpenNodeChargeErrorSpec));
|
|
3683
3879
|
//#endregion
|
|
3684
3880
|
//#region src/domains/podcast.ts
|
|
3685
3881
|
const PodcastLinkTypeSchema = Schema.Literals([
|
|
@@ -4609,7 +4805,7 @@ const emptyTrash = () => requestJson(OkResponseSchema, {
|
|
|
4609
4805
|
}).pipe(Effect.asVoid, withOperationErrors(EmptyTrashErrorSpec));
|
|
4610
4806
|
//#endregion
|
|
4611
4807
|
//#region src/domains/transfers.ts
|
|
4612
|
-
const TransferIdSchema =
|
|
4808
|
+
const TransferIdSchema = PositiveIntegerSchema;
|
|
4613
4809
|
const TransferIdsSchema = Schema.Array(TransferIdSchema).check(Schema.isMinLength(1));
|
|
4614
4810
|
const TransferTypeSchema = Schema.Literals([
|
|
4615
4811
|
"URL",
|
|
@@ -4705,12 +4901,20 @@ const TransferSchema = Schema.Union([
|
|
|
4705
4901
|
TransferCompletedSchema,
|
|
4706
4902
|
TransferBaseSchema
|
|
4707
4903
|
]);
|
|
4708
|
-
const TransfersListQuerySchema = Schema.Struct({ per_page: Schema.optional(
|
|
4904
|
+
const TransfersListQuerySchema = Schema.Struct({ per_page: Schema.optional(PositiveIntegerSchema) });
|
|
4709
4905
|
const TransferAddInputSchema = Schema.Struct({
|
|
4710
|
-
callback_url: Schema.optional(
|
|
4711
|
-
save_parent_id: Schema.optional(Schema.Int),
|
|
4712
|
-
url:
|
|
4906
|
+
callback_url: Schema.optional(NonEmptyStringSchema),
|
|
4907
|
+
save_parent_id: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
|
|
4908
|
+
url: NonEmptyStringSchema
|
|
4713
4909
|
});
|
|
4910
|
+
const TransferContinueInputSchema = Schema.Struct({
|
|
4911
|
+
cursor: NonEmptyStringSchema,
|
|
4912
|
+
query: TransfersListQuerySchema
|
|
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);
|
|
4714
4918
|
const TrackerSchema = Schema.String.check(Schema.isPattern(/^[^,\s]+$/));
|
|
4715
4919
|
const TransferAddTrackersInputSchema = Schema.Struct({
|
|
4716
4920
|
trackers: Schema.Array(TrackerSchema).check(Schema.isMinLength(1)),
|
|
@@ -4931,112 +5135,115 @@ const StopRecordingTransferErrorSpec = definePutioOperationErrorSpec({
|
|
|
4931
5135
|
{ statusCode: 404 }
|
|
4932
5136
|
]
|
|
4933
5137
|
});
|
|
4934
|
-
const listTransfers = (query = {}) => requestJson(TransfersListEnvelopeSchema, {
|
|
5138
|
+
const listTransfers = (query = {}) => decodeAndRun(TransfersListQuerySchema, query, (decodedQuery) => requestJson(TransfersListEnvelopeSchema, {
|
|
4935
5139
|
method: "GET",
|
|
4936
5140
|
path: "/v2/transfers/list",
|
|
5141
|
+
query: decodedQuery
|
|
5142
|
+
})).pipe(withOperationErrors(ListTransfersErrorSpec));
|
|
5143
|
+
const continueTransfers = (cursor, query = {}) => decodeAndRun(TransferContinueInputSchema, {
|
|
5144
|
+
cursor,
|
|
4937
5145
|
query
|
|
4938
|
-
})
|
|
4939
|
-
const continueTransfers = (cursor, query = {}) => requestJson(TransfersContinueEnvelopeSchema, {
|
|
5146
|
+
}, (decodedInput) => requestJson(TransfersContinueEnvelopeSchema, {
|
|
4940
5147
|
body: {
|
|
4941
5148
|
type: "form",
|
|
4942
|
-
value: { cursor }
|
|
5149
|
+
value: { cursor: decodedInput.cursor }
|
|
4943
5150
|
},
|
|
4944
5151
|
method: "POST",
|
|
4945
5152
|
path: "/v2/transfers/list/continue",
|
|
4946
|
-
query
|
|
4947
|
-
}).pipe(withOperationErrors(ListTransfersErrorSpec));
|
|
4948
|
-
const getTransfer = (id) => requestJson(TransferEnvelopeSchema, {
|
|
5153
|
+
query: decodedInput.query
|
|
5154
|
+
})).pipe(withOperationErrors(ListTransfersErrorSpec));
|
|
5155
|
+
const getTransfer = (id) => decodeAndRun(TransferIdSchema, id, (decodedId) => requestJson(TransferEnvelopeSchema, {
|
|
4949
5156
|
method: "GET",
|
|
4950
|
-
path: `/v2/transfers/${encodePathSegment(
|
|
4951
|
-
}).pipe(selectJsonField("transfer")
|
|
4952
|
-
const getTransferTorrent = (id) =>
|
|
5157
|
+
path: `/v2/transfers/${encodePathSegment(decodedId)}`
|
|
5158
|
+
}).pipe(selectJsonField("transfer"))).pipe(withOperationErrors(GetTransferErrorSpec));
|
|
5159
|
+
const getTransferTorrent = (id) => decodeAndRun(TransferIdSchema, id, (decodedId) => requestArrayBuffer({
|
|
4953
5160
|
method: "GET",
|
|
4954
5161
|
path: `/v2/transfers/${encodePathSegment(decodedId)}/torrent`
|
|
4955
|
-
}))
|
|
5162
|
+
})).pipe(withOperationErrors(GetTransferTorrentErrorSpec));
|
|
4956
5163
|
const countTransfers = () => requestJson(TransferCountEnvelopeSchema, {
|
|
4957
5164
|
method: "GET",
|
|
4958
5165
|
path: "/v2/transfers/count"
|
|
4959
5166
|
}).pipe(selectJsonField("count"));
|
|
4960
|
-
const getTransferInfo = (urls) => requestJson(TransferInfoEnvelopeSchema, {
|
|
5167
|
+
const getTransferInfo = (urls) => decodeAndRun(TransferInfoUrlsSchema, urls, (decodedUrls) => requestJson(TransferInfoEnvelopeSchema, {
|
|
4961
5168
|
body: {
|
|
4962
5169
|
type: "form",
|
|
4963
|
-
value: { urls:
|
|
5170
|
+
value: { urls: decodedUrls.join("\n") }
|
|
4964
5171
|
},
|
|
4965
5172
|
method: "POST",
|
|
4966
5173
|
path: "/v2/transfers/info"
|
|
4967
|
-
}).pipe(selectJsonFields("disk_avail", "ret"));
|
|
4968
|
-
const addTransfer = (input) => requestJson(TransferEnvelopeSchema, {
|
|
5174
|
+
}).pipe(selectJsonFields("disk_avail", "ret")));
|
|
5175
|
+
const addTransfer = (input) => decodeAndRun(TransferAddInputSchema, input, (decodedInput) => requestJson(TransferEnvelopeSchema, {
|
|
4969
5176
|
body: {
|
|
4970
5177
|
type: "form",
|
|
4971
|
-
value:
|
|
5178
|
+
value: decodedInput
|
|
4972
5179
|
},
|
|
4973
5180
|
method: "POST",
|
|
4974
5181
|
path: "/v2/transfers/add"
|
|
4975
|
-
}).pipe(selectJsonField("transfer")
|
|
4976
|
-
const addManyTransfers = (inputs) => requestJson(TransfersAddMultiEnvelopeSchema, {
|
|
5182
|
+
}).pipe(selectJsonField("transfer"))).pipe(withOperationErrors(AddTransferErrorSpec));
|
|
5183
|
+
const addManyTransfers = (inputs) => decodeAndRun(TransferAddManyInputSchema, inputs, (decodedInputs) => requestJson(TransfersAddMultiEnvelopeSchema, {
|
|
4977
5184
|
body: {
|
|
4978
5185
|
type: "form",
|
|
4979
|
-
value: { urls: JSON.stringify(
|
|
5186
|
+
value: { urls: JSON.stringify(decodedInputs) }
|
|
4980
5187
|
},
|
|
4981
5188
|
method: "POST",
|
|
4982
5189
|
path: "/v2/transfers/add-multi"
|
|
4983
|
-
}).pipe(selectJsonFields("errors", "transfers")
|
|
4984
|
-
const addTransferTrackers = (input) =>
|
|
5190
|
+
}).pipe(selectJsonFields("errors", "transfers"))).pipe(withOperationErrors(AddManyTransfersErrorSpec));
|
|
5191
|
+
const addTransferTrackers = (input) => decodeAndRun(TransferAddTrackersInputSchema, input, (decodedInput) => requestJson(OkResponseSchema, {
|
|
4985
5192
|
body: {
|
|
4986
5193
|
type: "form",
|
|
4987
5194
|
value: { trackers: joinCsv(decodedInput.trackers) }
|
|
4988
5195
|
},
|
|
4989
5196
|
method: "POST",
|
|
4990
5197
|
path: `/v2/transfers/add-trackers/${encodePathSegment(decodedInput.transferId)}`
|
|
4991
|
-
}))
|
|
4992
|
-
const cancelTransfers = (ids) => requestJson(OkResponseSchema, {
|
|
5198
|
+
})).pipe(Effect.asVoid, withOperationErrors(AddTransferTrackersErrorSpec));
|
|
5199
|
+
const cancelTransfers = (ids) => decodeAndRun(TransferIdsSchema, ids, (decodedIds) => requestJson(OkResponseSchema, {
|
|
4993
5200
|
body: {
|
|
4994
5201
|
type: "form",
|
|
4995
|
-
value: { transfer_ids: joinCsv(
|
|
5202
|
+
value: { transfer_ids: joinCsv(decodedIds) }
|
|
4996
5203
|
},
|
|
4997
5204
|
method: "POST",
|
|
4998
5205
|
path: "/v2/transfers/cancel"
|
|
4999
|
-
});
|
|
5000
|
-
const cleanTransfers = (ids = []) => requestJson(TransfersCleanEnvelopeSchema, {
|
|
5206
|
+
}));
|
|
5207
|
+
const cleanTransfers = (ids = []) => decodeAndRun(TransferCleanIdsSchema, ids, (decodedIds) => requestJson(TransfersCleanEnvelopeSchema, {
|
|
5001
5208
|
body: {
|
|
5002
5209
|
type: "form",
|
|
5003
|
-
value:
|
|
5210
|
+
value: decodedIds.length > 0 ? { transfer_ids: joinCsv(decodedIds) } : {}
|
|
5004
5211
|
},
|
|
5005
5212
|
method: "POST",
|
|
5006
5213
|
path: "/v2/transfers/clean"
|
|
5007
|
-
}).pipe(selectJsonFields("deleted_ids"));
|
|
5008
|
-
const removeTransfers = (input) =>
|
|
5214
|
+
}).pipe(selectJsonFields("deleted_ids")));
|
|
5215
|
+
const removeTransfers = (input) => decodeAndRun(TransferRemoveInputSchema, input, (decodedInput) => requestJson(OkResponseSchema, {
|
|
5009
5216
|
body: {
|
|
5010
5217
|
type: "form",
|
|
5011
5218
|
value: decodedInput.ids !== void 0 ? { transfer_ids: joinCsv(decodedInput.ids) } : { remove_filter: decodedInput.filter }
|
|
5012
5219
|
},
|
|
5013
5220
|
method: "POST",
|
|
5014
5221
|
path: "/v2/transfers/remove"
|
|
5015
|
-
}))
|
|
5016
|
-
const retryTransfer = (id) => requestJson(TransferEnvelopeSchema, {
|
|
5222
|
+
})).pipe(Effect.asVoid, withOperationErrors(RemoveTransfersErrorSpec));
|
|
5223
|
+
const retryTransfer = (id) => decodeAndRun(TransferIdSchema, id, (decodedId) => requestJson(TransferEnvelopeSchema, {
|
|
5017
5224
|
body: {
|
|
5018
5225
|
type: "form",
|
|
5019
|
-
value: { id }
|
|
5226
|
+
value: { id: decodedId }
|
|
5020
5227
|
},
|
|
5021
5228
|
method: "POST",
|
|
5022
5229
|
path: "/v2/transfers/retry"
|
|
5023
|
-
}).pipe(selectJsonField("transfer")
|
|
5024
|
-
const reannounceTransfer = (id) => requestJson(OkResponseSchema, {
|
|
5230
|
+
}).pipe(selectJsonField("transfer"))).pipe(withOperationErrors(RetryTransferErrorSpec));
|
|
5231
|
+
const reannounceTransfer = (id) => decodeAndRun(TransferIdSchema, id, (decodedId) => requestJson(OkResponseSchema, {
|
|
5025
5232
|
body: {
|
|
5026
5233
|
type: "form",
|
|
5027
|
-
value: { id }
|
|
5234
|
+
value: { id: decodedId }
|
|
5028
5235
|
},
|
|
5029
5236
|
method: "POST",
|
|
5030
5237
|
path: "/v2/transfers/reannounce"
|
|
5031
|
-
}).pipe(withOperationErrors(ReannounceTransferErrorSpec));
|
|
5032
|
-
const stopTransferRecording = (id) => requestJson(OkResponseSchema, {
|
|
5238
|
+
})).pipe(withOperationErrors(ReannounceTransferErrorSpec));
|
|
5239
|
+
const stopTransferRecording = (id) => decodeAndRun(TransferIdSchema, id, (decodedId) => requestJson(OkResponseSchema, {
|
|
5033
5240
|
body: {
|
|
5034
5241
|
type: "form",
|
|
5035
|
-
value: { transfer_id:
|
|
5242
|
+
value: { transfer_id: decodedId }
|
|
5036
5243
|
},
|
|
5037
5244
|
method: "POST",
|
|
5038
5245
|
path: "/v2/transfers/stop-recording"
|
|
5039
|
-
}).pipe(withOperationErrors(StopRecordingTransferErrorSpec));
|
|
5246
|
+
})).pipe(withOperationErrors(StopRecordingTransferErrorSpec));
|
|
5040
5247
|
//#endregion
|
|
5041
5248
|
//#region src/domains/tunnel.ts
|
|
5042
5249
|
const TunnelRouteSchema = Schema.Struct({
|
|
@@ -5109,7 +5316,7 @@ const ZipInfoSchema = Schema.Union([
|
|
|
5109
5316
|
ZipInfoErrorSchema,
|
|
5110
5317
|
ZipInfoDoneSchema
|
|
5111
5318
|
]);
|
|
5112
|
-
const CreateZipInputSchema = makeCursorSelectionSchema("file_ids", "exclude_ids");
|
|
5319
|
+
const CreateZipInputSchema = makeCursorSelectionSchema("file_ids", "exclude_ids", {});
|
|
5113
5320
|
const FilesReadScopeError = {
|
|
5114
5321
|
errorType: "invalid_scope",
|
|
5115
5322
|
statusCode: 401
|