Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@codat/files

Package Overview
Dependencies
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codat/files - npm Package Compare versions

Comparing version 0.13.0 to 0.13.1

279

dist/sdk/files.js

@@ -39,2 +39,38 @@ "use strict";

};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -64,39 +100,48 @@ exports.Files = void 0;

Files.prototype.downloadFiles = function (req, retries, config) {
if (!(req instanceof utils.SpeakeasyBase)) {
req = new operations.DownloadFilesRequest(req);
}
var baseURL = this._serverURL;
var url = utils.generateURL(baseURL, "/companies/{companyId}/files/download", req);
var client = this._securityClient || this._defaultClient;
var queryParams = utils.serializeQueryParams(req);
var retryConfig = retries;
if (!retryConfig) {
retryConfig = new utils.RetryConfig("backoff", true);
retryConfig.backoff = new utils.BackoffStrategy(500, 60000, 1.5, 3600000);
}
var r = utils.Retry(function () {
return client.request(__assign({ url: url + queryParams, method: "get" }, config));
}, new utils.Retries(retryConfig, ["408", "429", "5XX"]));
return r.then(function (httpRes) {
var _a, _b;
var contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
throw new Error("status code not found in response: ".concat(httpRes));
var res = new operations.DownloadFilesResponse({
statusCode: httpRes.status,
contentType: contentType,
rawResponse: httpRes,
var _a, _b;
return __awaiter(this, void 0, void 0, function () {
var baseURL, url, client, queryParams, retryConfig, httpRes, contentType, res, resBody, out, i;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
if (!(req instanceof utils.SpeakeasyBase)) {
req = new operations.DownloadFilesRequest(req);
}
baseURL = this._serverURL;
url = utils.generateURL(baseURL, "/companies/{companyId}/files/download", req);
client = this._securityClient || this._defaultClient;
queryParams = utils.serializeQueryParams(req);
retryConfig = retries;
if (!retryConfig) {
retryConfig = new utils.RetryConfig("backoff", true);
retryConfig.backoff = new utils.BackoffStrategy(500, 60000, 1.5, 3600000);
}
return [4 /*yield*/, utils.Retry(function () {
return client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get" }, config));
}, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
case 1:
httpRes = _c.sent();
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
throw new Error("status code not found in response: ".concat(httpRes));
}
res = new operations.DownloadFilesResponse({
statusCode: httpRes.status,
contentType: contentType,
rawResponse: httpRes,
});
switch (true) {
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
if (utils.matchContentType(contentType, "application/octet-stream")) {
resBody = JSON.stringify(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, null, 0);
out = new Uint8Array(resBody.length);
for (i = 0; i < resBody.length; i++)
out[i] = resBody.charCodeAt(i);
res.data = out;
}
break;
}
return [2 /*return*/, res];
}
});
switch (true) {
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
if (utils.matchContentType(contentType, "application/octet-stream")) {
var resBody = JSON.stringify(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, null, 0);
var out = new Uint8Array(resBody.length);
for (var i = 0; i < resBody.length; i++)
out[i] = resBody.charCodeAt(i);
res.data = out;
}
break;
}
return res;
});

@@ -111,36 +156,45 @@ };

Files.prototype.listFiles = function (req, retries, config) {
if (!(req instanceof utils.SpeakeasyBase)) {
req = new operations.ListFilesRequest(req);
}
var baseURL = this._serverURL;
var url = utils.generateURL(baseURL, "/companies/{companyId}/files", req);
var client = this._securityClient || this._defaultClient;
var retryConfig = retries;
if (!retryConfig) {
retryConfig = new utils.RetryConfig("backoff", true);
retryConfig.backoff = new utils.BackoffStrategy(500, 60000, 1.5, 3600000);
}
var r = utils.Retry(function () {
return client.request(__assign({ url: url, method: "get" }, config));
}, new utils.Retries(retryConfig, ["408", "429", "5XX"]));
return r.then(function (httpRes) {
var _a, _b;
var contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
throw new Error("status code not found in response: ".concat(httpRes));
var res = new operations.ListFilesResponse({
statusCode: httpRes.status,
contentType: contentType,
rawResponse: httpRes,
var _a, _b;
return __awaiter(this, void 0, void 0, function () {
var baseURL, url, client, retryConfig, httpRes, contentType, res, resFieldDepth;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
if (!(req instanceof utils.SpeakeasyBase)) {
req = new operations.ListFilesRequest(req);
}
baseURL = this._serverURL;
url = utils.generateURL(baseURL, "/companies/{companyId}/files", req);
client = this._securityClient || this._defaultClient;
retryConfig = retries;
if (!retryConfig) {
retryConfig = new utils.RetryConfig("backoff", true);
retryConfig.backoff = new utils.BackoffStrategy(500, 60000, 1.5, 3600000);
}
return [4 /*yield*/, utils.Retry(function () {
return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get" }, config));
}, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
case 1:
httpRes = _c.sent();
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
throw new Error("status code not found in response: ".concat(httpRes));
}
res = new operations.ListFilesResponse({
statusCode: httpRes.status,
contentType: contentType,
rawResponse: httpRes,
});
switch (true) {
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
if (utils.matchContentType(contentType, "application/json")) {
res.files = [];
resFieldDepth = utils.getResFieldDepth(res);
res.files = utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, shared.File, resFieldDepth);
}
break;
}
return [2 /*return*/, res];
}
});
switch (true) {
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
if (utils.matchContentType(contentType, "application/json")) {
res.files = [];
var resFieldDepth = utils.getResFieldDepth(res);
res.files = utils.objectToClass(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, shared.File, resFieldDepth);
}
break;
}
return res;
});

@@ -155,42 +209,51 @@ };

Files.prototype.uploadFiles = function (req, retries, config) {
var _a;
if (!(req instanceof utils.SpeakeasyBase)) {
req = new operations.UploadFilesRequest(req);
}
var baseURL = this._serverURL;
var url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/files", req);
var _b = [{}, {}], reqBodyHeaders = _b[0], reqBody = _b[1];
try {
_a = utils.serializeRequestBody(req, "requestBody", "multipart"), reqBodyHeaders = _a[0], reqBody = _a[1];
}
catch (e) {
if (e instanceof Error) {
throw new Error("Error serializing request body, cause: ".concat(e.message));
}
}
var client = this._securityClient || this._defaultClient;
var headers = __assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers);
var retryConfig = retries;
if (!retryConfig) {
retryConfig = new utils.RetryConfig("backoff", true);
retryConfig.backoff = new utils.BackoffStrategy(500, 60000, 1.5, 3600000);
}
var r = utils.Retry(function () {
return client.request(__assign({ url: url, method: "post", headers: headers, data: reqBody }, config));
}, new utils.Retries(retryConfig, ["408", "429", "5XX"]));
return r.then(function (httpRes) {
var _a, _b;
var contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null)
throw new Error("status code not found in response: ".concat(httpRes));
var res = new operations.UploadFilesResponse({
statusCode: httpRes.status,
contentType: contentType,
rawResponse: httpRes,
var _a, _b;
return __awaiter(this, void 0, void 0, function () {
var baseURL, url, _c, reqBodyHeaders, reqBody, client, headers, retryConfig, httpRes, contentType, res;
var _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
if (!(req instanceof utils.SpeakeasyBase)) {
req = new operations.UploadFilesRequest(req);
}
baseURL = this._serverURL;
url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/files", req);
_c = [{}, {}], reqBodyHeaders = _c[0], reqBody = _c[1];
try {
_d = utils.serializeRequestBody(req, "requestBody", "multipart"), reqBodyHeaders = _d[0], reqBody = _d[1];
}
catch (e) {
if (e instanceof Error) {
throw new Error("Error serializing request body, cause: ".concat(e.message));
}
}
client = this._securityClient || this._defaultClient;
headers = __assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers);
retryConfig = retries;
if (!retryConfig) {
retryConfig = new utils.RetryConfig("backoff", true);
retryConfig.backoff = new utils.BackoffStrategy(500, 60000, 1.5, 3600000);
}
return [4 /*yield*/, utils.Retry(function () {
return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, data: reqBody }, config));
}, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
case 1:
httpRes = _e.sent();
contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
throw new Error("status code not found in response: ".concat(httpRes));
}
res = new operations.UploadFilesResponse({
statusCode: httpRes.status,
contentType: contentType,
rawResponse: httpRes,
});
switch (true) {
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
break;
}
return [2 /*return*/, res];
}
});
switch (true) {
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
break;
}
return res;
});

