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

Function filesDelete

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

Source from the content-addressed store, hash-verified

45117 var components = __importStar(require_components());
45118 var operations = __importStar(require_operations());
45119 async function filesDelete(client, request3, options) {
45120 const parsed = (0, schemas_js_1.safeParse)(request3, (value) => operations.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(value), "Input validation failed");
45121 if (!parsed.ok) {
45122 return parsed;
45123 }
45124 const payload = parsed.value;
45125 const body = null;
45126 const pathParams = {
45127 file_id: (0, encodings_js_1.encodeSimple)("file_id", payload.file_id, {
45128 explode: false,
45129 charEncoding: "percent"
45130 })
45131 };
45132 const path5 = (0, url_js_1.pathToFunc)("/v1/files/{file_id}")(pathParams);
45133 const headers = new Headers({
45134 Accept: "application/json"
45135 });
45136 const secConfig = await (0, security_js_1.extractSecurity)(client._options.apiKey);
45137 const securityInput = secConfig == null ? {} : { apiKey: secConfig };
45138 const requestSecurity = (0, security_js_1.resolveGlobalSecurity)(securityInput);
45139 const context = {
45140 operationID: "files_api_routes_delete_file",
45141 oAuth2Scopes: [],
45142 resolvedSecurity: requestSecurity,
45143 securitySource: client._options.apiKey,
45144 retryConfig: (options === null || options === void 0 ? void 0 : options.retries) || client._options.retryConfig || { strategy: "none" },
45145 retryCodes: (options === null || options === void 0 ? void 0 : options.retryCodes) || ["429", "500", "502", "503", "504"]
45146 };
45147 const requestRes = client._createRequest(context, {
45148 security: requestSecurity,
45149 method: "DELETE",
45150 path: path5,
45151 headers,
45152 body,
45153 timeoutMs: (options === null || options === void 0 ? void 0 : options.timeoutMs) || client._options.timeoutMs || -1
45154 }, options);
45155 if (!requestRes.ok) {
45156 return requestRes;
45157 }
45158 const req = requestRes.value;
45159 const doResult = await client._do(req, {
45160 context,
45161 errorCodes: ["4XX", "5XX"],
45162 retryConfig: context.retryConfig,
45163 retryCodes: context.retryCodes
45164 });
45165 if (!doResult.ok) {
45166 return doResult;
45167 }
45168 const response = doResult.value;
45169 const [result] = await M5.match(M5.json(200, components.DeleteFileOut$inboundSchema), M5.fail(["4XX", "5XX"]))(response);
45170 if (!result.ok) {
45171 return result;
45172 }
45173 return result;
45174 }
45175 }
45176});

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…