(client, request3, options)
| 44774 | var components = __importStar(require_components()); |
| 44775 | var errors = __importStar(require_errors2()); |
| 44776 | async function classifiersModerate(client, request3, options) { |
| 44777 | const parsed = (0, schemas_js_1.safeParse)(request3, (value) => components.ClassificationRequest$outboundSchema.parse(value), "Input validation failed"); |
| 44778 | if (!parsed.ok) { |
| 44779 | return parsed; |
| 44780 | } |
| 44781 | const payload = parsed.value; |
| 44782 | const body = (0, encodings_js_1.encodeJSON)("body", payload, { explode: true }); |
| 44783 | const path5 = (0, url_js_1.pathToFunc)("/v1/moderations")(); |
| 44784 | const headers = new Headers({ |
| 44785 | "Content-Type": "application/json", |
| 44786 | Accept: "application/json" |
| 44787 | }); |
| 44788 | const secConfig = await (0, security_js_1.extractSecurity)(client._options.apiKey); |
| 44789 | const securityInput = secConfig == null ? {} : { apiKey: secConfig }; |
| 44790 | const requestSecurity = (0, security_js_1.resolveGlobalSecurity)(securityInput); |
| 44791 | const context = { |
| 44792 | operationID: "moderations_v1_moderations_post", |
| 44793 | oAuth2Scopes: [], |
| 44794 | resolvedSecurity: requestSecurity, |
| 44795 | securitySource: client._options.apiKey, |
| 44796 | retryConfig: (options === null || options === void 0 ? void 0 : options.retries) || client._options.retryConfig || { strategy: "none" }, |
| 44797 | retryCodes: (options === null || options === void 0 ? void 0 : options.retryCodes) || ["429", "500", "502", "503", "504"] |
| 44798 | }; |
| 44799 | const requestRes = client._createRequest(context, { |
| 44800 | security: requestSecurity, |
| 44801 | method: "POST", |
| 44802 | path: path5, |
| 44803 | headers, |
| 44804 | body, |
| 44805 | timeoutMs: (options === null || options === void 0 ? void 0 : options.timeoutMs) || client._options.timeoutMs || -1 |
| 44806 | }, options); |
| 44807 | if (!requestRes.ok) { |
| 44808 | return requestRes; |
| 44809 | } |
| 44810 | const req = requestRes.value; |
| 44811 | const doResult = await client._do(req, { |
| 44812 | context, |
| 44813 | errorCodes: ["422", "4XX", "5XX"], |
| 44814 | retryConfig: context.retryConfig, |
| 44815 | retryCodes: context.retryCodes |
| 44816 | }); |
| 44817 | if (!doResult.ok) { |
| 44818 | return doResult; |
| 44819 | } |
| 44820 | const response = doResult.value; |
| 44821 | const responseFields = { |
| 44822 | HttpMeta: { Response: response, Request: req } |
| 44823 | }; |
| 44824 | const [result] = await M5.match(M5.json(200, components.ClassificationResponse$inboundSchema), M5.jsonErr(422, errors.HTTPValidationError$inboundSchema), M5.fail(["4XX", "5XX"]))(response, { extraFields: responseFields }); |
| 44825 | if (!result.ok) { |
| 44826 | return result; |
| 44827 | } |
| 44828 | return result; |
| 44829 | } |
| 44830 | } |
| 44831 | }); |
| 44832 |
nothing calls this directly
no test coverage detected
searching dependent graphs…