MCPcopy
hub / github.com/di-sukharev/opencommit / batchJobsCreate

Function batchJobsCreate

out/cli.cjs:44173–44223  ·  view source on GitHub ↗
(client, request3, options)

Source from the content-addressed store, hash-verified

44171 var url_js_1 = require_url();
44172 var components = __importStar(require_components());
44173 async function batchJobsCreate(client, request3, options) {
44174 const parsed = (0, schemas_js_1.safeParse)(request3, (value) => components.BatchJobIn$outboundSchema.parse(value), "Input validation failed");
44175 if (!parsed.ok) {
44176 return parsed;
44177 }
44178 const payload = parsed.value;
44179 const body = (0, encodings_js_1.encodeJSON)("body", payload, { explode: true });
44180 const path5 = (0, url_js_1.pathToFunc)("/v1/batch/jobs")();
44181 const headers = new Headers({
44182 "Content-Type": "application/json",
44183 Accept: "application/json"
44184 });
44185 const secConfig = await (0, security_js_1.extractSecurity)(client._options.apiKey);
44186 const securityInput = secConfig == null ? {} : { apiKey: secConfig };
44187 const requestSecurity = (0, security_js_1.resolveGlobalSecurity)(securityInput);
44188 const context = {
44189 operationID: "jobs_api_routes_batch_create_batch_job",
44190 oAuth2Scopes: [],
44191 resolvedSecurity: requestSecurity,
44192 securitySource: client._options.apiKey,
44193 retryConfig: (options === null || options === void 0 ? void 0 : options.retries) || client._options.retryConfig || { strategy: "none" },
44194 retryCodes: (options === null || options === void 0 ? void 0 : options.retryCodes) || ["429", "500", "502", "503", "504"]
44195 };
44196 const requestRes = client._createRequest(context, {
44197 security: requestSecurity,
44198 method: "POST",
44199 path: path5,
44200 headers,
44201 body,
44202 timeoutMs: (options === null || options === void 0 ? void 0 : options.timeoutMs) || client._options.timeoutMs || -1
44203 }, options);
44204 if (!requestRes.ok) {
44205 return requestRes;
44206 }
44207 const req = requestRes.value;
44208 const doResult = await client._do(req, {
44209 context,
44210 errorCodes: ["4XX", "5XX"],
44211 retryConfig: context.retryConfig,
44212 retryCodes: context.retryCodes
44213 });
44214 if (!doResult.ok) {
44215 return doResult;
44216 }
44217 const response = doResult.value;
44218 const [result] = await M5.match(M5.json(200, components.BatchJobOut$inboundSchema), M5.fail(["4XX", "5XX"]))(response);
44219 if (!result.ok) {
44220 return result;
44221 }
44222 return result;
44223 }
44224 }
44225});
44226

Callers

nothing calls this directly

Calls 5

_createRequestMethod · 0.80
_doMethod · 0.80
parseMethod · 0.45
matchMethod · 0.45
jsonMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…