(client, request3, options)
| 45216 | var url_js_1 = require_url(); |
| 45217 | var operations = __importStar(require_operations()); |
| 45218 | async function filesDownload(client, request3, options) { |
| 45219 | const parsed = (0, schemas_js_1.safeParse)(request3, (value) => operations.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(value), "Input validation failed"); |
| 45220 | if (!parsed.ok) { |
| 45221 | return parsed; |
| 45222 | } |
| 45223 | const payload = parsed.value; |
| 45224 | const body = null; |
| 45225 | const pathParams = { |
| 45226 | file_id: (0, encodings_js_1.encodeSimple)("file_id", payload.file_id, { |
| 45227 | explode: false, |
| 45228 | charEncoding: "percent" |
| 45229 | }) |
| 45230 | }; |
| 45231 | const path5 = (0, url_js_1.pathToFunc)("/v1/files/{file_id}/content")(pathParams); |
| 45232 | const headers = new Headers({ |
| 45233 | Accept: "application/octet-stream" |
| 45234 | }); |
| 45235 | const secConfig = await (0, security_js_1.extractSecurity)(client._options.apiKey); |
| 45236 | const securityInput = secConfig == null ? {} : { apiKey: secConfig }; |
| 45237 | const requestSecurity = (0, security_js_1.resolveGlobalSecurity)(securityInput); |
| 45238 | const context = { |
| 45239 | operationID: "files_api_routes_download_file", |
| 45240 | oAuth2Scopes: [], |
| 45241 | resolvedSecurity: requestSecurity, |
| 45242 | securitySource: client._options.apiKey, |
| 45243 | retryConfig: (options === null || options === void 0 ? void 0 : options.retries) || client._options.retryConfig || { strategy: "none" }, |
| 45244 | retryCodes: (options === null || options === void 0 ? void 0 : options.retryCodes) || ["429", "500", "502", "503", "504"] |
| 45245 | }; |
| 45246 | const requestRes = client._createRequest(context, { |
| 45247 | security: requestSecurity, |
| 45248 | method: "GET", |
| 45249 | path: path5, |
| 45250 | headers, |
| 45251 | body, |
| 45252 | timeoutMs: (options === null || options === void 0 ? void 0 : options.timeoutMs) || client._options.timeoutMs || -1 |
| 45253 | }, options); |
| 45254 | if (!requestRes.ok) { |
| 45255 | return requestRes; |
| 45256 | } |
| 45257 | const req = requestRes.value; |
| 45258 | const doResult = await client._do(req, { |
| 45259 | context, |
| 45260 | errorCodes: ["4XX", "5XX"], |
| 45261 | retryConfig: context.retryConfig, |
| 45262 | retryCodes: context.retryCodes |
| 45263 | }); |
| 45264 | if (!doResult.ok) { |
| 45265 | return doResult; |
| 45266 | } |
| 45267 | const response = doResult.value; |
| 45268 | const [result] = await M5.match(M5.stream(200, z6.instanceof(ReadableStream)), M5.fail(["4XX", "5XX"]))(response); |
| 45269 | if (!result.ok) { |
| 45270 | return result; |
| 45271 | } |
| 45272 | return result; |
| 45273 | } |
| 45274 | } |
| 45275 | }); |
nothing calls this directly
no test coverage detected
searching dependent graphs…