@@ -197,0 +260,0 @@ };

@@ -61,4 +61,4 @@ "use strict";

this._language = "typescript";
this._sdkVersion = "0.13.0";
this._genVersion = "2.23.0";
this._sdkVersion = "0.13.1";
this._genVersion = "2.23.2";
this._serverURL = (_a = props === null || props === void 0 ? void 0 : props.serverURL) !== null && _a !== void 0 ? _a : exports.ServerList[0];

@@ -65,0 +65,0 @@ this._defaultClient =

{
"name": "@codat/files",
"version": "0.13.0",
"version": "0.13.1",
"author": "Speakeasy",

@@ -5,0 +5,0 @@ "scripts": {

@@ -23,4 +23,3 @@ # @codat/files

import { CodatFiles } from "@codat/files";
import { DownloadFilesRequest, DownloadFilesResponse } from "@codat/files/dist/sdk/models/operations";
import { AxiosError } from "axios";
import { DownloadFilesResponse } from "@codat/files/dist/sdk/models/operations";

@@ -33,9 +32,7 @@ const sdk = new CodatFiles({

const req: DownloadFilesRequest = {
sdk.files.downloadFiles({
companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
date: "corrupti",
};
sdk.files.downloadFiles(req).then((res: DownloadFilesResponse | AxiosError) => {
if (res instanceof UsageExamplePostResponse && res.statusCode == 200) {
}).then((res: DownloadFilesResponse) => {
if (res.statusCode == 200) {
// handle response

@@ -42,0 +39,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc