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

@codat/files

Package Overview
Dependencies
Maintainers
4
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.36.0 to 0.37.0

dist/sdk/models/shared/codatfile.d.ts

10

dist/internal/utils/queryparams.js

@@ -27,3 +27,5 @@ "use strict";

var queryStringPrefix = "?";
var filterAndJoin = function (strings) { return strings.filter(function (s) { return !!s; }).join("&"); };
var filterAndJoin = function (strings) {
return strings.filter(function (s) { return !!s; }).join("&");
};
function serializeQueryParams(queryParams, globals) {

@@ -108,3 +110,4 @@ var queryStringParts = [];

return;
return "".concat(paramKey).concat(delimiter).concat((0, utils_1.valToString)(value[paramKey]));
var key = qpDecorator.ParamName || paramKey;
return "".concat(key).concat(delimiter).concat((0, utils_1.valToString)(value[paramKey]));
})

@@ -138,3 +141,4 @@ .join(delimiter);

return;
return "".concat(paramKey, "=").concat(encodeURIComponent((0, utils_1.valToString)(value[paramKey])));
var key = qpDecorator.ParamName || paramKey;
return "".concat(key, "=").concat(encodeURIComponent((0, utils_1.valToString)(value[paramKey])));
})

@@ -141,0 +145,0 @@ .join("&"));

@@ -33,4 +33,3 @@ "use strict";

function serializeRequestBody(request, requestFieldName, serializationMethod) {
if (request !== Object(request) ||
!request.hasOwnProperty(requestFieldName)) {
if (request !== Object(request) || !request.hasOwnProperty(requestFieldName)) {
return serializeContentType(utils_1.SerializationMethodToContentType[serializationMethod], request);

@@ -60,3 +59,3 @@ }

{ "Content-Type": "".concat(contentType) },
encodeFormUrlEncodeData(reqBody),
encodeFormUrlEncodedData(reqBody),
], 2), requestHeaders = _a[0], requestBody = _a[1];

@@ -71,6 +70,3 @@ break;

case "text/json":
_c = __read([
{ "Content-Type": "".concat(contentType) },
reqBody,
], 2), requestHeaders = _c[0], requestBody = _c[1];
_c = __read([{ "Content-Type": "".concat(contentType) }, reqBody], 2), requestHeaders = _c[0], requestBody = _c[1];
break;

@@ -90,8 +86,20 @@ default: {

};
var encodeFormUrlEncodeData = function (data) {
var formData = new form_data_1.default();
var encodeFormUrlEncodedData = function (data) {
var fieldNames = Object.getOwnPropertyNames(data);
var urlencoded = "";
var amp = "";
var appendPair = function (key, value) {
urlencoded += "".concat(amp).concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value));
amp = "&";
};
if ((0, utils_1.isNumberRecord)(data) || (0, utils_1.isBooleanRecord)(data) || (0, utils_1.isStringRecord)(data)) {
fieldNames.forEach(function (fname) {
formData.append(fname, String(data[fname]));
var _a, _b;
var formAnn = Reflect.getMetadata("form", data, fname);
var name = fname;
if (formAnn) {
var formDecorator = parseFormDecorator(formAnn);
name = (_a = formDecorator.Name) !== null && _a !== void 0 ? _a : fname;
}
appendPair(name, (_b = data[fname]) === null || _b === void 0 ? void 0 : _b.toString());
});

@@ -101,3 +109,3 @@ }

fieldNames.forEach(function (fname) {
var _a;
var _a, _b;
var formAnn = Reflect.getMetadata("form", data, fname);

@@ -109,15 +117,17 @@ if (formAnn === null) {

if (formDecorator.JSON) {
formData.append((_a = formDecorator.Name) !== null && _a !== void 0 ? _a : fname, JSON.stringify(data[fname]));
return;
var name = (_a = formDecorator.Name) !== null && _a !== void 0 ? _a : fname;
var val = JSON.stringify(data[fname]);
appendPair(name, val);
}
if (formDecorator.Style === "form") {
else if (formDecorator.Style === "form") {
var parsed_1;
var name = (_b = formDecorator.Name) !== null && _b !== void 0 ? _b : fname;
if (formDecorator.Explode === true) {
parsed_1 = formExplode(fname, data[fname]);
parsed_1 = formExplode(name, data[fname]);
}
else {
parsed_1 = formNotExplode(fname, data[fname]);
parsed_1 = formNotExplode(name, data[fname]);
}
Object.keys(parsed_1).forEach(function (key) {
parsed_1[key].forEach(function (v) { return formData.append(key, v); });
parsed_1[key].forEach(function (v) { return appendPair(key, v); });
});

@@ -128,3 +138,3 @@ return;

}
return formData;
return urlencoded;
};

@@ -131,0 +141,0 @@ var formExplode = function (fname, data) {

@@ -141,3 +141,7 @@ "use strict";

case "oauth2":
properties.headers[securityDecorator.Name] = value;
properties.headers[securityDecorator.Name] = value
.toLowerCase()
.startsWith("bearer ")
? value
: "Bearer ".concat(value);
break;

@@ -149,3 +153,7 @@ case "http":

case "bearer":
properties.headers[securityDecorator.Name] = value.toLowerCase().startsWith("bearer ") ? value : "Bearer ".concat(value);
properties.headers[securityDecorator.Name] = value
.toLowerCase()
.startsWith("bearer ")
? value
: "Bearer ".concat(value);
break;

@@ -179,3 +187,3 @@ default:

});
properties.headers["Authorization"] = "Basic ".concat(Buffer.from("".concat(username, ":").concat(password)).toString('base64'));
properties.headers["Authorization"] = "Basic ".concat(Buffer.from("".concat(username, ":").concat(password)).toString("base64"));
}

@@ -182,0 +190,0 @@ var SecurityDecorator = /** @class */ (function () {

@@ -110,8 +110,6 @@ "use strict";

}
else if (prop.type.name == "Array" &&
isSpeakeasyBase(prop.elemType)) {
else if (prop.type.name == "Array" && isSpeakeasyBase(prop.elemType)) {
this[prop.key] = handleArray(value, prop.elemType, prop.elemDepth);
}
else if (prop.type.name == "Object" &&
isSpeakeasyBase(prop.elemType)) {
else if (prop.type.name == "Object" && isSpeakeasyBase(prop.elemType)) {
this[prop.key] = handleObject(value, prop.elemType, prop.elemDepth);

@@ -118,0 +116,0 @@ }

import * as utils from "../internal/utils";
import * as operations from "./models/operations";
import * as operations from "../sdk/models/operations";
import { SDKConfiguration } from "./sdk";

@@ -4,0 +4,0 @@ import { AxiosRequestConfig } from "axios";

@@ -94,5 +94,5 @@ "use strict";

var utils = __importStar(require("../internal/utils"));
var errors = __importStar(require("./models/errors"));
var operations = __importStar(require("./models/operations"));
var shared = __importStar(require("./models/shared"));
var errors = __importStar(require("../sdk/models/errors"));
var operations = __importStar(require("../sdk/models/operations"));
var shared = __importStar(require("../sdk/models/shared"));
/**

@@ -119,3 +119,3 @@ * Endpoints to manage uploaded files.

return __awaiter(this, void 0, void 0, function () {
var baseURL, url, client, globalSecurity, properties, headers, queryParams, globalRetryConfig, retryConfig, httpRes, contentType, res, decodedRes;
var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, globalRetryConfig, retryConfig, httpRes, responseContentType, res, decodedRes;
return __generator(this, function (_c) {

@@ -128,3 +128,3 @@ switch (_c.label) {

baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
url = utils.generateURL(baseURL, "/companies/{companyId}/files/download", req);
operationUrl = utils.generateURL(baseURL, "/companies/{companyId}/files/download", req);
client = this.sdkConfiguration.defaultClient;

@@ -162,7 +162,7 @@ globalSecurity = this.sdkConfiguration.security;

return [4 /*yield*/, utils.Retry(function () {
return client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config));
return client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config));
}, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
case 3:
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 : "";
responseContentType = (_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) {

@@ -173,3 +173,3 @@ throw new Error("status code not found in response: ".concat(httpRes));

statusCode: httpRes.status,
contentType: contentType,
contentType: responseContentType,
rawResponse: httpRes,

@@ -180,23 +180,23 @@ });

case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
if (utils.matchContentType(contentType, "application/octet-stream")) {
if (utils.matchContentType(responseContentType, "application/octet-stream")) {
res.data = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
}
else {
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
}
break;
case [400, 401, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
if (utils.matchContentType(contentType, "application/json")) {
case [400, 401, 402, 404, 429, 500, 503].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
if (utils.matchContentType(responseContentType, "application/json")) {
res.schema = utils.objectToClass(JSON.parse(decodedRes), shared.Schema);
}
else {
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
}
break;
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
if (utils.matchContentType(contentType, "application/json")) {
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 403:
if (utils.matchContentType(responseContentType, "application/json")) {
res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), operations.DownloadFilesErrorMessage);
}
else {
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
}

@@ -219,3 +219,3 @@ break;

return __awaiter(this, void 0, void 0, function () {
var baseURL, url, client, globalSecurity, properties, headers, globalRetryConfig, retryConfig, httpRes, contentType, res, decodedRes, resFieldDepth;
var baseURL, operationUrl, client, globalSecurity, properties, headers, globalRetryConfig, retryConfig, httpRes, responseContentType, res, decodedRes, resFieldDepth;
return __generator(this, function (_c) {

@@ -228,3 +228,3 @@ switch (_c.label) {

baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
url = utils.generateURL(baseURL, "/companies/{companyId}/files", req);
operationUrl = utils.generateURL(baseURL, "/companies/{companyId}/files", req);
client = this.sdkConfiguration.defaultClient;

@@ -256,7 +256,7 @@ globalSecurity = this.sdkConfiguration.security;

return [4 /*yield*/, utils.Retry(function () {
return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
return client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "get", headers: headers, responseType: "arraybuffer" }, config));
}, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
case 3:
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 : "";
responseContentType = (_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) {

@@ -267,3 +267,3 @@ throw new Error("status code not found in response: ".concat(httpRes));

statusCode: httpRes.status,
contentType: contentType,
contentType: responseContentType,
rawResponse: httpRes,

@@ -274,3 +274,3 @@ });

case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
if (utils.matchContentType(contentType, "application/json")) {
if (utils.matchContentType(responseContentType, "application/json")) {
res.files = [];

@@ -281,19 +281,19 @@ resFieldDepth = utils.getResFieldDepth(res);

else {
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
}
break;
case [401, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
if (utils.matchContentType(contentType, "application/json")) {
case [401, 402, 404, 429, 500, 503].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
if (utils.matchContentType(responseContentType, "application/json")) {
res.schema = utils.objectToClass(JSON.parse(decodedRes), shared.Schema);
}
else {
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
}
break;
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
if (utils.matchContentType(contentType, "application/json")) {
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 403:
if (utils.matchContentType(responseContentType, "application/json")) {
res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), operations.ListFilesErrorMessage);
}
else {
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
}

@@ -322,3 +322,3 @@ break;

return __awaiter(this, void 0, void 0, function () {
var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, globalRetryConfig, retryConfig, httpRes, contentType, res, decodedRes;
var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, globalRetryConfig, retryConfig, httpRes, responseContentType, res, decodedRes;
var _d;

@@ -332,6 +332,6 @@ return __generator(this, function (_e) {

baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/files", req);
operationUrl = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/files", req);
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
try {
_d = __read(utils.serializeRequestBody(req, "requestBody", "multipart"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
_d = __read(utils.serializeRequestBody(req, "fileUpload", "multipart"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
}

@@ -369,7 +369,7 @@ catch (e) {

return [4 /*yield*/, utils.Retry(function () {
return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config));
return client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config));
}, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
case 3:
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 : "";
responseContentType = (_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) {

@@ -380,3 +380,3 @@ throw new Error("status code not found in response: ".concat(httpRes));

statusCode: httpRes.status,
contentType: contentType,
contentType: responseContentType,
rawResponse: httpRes,

@@ -388,16 +388,16 @@ });

break;
case [400, 401, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
if (utils.matchContentType(contentType, "application/json")) {
case [400, 401, 402, 404, 429, 500, 503].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
if (utils.matchContentType(responseContentType, "application/json")) {
res.schema = utils.objectToClass(JSON.parse(decodedRes), shared.Schema);
}
else {
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
}
break;
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 404:
if (utils.matchContentType(contentType, "application/json")) {
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 403:
if (utils.matchContentType(responseContentType, "application/json")) {
res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), operations.UploadFilesErrorMessage);
}
else {
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
}

@@ -404,0 +404,0 @@ break;

import { SpeakeasyBase } from "../../../internal/utils";
import * as shared from "../shared";
import * as shared from "../../../sdk/models/shared";
import { AxiosResponse } from "axios";

@@ -15,6 +15,3 @@ export declare class DownloadFilesRequest extends SpeakeasyBase {

/**
* One or more of the resources you referenced could not be found.
*
* @remarks
* This might be because your company or data connection id is wrong, or was already deleted.
* You are using an outdated API key or a key not associated with that resource.
*/

@@ -57,6 +54,3 @@ export declare class DownloadFilesErrorMessage extends SpeakeasyBase {

/**
* One or more of the resources you referenced could not be found.
*
* @remarks
* This might be because your company or data connection id is wrong, or was already deleted.
* You are using an outdated API key or a key not associated with that resource.
*/

@@ -71,3 +65,3 @@ errorMessage?: DownloadFilesErrorMessage;

*/
rawResponse?: AxiosResponse;
rawResponse: AxiosResponse;
/**

@@ -74,0 +68,0 @@ * The request made is not valid.

@@ -55,3 +55,3 @@ "use strict";

var utils_1 = require("../../../internal/utils");
var shared = __importStar(require("../shared"));
var shared = __importStar(require("../../../sdk/models/shared"));
var class_transformer_1 = require("class-transformer");

@@ -75,6 +75,3 @@ var DownloadFilesRequest = /** @class */ (function (_super) {

/**
* One or more of the resources you referenced could not be found.
*
* @remarks
* This might be because your company or data connection id is wrong, or was already deleted.
* You are using an outdated API key or a key not associated with that resource.
*/

@@ -81,0 +78,0 @@ var DownloadFilesErrorMessage = /** @class */ (function (_super) {

import { SpeakeasyBase } from "../../../internal/utils";
import * as shared from "../shared";
import * as shared from "../../../sdk/models/shared";
import { AxiosResponse } from "axios";

@@ -11,6 +11,3 @@ export declare class ListFilesRequest extends SpeakeasyBase {

/**
* One or more of the resources you referenced could not be found.
*
* @remarks
* This might be because your company or data connection id is wrong, or was already deleted.
* You are using an outdated API key or a key not associated with that resource.
*/

@@ -49,6 +46,3 @@ export declare class ListFilesErrorMessage extends SpeakeasyBase {

/**
* One or more of the resources you referenced could not be found.
*
* @remarks
* This might be because your company or data connection id is wrong, or was already deleted.
* You are using an outdated API key or a key not associated with that resource.
*/

@@ -67,3 +61,3 @@ errorMessage?: ListFilesErrorMessage;

*/
rawResponse?: AxiosResponse;
rawResponse: AxiosResponse;
/**

@@ -70,0 +64,0 @@ * Your API request was not properly authorized.

@@ -55,3 +55,3 @@ "use strict";

var utils_1 = require("../../../internal/utils");
var shared = __importStar(require("../shared"));
var shared = __importStar(require("../../../sdk/models/shared"));
var class_transformer_1 = require("class-transformer");

@@ -71,6 +71,3 @@ var ListFilesRequest = /** @class */ (function (_super) {

/**
* One or more of the resources you referenced could not be found.
*
* @remarks
* This might be because your company or data connection id is wrong, or was already deleted.
* You are using an outdated API key or a key not associated with that resource.
*/

@@ -77,0 +74,0 @@ var ListFilesErrorMessage = /** @class */ (function (_super) {

import { SpeakeasyBase } from "../../../internal/utils";
import * as shared from "../shared";
import * as shared from "../../../sdk/models/shared";
import { AxiosResponse } from "axios";
export declare class UploadFilesRequestBody extends SpeakeasyBase {
content: Uint8Array;
requestBody: string;
}
export declare class UploadFilesRequest extends SpeakeasyBase {
requestBody?: UploadFilesRequestBody;
fileUpload?: shared.FileUpload;
/**

@@ -20,6 +16,3 @@ * Unique identifier for a company.

/**
* One or more of the resources you referenced could not be found.
*
* @remarks
* This might be because your company or data connection id is wrong, or was already deleted.
* You are using an outdated API key or a key not associated with that resource.
*/

@@ -58,6 +51,3 @@ export declare class UploadFilesErrorMessage extends SpeakeasyBase {

/**
* One or more of the resources you referenced could not be found.
*
* @remarks
* This might be because your company or data connection id is wrong, or was already deleted.
* You are using an outdated API key or a key not associated with that resource.
*/

@@ -72,3 +62,3 @@ errorMessage?: UploadFilesErrorMessage;

*/
rawResponse?: AxiosResponse;
rawResponse: AxiosResponse;
/**

@@ -75,0 +65,0 @@ * The request made is not valid.

@@ -53,22 +53,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.UploadFilesResponse = exports.UploadFilesErrorMessage = exports.UploadFilesRequest = exports.UploadFilesRequestBody = void 0;
exports.UploadFilesResponse = exports.UploadFilesErrorMessage = exports.UploadFilesRequest = void 0;
var utils_1 = require("../../../internal/utils");
var shared = __importStar(require("../shared"));
var shared = __importStar(require("../../../sdk/models/shared"));
var class_transformer_1 = require("class-transformer");
var UploadFilesRequestBody = /** @class */ (function (_super) {
__extends(UploadFilesRequestBody, _super);
function UploadFilesRequestBody() {
return _super !== null && _super.apply(this, arguments) || this;
}
__decorate([
(0, utils_1.SpeakeasyMetadata)({ data: "multipart_form, content=true" }),
__metadata("design:type", Uint8Array)
], UploadFilesRequestBody.prototype, "content", void 0);
__decorate([
(0, utils_1.SpeakeasyMetadata)({ data: "multipart_form, name=requestBody" }),
__metadata("design:type", String)
], UploadFilesRequestBody.prototype, "requestBody", void 0);
return UploadFilesRequestBody;
}(utils_1.SpeakeasyBase));
exports.UploadFilesRequestBody = UploadFilesRequestBody;
var UploadFilesRequest = /** @class */ (function (_super) {

@@ -80,7 +64,5 @@ __extends(UploadFilesRequest, _super);

__decorate([
(0, utils_1.SpeakeasyMetadata)({
data: "multipart_form, file=true, request, media_type=multipart/form-data",
}),
__metadata("design:type", UploadFilesRequestBody)
], UploadFilesRequest.prototype, "requestBody", void 0);
(0, utils_1.SpeakeasyMetadata)({ data: "request, media_type=multipart/form-data" }),
__metadata("design:type", shared.FileUpload)
], UploadFilesRequest.prototype, "fileUpload", void 0);
__decorate([

@@ -98,6 +80,3 @@ (0, utils_1.SpeakeasyMetadata)({ data: "pathParam, style=simple;explode=false;name=companyId" }),

/**
* One or more of the resources you referenced could not be found.
*
* @remarks
* This might be because your company or data connection id is wrong, or was already deleted.
* You are using an outdated API key or a key not associated with that resource.
*/

@@ -104,0 +83,0 @@ var UploadFilesErrorMessage = /** @class */ (function (_super) {

@@ -0,3 +1,5 @@

export * from "./codatfile";
export * from "./file";
export * from "./fileupload";
export * from "./schema";
export * from "./security";

@@ -20,4 +20,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./codatfile"), exports);
__exportStar(require("./file"), exports);
__exportStar(require("./fileupload"), exports);
__exportStar(require("./schema"), exports);
__exportStar(require("./security"), exports);
import * as utils from "../internal/utils";
import * as shared from "../sdk/models/shared";
import { Files } from "./files";
import * as shared from "./models/shared";
import { AxiosInstance } from "axios";

@@ -5,0 +5,0 @@ /**

@@ -25,5 +25,5 @@ "use strict";

this.openapiDocVersion = "3.0.0";
this.sdkVersion = "0.36.0";
this.genVersion = "2.159.2";
this.userAgent = "speakeasy-sdk/typescript 0.36.0 2.159.2 3.0.0 @codat/files";
this.sdkVersion = "0.37.0";
this.genVersion = "2.214.3";
this.userAgent = "speakeasy-sdk/typescript 0.37.0 2.214.3 3.0.0 @codat/files";
Object.assign(this, init);

@@ -53,3 +53,3 @@ }

}
var defaultClient = (_b = props === null || props === void 0 ? void 0 : props.defaultClient) !== null && _b !== void 0 ? _b : axios_1.default.create({ baseURL: serverURL });
var defaultClient = (_b = props === null || props === void 0 ? void 0 : props.defaultClient) !== null && _b !== void 0 ? _b : axios_1.default.create();
this.sdkConfiguration = new SDKConfiguration({

@@ -56,0 +56,0 @@ defaultClient: defaultClient,

@@ -23,3 +23,3 @@ # Files

(async() => {
async function run() {
const sdk = new CodatFiles({

@@ -33,3 +33,3 @@ security: {

companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
date: "2022-10-23T00:00:00.000Z",
date: "2022-10-23T00:00:00Z",
});

@@ -40,3 +40,5 @@

}
})();
}
run();
```

@@ -46,7 +48,7 @@

| Parameter | Type | Required | Description |
| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| `request` | [operations.DownloadFilesRequest](../../models/operations/downloadfilesrequest.md) | :heavy_check_mark: | The request object to use for the request. |
| `retries` | [utils.RetryConfig](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
| `config` | [AxiosRequestConfig](https://axios-http.com/docs/req_config) | :heavy_minus_sign: | Available config options for making requests. |
| Parameter | Type | Required | Description |
| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `request` | [operations.DownloadFilesRequest](../../sdk/models/operations/downloadfilesrequest.md) | :heavy_check_mark: | The request object to use for the request. |
| `retries` | [utils.RetryConfig](../../internal/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
| `config` | [AxiosRequestConfig](https://axios-http.com/docs/req_config) | :heavy_minus_sign: | Available config options for making requests. |

@@ -56,4 +58,8 @@

**Promise<[operations.DownloadFilesResponse](../../models/operations/downloadfilesresponse.md)>**
**Promise<[operations.DownloadFilesResponse](../../sdk/models/operations/downloadfilesresponse.md)>**
### Errors
| Error Object | Status Code | Content Type |
| --------------- | --------------- | --------------- |
| errors.SDKError | 400-600 | */* |

@@ -69,3 +75,3 @@ ## listFiles

(async() => {
async function run() {
const sdk = new CodatFiles({

@@ -84,3 +90,5 @@ security: {

}
})();
}
run();
```

@@ -90,7 +98,7 @@

| Parameter | Type | Required | Description |
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| `request` | [operations.ListFilesRequest](../../models/operations/listfilesrequest.md) | :heavy_check_mark: | The request object to use for the request. |
| `retries` | [utils.RetryConfig](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
| `config` | [AxiosRequestConfig](https://axios-http.com/docs/req_config) | :heavy_minus_sign: | Available config options for making requests. |
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
| `request` | [operations.ListFilesRequest](../../sdk/models/operations/listfilesrequest.md) | :heavy_check_mark: | The request object to use for the request. |
| `retries` | [utils.RetryConfig](../../internal/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
| `config` | [AxiosRequestConfig](https://axios-http.com/docs/req_config) | :heavy_minus_sign: | Available config options for making requests. |

@@ -100,4 +108,8 @@

**Promise<[operations.ListFilesResponse](../../models/operations/listfilesresponse.md)>**
**Promise<[operations.ListFilesResponse](../../sdk/models/operations/listfilesresponse.md)>**
### Errors
| Error Object | Status Code | Content Type |
| --------------- | --------------- | --------------- |
| errors.SDKError | 400-600 | */* |

@@ -119,3 +131,3 @@ ## uploadFiles

(async() => {
async function run() {
const sdk = new CodatFiles({

@@ -128,5 +140,7 @@ security: {

const res = await sdk.files.uploadFiles({
requestBody: {
content: ";*>'Oq[l/G" as bytes <<<>>>,
requestBody: "syndicate Central defect",
fileUpload: {
file: {
content: new TextEncoder().encode("0x6261bDdB39"),
fileName: "syndicate_central_defect.wav",
},
},

@@ -140,3 +154,5 @@ companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",

}
})();
}
run();
```

@@ -146,7 +162,7 @@

| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
| `request` | [operations.UploadFilesRequest](../../models/operations/uploadfilesrequest.md) | :heavy_check_mark: | The request object to use for the request. |
| `retries` | [utils.RetryConfig](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
| `config` | [AxiosRequestConfig](https://axios-http.com/docs/req_config) | :heavy_minus_sign: | Available config options for making requests. |
| Parameter | Type | Required | Description |
| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| `request` | [operations.UploadFilesRequest](../../sdk/models/operations/uploadfilesrequest.md) | :heavy_check_mark: | The request object to use for the request. |
| `retries` | [utils.RetryConfig](../../internal/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
| `config` | [AxiosRequestConfig](https://axios-http.com/docs/req_config) | :heavy_minus_sign: | Available config options for making requests. |

@@ -156,3 +172,7 @@

**Promise<[operations.UploadFilesResponse](../../models/operations/uploadfilesresponse.md)>**
**Promise<[operations.UploadFilesResponse](../../sdk/models/operations/uploadfilesresponse.md)>**
### Errors
| Error Object | Status Code | Content Type |
| --------------- | --------------- | --------------- |
| errors.SDKError | 400-600 | */* |
{
"name": "@codat/files",
"version": "0.36.0",
"version": "0.37.0",
"author": "Codat",

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

@@ -7,3 +7,3 @@ # Files

<!-- Start SDK Installation -->
<!-- Start SDK Installation [installation] -->
## SDK Installation

@@ -22,10 +22,14 @@

```
<!-- End SDK Installation -->
<!-- End SDK Installation [installation] -->
## Example Usage
<!-- Start SDK Example Usage -->
<!-- Start SDK Example Usage [usage] -->
## SDK Example Usage
### Example
```typescript
import { CodatFiles } from "@codat/files";
(async () => {
async function run() {
const sdk = new CodatFiles({

@@ -39,3 +43,3 @@ security: {

companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
date: "2022-10-23T00:00:00.000Z",
date: "2022-10-23T00:00:00Z",
});

@@ -46,11 +50,12 @@

}
})();
}
run();
```
<!-- End SDK Example Usage -->
<!-- End SDK Example Usage [usage] -->
<!-- Start SDK Available Operations -->
<!-- Start Available Resources and Operations [operations] -->
## Available Resources and Operations
### [files](docs/sdks/files/README.md)

@@ -61,15 +66,264 @@

* [uploadFiles](docs/sdks/files/README.md#uploadfiles) - Upload files for a company
<!-- End SDK Available Operations -->
<!-- End Available Resources and Operations [operations] -->
<!-- Start Dev Containers -->
<!-- Start Retries [retries] -->
## Retries
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
```typescript
import { CodatFiles } from "@codat/files";
<!-- End Dev Containers -->
async function run() {
const sdk = new CodatFiles({
security: {
authHeader: "Basic BASE_64_ENCODED(API_KEY)",
},
});
const res = await sdk.files.downloadFiles(
{
companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
date: "2022-10-23T00:00:00Z",
},
{
strategy: "backoff",
backoff: {
initialInterval: 1,
maxInterval: 50,
exponent: 1.1,
maxElapsedTime: 100,
},
retryConnectionErrors: false,
}
);
if (res.statusCode == 200) {
// handle response
}
}
run();
```
If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
```typescript
import { CodatFiles } from "@codat/files";
async function run() {
const sdk = new CodatFiles({
retry_config: {
strategy: "backoff",
backoff: {
initialInterval: 1,
maxInterval: 50,
exponent: 1.1,
maxElapsedTime: 100,
},
retryConnectionErrors: false,
},
security: {
authHeader: "Basic BASE_64_ENCODED(API_KEY)",
},
});
const res = await sdk.files.downloadFiles({
companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
date: "2022-10-23T00:00:00Z",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
```
<!-- End Retries [retries] -->
<!-- Start Error Handling [errors] -->
## Error Handling
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an error. If Error objects are specified in your OpenAPI Spec, the SDK will throw the appropriate Error type.
| Error Object | Status Code | Content Type |
| --------------- | --------------- | --------------- |
| errors.SDKError | 400-600 | */* |
Example
```typescript
import { CodatFiles } from "@codat/files";
async function run() {
const sdk = new CodatFiles({
security: {
authHeader: "Basic BASE_64_ENCODED(API_KEY)",
},
});
let res;
try {
res = await sdk.files.downloadFiles({
companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
date: "2022-10-23T00:00:00Z",
});
} catch (err) {
if (err instanceof errors.SDKError) {
console.error(err); // handle exception
throw err;
}
}
if (res.statusCode == 200) {
// handle response
}
}
run();
```
<!-- End Error Handling [errors] -->
<!-- Start Server Selection [server] -->
## Server Selection
### Select Server by Index
You can override the default server globally by passing a server index to the `serverIdx: number` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
| # | Server | Variables |
| - | ------ | --------- |
| 0 | `https://api.codat.io` | None |
#### Example
```typescript
import { CodatFiles } from "@codat/files";
async function run() {
const sdk = new CodatFiles({
serverIdx: 0,
security: {
authHeader: "Basic BASE_64_ENCODED(API_KEY)",
},
});
const res = await sdk.files.downloadFiles({
companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
date: "2022-10-23T00:00:00Z",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
```
### Override Server URL Per-Client
The default server can also be overridden globally by passing a URL to the `serverURL: str` optional parameter when initializing the SDK client instance. For example:
```typescript
import { CodatFiles } from "@codat/files";
async function run() {
const sdk = new CodatFiles({
serverURL: "https://api.codat.io",
security: {
authHeader: "Basic BASE_64_ENCODED(API_KEY)",
},
});
const res = await sdk.files.downloadFiles({
companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
date: "2022-10-23T00:00:00Z",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
```
<!-- End Server Selection [server] -->
<!-- Start Custom HTTP Client [http-client] -->
## Custom HTTP Client
The Typescript SDK makes API calls using the [axios](https://axios-http.com/docs/intro) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom `AxiosInstance` object.
For example, you could specify a header for every request that your sdk makes as follows:
```typescript
import { @codat/files } from "CodatFiles";
import axios from "axios";
const httpClient = axios.create({
headers: {'x-custom-header': 'someValue'}
})
const sdk = new CodatFiles({defaultClient: httpClient});
```
<!-- End Custom HTTP Client [http-client] -->
<!-- Start Authentication [security] -->
## Authentication
### Per-Client Security Schemes
This SDK supports the following security scheme globally:
| Name | Type | Scheme |
| ------------ | ------------ | ------------ |
| `authHeader` | apiKey | API key |
You can set the security parameters through the `security` optional parameter when initializing the SDK client instance. For example:
```typescript
import { CodatFiles } from "@codat/files";
async function run() {
const sdk = new CodatFiles({
security: {
authHeader: "Basic BASE_64_ENCODED(API_KEY)",
},
});
const res = await sdk.files.downloadFiles({
companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
date: "2022-10-23T00:00:00Z",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
```
<!-- End Authentication [security] -->
<!-- Placeholder for Future Speakeasy SDK Sections -->
<!-- Start Codat Support Notes -->
### Support
### Library generated by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)
If you encounter any challenges while utilizing our SDKs, please don't hesitate to reach out for assistance.
You can raise any issues by contacting your dedicated Codat representative or reaching out to our [support team](mailto:support@codat.io).
We're here to help ensure a smooth experience for you.
<!-- End Codat Support Notes -->
<!-- Start Codat Generated By -->
### Library generated by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)
<!-- End Codat Generated By -->
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