snaptrade-typescript-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,65 @@
1
+ /**
2
+ * SnapTrade
3
+ * Connect brokerage accounts to your app for live positions and trading
4
+ *
5
+ * The version of the OpenAPI document: 1.0.0
6
+ * Contact: api@snaptrade.com
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import { Configuration } from "./configuration";
13
+ import { RequestArgs } from "./base";
14
+ import { AxiosInstance, AxiosResponse } from 'axios';
15
+ /**
16
+ *
17
+ * @export
18
+ */
19
+ export declare const DUMMY_BASE_URL = "https://example.com";
20
+ /**
21
+ *
22
+ * @throws {RequiredError}
23
+ * @export
24
+ */
25
+ export declare const assertParamExists: (functionName: string, paramName: string, paramValue: unknown) => void;
26
+ /**
27
+ *
28
+ * @export
29
+ */
30
+ export declare const setApiKeyToObject: (object: any, keyParamName: string, configuration?: Configuration) => Promise<void>;
31
+ /**
32
+ *
33
+ * @export
34
+ */
35
+ export declare const setBasicAuthToObject: (object: any, configuration?: Configuration) => void;
36
+ /**
37
+ *
38
+ * @export
39
+ */
40
+ export declare const setBearerAuthToObject: (object: any, configuration?: Configuration) => Promise<void>;
41
+ /**
42
+ *
43
+ * @export
44
+ */
45
+ export declare const setOAuthToObject: (object: any, name: string, scopes: string[], configuration?: Configuration) => Promise<void>;
46
+ /**
47
+ *
48
+ * @export
49
+ */
50
+ export declare const setSearchParams: (url: URL, ...objects: any[]) => void;
51
+ /**
52
+ *
53
+ * @export
54
+ */
55
+ export declare const serializeDataIfNeeded: (value: any, requestOptions: any, configuration?: Configuration) => any;
56
+ /**
57
+ *
58
+ * @export
59
+ */
60
+ export declare const toPathString: (url: URL) => string;
61
+ /**
62
+ *
63
+ * @export
64
+ */
65
+ export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T, any>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
package/dist/common.js ADDED
@@ -0,0 +1,281 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * SnapTrade
6
+ * Connect brokerage accounts to your app for live positions and trading
7
+ *
8
+ * The version of the OpenAPI document: 1.0.0
9
+ * Contact: api@snaptrade.com
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __assign = (this && this.__assign) || function () {
16
+ __assign = Object.assign || function(t) {
17
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
18
+ s = arguments[i];
19
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
+ t[p] = s[p];
21
+ }
22
+ return t;
23
+ };
24
+ return __assign.apply(this, arguments);
25
+ };
26
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
27
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
28
+ return new (P || (P = Promise))(function (resolve, reject) {
29
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
30
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
31
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
32
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
33
+ });
34
+ };
35
+ var __generator = (this && this.__generator) || function (thisArg, body) {
36
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
37
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
38
+ function verb(n) { return function (v) { return step([n, v]); }; }
39
+ function step(op) {
40
+ if (f) throw new TypeError("Generator is already executing.");
41
+ while (_) try {
42
+ 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;
43
+ if (y = 0, t) op = [op[0] & 2, t.value];
44
+ switch (op[0]) {
45
+ case 0: case 1: t = op; break;
46
+ case 4: _.label++; return { value: op[1], done: false };
47
+ case 5: _.label++; y = op[1]; op = [0]; continue;
48
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
49
+ default:
50
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
51
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
52
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
53
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
54
+ if (t[2]) _.ops.pop();
55
+ _.trys.pop(); continue;
56
+ }
57
+ op = body.call(thisArg, _);
58
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
59
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
60
+ }
61
+ };
62
+ Object.defineProperty(exports, "__esModule", { value: true });
63
+ exports.createRequestFunction = exports.toPathString = exports.serializeDataIfNeeded = exports.setSearchParams = exports.setOAuthToObject = exports.setBearerAuthToObject = exports.setBasicAuthToObject = exports.setApiKeyToObject = exports.assertParamExists = exports.DUMMY_BASE_URL = void 0;
64
+ var crypto = require("crypto");
65
+ var base_1 = require("./base");
66
+ /**
67
+ *
68
+ * @export
69
+ */
70
+ exports.DUMMY_BASE_URL = 'https://example.com';
71
+ /**
72
+ *
73
+ * @throws {RequiredError}
74
+ * @export
75
+ */
76
+ var assertParamExists = function (functionName, paramName, paramValue) {
77
+ if (paramValue === null || paramValue === undefined) {
78
+ throw new base_1.RequiredError(paramName, "Required parameter ".concat(paramName, " was null or undefined when calling ").concat(functionName, "."));
79
+ }
80
+ };
81
+ exports.assertParamExists = assertParamExists;
82
+ /**
83
+ *
84
+ * @export
85
+ */
86
+ var setApiKeyToObject = function (object, keyParamName, configuration) {
87
+ return __awaiter(this, void 0, void 0, function () {
88
+ var localVarApiKeyValue, _a;
89
+ return __generator(this, function (_b) {
90
+ switch (_b.label) {
91
+ case 0:
92
+ if (!(configuration && configuration.apiKey)) return [3 /*break*/, 5];
93
+ if (!(typeof configuration.apiKey === 'function')) return [3 /*break*/, 2];
94
+ return [4 /*yield*/, configuration.apiKey(keyParamName)];
95
+ case 1:
96
+ _a = _b.sent();
97
+ return [3 /*break*/, 4];
98
+ case 2: return [4 /*yield*/, configuration.apiKey];
99
+ case 3:
100
+ _a = _b.sent();
101
+ _b.label = 4;
102
+ case 4:
103
+ localVarApiKeyValue = _a;
104
+ object[keyParamName] = localVarApiKeyValue;
105
+ _b.label = 5;
106
+ case 5: return [2 /*return*/];
107
+ }
108
+ });
109
+ });
110
+ };
111
+ exports.setApiKeyToObject = setApiKeyToObject;
112
+ /**
113
+ *
114
+ * @export
115
+ */
116
+ var setBasicAuthToObject = function (object, configuration) {
117
+ if (configuration && (configuration.username || configuration.password)) {
118
+ object["auth"] = { username: configuration.username, password: configuration.password };
119
+ }
120
+ };
121
+ exports.setBasicAuthToObject = setBasicAuthToObject;
122
+ /**
123
+ *
124
+ * @export
125
+ */
126
+ var setBearerAuthToObject = function (object, configuration) {
127
+ return __awaiter(this, void 0, void 0, function () {
128
+ var accessToken, _a;
129
+ return __generator(this, function (_b) {
130
+ switch (_b.label) {
131
+ case 0:
132
+ if (!(configuration && configuration.accessToken)) return [3 /*break*/, 5];
133
+ if (!(typeof configuration.accessToken === 'function')) return [3 /*break*/, 2];
134
+ return [4 /*yield*/, configuration.accessToken()];
135
+ case 1:
136
+ _a = _b.sent();
137
+ return [3 /*break*/, 4];
138
+ case 2: return [4 /*yield*/, configuration.accessToken];
139
+ case 3:
140
+ _a = _b.sent();
141
+ _b.label = 4;
142
+ case 4:
143
+ accessToken = _a;
144
+ object["Authorization"] = "Bearer " + accessToken;
145
+ _b.label = 5;
146
+ case 5: return [2 /*return*/];
147
+ }
148
+ });
149
+ });
150
+ };
151
+ exports.setBearerAuthToObject = setBearerAuthToObject;
152
+ /**
153
+ *
154
+ * @export
155
+ */
156
+ var setOAuthToObject = function (object, name, scopes, configuration) {
157
+ return __awaiter(this, void 0, void 0, function () {
158
+ var localVarAccessTokenValue, _a;
159
+ return __generator(this, function (_b) {
160
+ switch (_b.label) {
161
+ case 0:
162
+ if (!(configuration && configuration.accessToken)) return [3 /*break*/, 5];
163
+ if (!(typeof configuration.accessToken === 'function')) return [3 /*break*/, 2];
164
+ return [4 /*yield*/, configuration.accessToken(name, scopes)];
165
+ case 1:
166
+ _a = _b.sent();
167
+ return [3 /*break*/, 4];
168
+ case 2: return [4 /*yield*/, configuration.accessToken];
169
+ case 3:
170
+ _a = _b.sent();
171
+ _b.label = 4;
172
+ case 4:
173
+ localVarAccessTokenValue = _a;
174
+ object["Authorization"] = "Bearer " + localVarAccessTokenValue;
175
+ _b.label = 5;
176
+ case 5: return [2 /*return*/];
177
+ }
178
+ });
179
+ });
180
+ };
181
+ exports.setOAuthToObject = setOAuthToObject;
182
+ function setFlattenedQueryParams(urlSearchParams, parameter, key) {
183
+ if (key === void 0) { key = ""; }
184
+ if (typeof parameter === "object") {
185
+ if (Array.isArray(parameter)) {
186
+ parameter.forEach(function (item) { return setFlattenedQueryParams(urlSearchParams, item, key); });
187
+ }
188
+ else {
189
+ Object.keys(parameter).forEach(function (currentKey) {
190
+ return setFlattenedQueryParams(urlSearchParams, parameter[currentKey], "".concat(key).concat(key !== '' ? '.' : '').concat(currentKey));
191
+ });
192
+ }
193
+ }
194
+ else {
195
+ if (urlSearchParams.has(key)) {
196
+ urlSearchParams.append(key, parameter);
197
+ }
198
+ else {
199
+ urlSearchParams.set(key, parameter);
200
+ }
201
+ }
202
+ }
203
+ /**
204
+ *
205
+ * @export
206
+ */
207
+ var setSearchParams = function (url) {
208
+ var objects = [];
209
+ for (var _i = 1; _i < arguments.length; _i++) {
210
+ objects[_i - 1] = arguments[_i];
211
+ }
212
+ var searchParams = new URLSearchParams(url.search);
213
+ setFlattenedQueryParams(searchParams, objects);
214
+ url.search = searchParams.toString();
215
+ };
216
+ exports.setSearchParams = setSearchParams;
217
+ /**
218
+ *
219
+ * @export
220
+ */
221
+ var serializeDataIfNeeded = function (value, requestOptions, configuration) {
222
+ var nonString = typeof value !== 'string';
223
+ var needsSerialization = nonString && configuration && configuration.isJsonMime
224
+ ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
225
+ : nonString;
226
+ return needsSerialization
227
+ ? JSON.stringify(value !== undefined ? value : {})
228
+ : (value || "");
229
+ };
230
+ exports.serializeDataIfNeeded = serializeDataIfNeeded;
231
+ /**
232
+ *
233
+ * @export
234
+ */
235
+ var toPathString = function (url) {
236
+ return url.pathname + url.search + url.hash;
237
+ };
238
+ exports.toPathString = toPathString;
239
+ var JSONstringifyOrder = function (obj) {
240
+ var allKeys = [];
241
+ var seen = {};
242
+ JSON.stringify(obj, function (key, value) {
243
+ if (!(key in seen)) {
244
+ allKeys.push(key);
245
+ seen[key] = null;
246
+ }
247
+ return value;
248
+ });
249
+ allKeys.sort();
250
+ return JSON.stringify(obj, allKeys);
251
+ };
252
+ /**
253
+ *
254
+ * @export
255
+ */
256
+ var createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
257
+ return function (axios, basePath) {
258
+ if (axios === void 0) { axios = globalAxios; }
259
+ if (basePath === void 0) { basePath = BASE_PATH; }
260
+ var axiosRequestArgs = __assign(__assign({}, axiosArgs.options), { url: ((configuration === null || configuration === void 0 ? void 0 : configuration.basePath) || basePath) + axiosArgs.url });
261
+ if ((configuration === null || configuration === void 0 ? void 0 : configuration.consumerKey) === undefined)
262
+ throw Error("Consumer key is required");
263
+ var consumerKey = encodeURI(configuration.consumerKey);
264
+ var requestData = axiosArgs.options.data === undefined || axiosArgs.options.data === '{}' ? null : JSON.parse(axiosArgs.options.data);
265
+ var path = axiosArgs.url.indexOf("?") === -1 ? "".concat(axiosArgs.url) : "".concat(axiosArgs.url.split("?")[0]);
266
+ var requestPath = "/api/v1".concat(path);
267
+ var requestQuery = axiosRequestArgs.url.replace(BASE_PATH, "").replace(path, "").replace("?", "");
268
+ var sigObject = {
269
+ content: requestData,
270
+ path: requestPath,
271
+ query: requestQuery,
272
+ };
273
+ var sigContent = JSONstringifyOrder(sigObject);
274
+ var hmac = crypto.createHmac("sha256", consumerKey);
275
+ var signature = hmac.update(sigContent).digest("base64");
276
+ axiosRequestArgs.headers["Signature"] = signature;
277
+ return axios.request(axiosRequestArgs);
278
+ };
279
+ };
280
+ exports.createRequestFunction = createRequestFunction;
281
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../common.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,+BAAgC;AAEhC,+BAAoD;AAGpD;;;GAGG;AACU,QAAA,cAAc,GAAG,qBAAqB,CAAA;AAEnD;;;;GAIG;AACI,IAAM,iBAAiB,GAAG,UAAU,YAAoB,EAAE,SAAiB,EAAE,UAAmB;IACnG,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,SAAS,EAAE;QACjD,MAAM,IAAI,oBAAa,CAAC,SAAS,EAAE,6BAAsB,SAAS,iDAAuC,YAAY,MAAG,CAAC,CAAC;KAC7H;AACL,CAAC,CAAA;AAJY,QAAA,iBAAiB,qBAI7B;AAED;;;GAGG;AACI,IAAM,iBAAiB,GAAG,UAAgB,MAAW,EAAE,YAAoB,EAAE,aAA6B;;;;;;yBACzG,CAAA,aAAa,IAAI,aAAa,CAAC,MAAM,CAAA,EAArC,wBAAqC;yBACT,CAAA,OAAO,aAAa,CAAC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,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,UAAG,SAAS,CAAC,GAAG,CAAE,CAAC,CAAC,CAAC,UAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAE,CAAA;QACtG,IAAM,WAAW,GAAG,iBAAU,IAAI,CAAE,CAAA;QACpC,IAAM,YAAY,GAAG,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACpG,IAAM,SAAS,GAAG;YACd,OAAO,EAAE,WAAW;YACpB,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,YAAY;SACtB,CAAC;QACF,IAAM,UAAU,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACjD,IAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACtD,IAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAE3D,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;QAElD,OAAO,KAAK,CAAC,OAAO,CAAO,gBAAgB,CAAC,CAAC;IACjD,CAAC,CAAC;AACN,CAAC,CAAA;AAvBY,QAAA,qBAAqB,yBAuBjC"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * SnapTrade
3
+ * Connect brokerage accounts to your app for live positions and trading
4
+ *
5
+ * The version of the OpenAPI document: 1.0.0
6
+ * Contact: api@snaptrade.com
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ export interface ConfigurationParameters {
13
+ clientId: string;
14
+ consumerKey: string;
15
+ username?: string;
16
+ password?: string;
17
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
18
+ basePath?: string;
19
+ baseOptions?: any;
20
+ formDataCtor?: new () => any;
21
+ }
22
+ export declare class Configuration {
23
+ consumerKey: string;
24
+ /**
25
+ * parameter for apiKey security
26
+ * @param name security name
27
+ * @memberof Configuration
28
+ */
29
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
30
+ /**
31
+ * parameter for basic security
32
+ *
33
+ * @type {string}
34
+ * @memberof Configuration
35
+ */
36
+ username?: string;
37
+ /**
38
+ * parameter for basic security
39
+ *
40
+ * @type {string}
41
+ * @memberof Configuration
42
+ */
43
+ password?: string;
44
+ /**
45
+ * parameter for oauth2 security
46
+ * @param name security name
47
+ * @param scopes oauth2 scope
48
+ * @memberof Configuration
49
+ */
50
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
51
+ /**
52
+ * override base path
53
+ *
54
+ * @type {string}
55
+ * @memberof Configuration
56
+ */
57
+ basePath?: string;
58
+ /**
59
+ * base options for axios calls
60
+ *
61
+ * @type {any}
62
+ * @memberof Configuration
63
+ */
64
+ baseOptions?: any;
65
+ /**
66
+ * The FormData constructor that will be used to create multipart form data
67
+ * requests. You can inject this here so that execution environments that
68
+ * do not support the FormData class can still run the generated client.
69
+ *
70
+ * @type {new () => FormData}
71
+ */
72
+ formDataCtor?: new () => any;
73
+ constructor(param: ConfigurationParameters);
74
+ /**
75
+ * Check if the given MIME is a JSON MIME.
76
+ * JSON MIME examples:
77
+ * application/json
78
+ * application/json; charset=UTF8
79
+ * APPLICATION/JSON
80
+ * application/vnd.company+json
81
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
82
+ * @return True if the given MIME is JSON, false otherwise.
83
+ */
84
+ isJsonMime(mime: string): boolean;
85
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * SnapTrade
6
+ * Connect brokerage accounts to your app for live positions and trading
7
+ *
8
+ * The version of the OpenAPI document: 1.0.0
9
+ * Contact: api@snaptrade.com
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.Configuration = void 0;
17
+ var Configuration = /** @class */ (function () {
18
+ function Configuration(param) {
19
+ this.consumerKey = param.consumerKey;
20
+ this.apiKey = function (name) {
21
+ if (name === "clientId")
22
+ return param.clientId;
23
+ if (name === "timestamp")
24
+ return Math.round(new Date().getTime() / 1000).toString();
25
+ };
26
+ this.username = param.username;
27
+ this.password = param.password;
28
+ this.accessToken = param.accessToken;
29
+ this.basePath = param.basePath;
30
+ this.baseOptions = param.baseOptions;
31
+ this.formDataCtor = param.formDataCtor;
32
+ }
33
+ /**
34
+ * Check if the given MIME is a JSON MIME.
35
+ * JSON MIME examples:
36
+ * application/json
37
+ * application/json; charset=UTF8
38
+ * APPLICATION/JSON
39
+ * application/vnd.company+json
40
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
41
+ * @return True if the given MIME is JSON, false otherwise.
42
+ */
43
+ Configuration.prototype.isJsonMime = function (mime) {
44
+ var jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
45
+ return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
46
+ };
47
+ return Configuration;
48
+ }());
49
+ exports.Configuration = Configuration;
50
+ //# sourceMappingURL=configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../configuration.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;;;AAcH;IAoDI,uBAAY,KAA8B;QACtC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,UAAC,IAAY;YACvB,IAAI,IAAI,KAAK,UAAU;gBAAE,OAAO,KAAK,CAAC,QAAQ,CAAA;YAC9C,IAAI,IAAI,KAAK,WAAW;gBAAE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAA;QACvF,CAAC,CAAA;QACD,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IAC3C,CAAC;IAED;;;;;;;;;OASG;IACI,kCAAU,GAAjB,UAAkB,IAAY;QAC1B,IAAM,QAAQ,GAAW,IAAI,MAAM,CAAC,+DAA+D,EAAE,GAAG,CAAC,CAAC;QAC1G,OAAO,IAAI,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,6BAA6B,CAAC,CAAC;IAC1G,CAAC;IACL,oBAAC;AAAD,CAAC,AAhFD,IAgFC;AAhFY,sCAAa"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * SnapTrade
3
+ * Connect brokerage accounts to your app for live positions and trading
4
+ *
5
+ * The version of the OpenAPI document: 1.0.0
6
+ * Contact: api@snaptrade.com
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ export * from "./api";
13
+ export * from "./configuration";
package/dist/index.js ADDED
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * SnapTrade
6
+ * Connect brokerage accounts to your app for live positions and trading
7
+ *
8
+ * The version of the OpenAPI document: 1.0.0
9
+ * Contact: api@snaptrade.com
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
27
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ __exportStar(require("./api"), exports);
31
+ __exportStar(require("./configuration"), exports);
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;AAGH,wCAAsB;AACtB,kDAAgC"}
package/git_push.sh ADDED
@@ -0,0 +1,57 @@
1
+ #!/bin/sh
2
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
3
+ #
4
+ # Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
5
+
6
+ git_user_id=$1
7
+ git_repo_id=$2
8
+ release_note=$3
9
+ git_host=$4
10
+
11
+ if [ "$git_host" = "" ]; then
12
+ git_host="github.com"
13
+ echo "[INFO] No command line input provided. Set \$git_host to $git_host"
14
+ fi
15
+
16
+ if [ "$git_user_id" = "" ]; then
17
+ git_user_id="GIT_USER_ID"
18
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
19
+ fi
20
+
21
+ if [ "$git_repo_id" = "" ]; then
22
+ git_repo_id="GIT_REPO_ID"
23
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
24
+ fi
25
+
26
+ if [ "$release_note" = "" ]; then
27
+ release_note="Minor update"
28
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
29
+ fi
30
+
31
+ # Initialize the local directory as a Git repository
32
+ git init
33
+
34
+ # Adds the files in the local repository and stages them for commit.
35
+ git add .
36
+
37
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
38
+ git commit -m "$release_note"
39
+
40
+ # Sets the new remote
41
+ git_remote=$(git remote)
42
+ if [ "$git_remote" = "" ]; then # git remote not defined
43
+
44
+ if [ "$GIT_TOKEN" = "" ]; then
45
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
46
+ git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
47
+ else
48
+ git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
49
+ fi
50
+
51
+ fi
52
+
53
+ git pull origin master
54
+
55
+ # Pushes (Forces) the changes in the local repository up to the remote repository
56
+ echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
57
+ git push origin master 2>&1 | grep -v 'To https'
package/index.ts ADDED
@@ -0,0 +1,18 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * SnapTrade
5
+ * Connect brokerage accounts to your app for live positions and trading
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ * Contact: api@snaptrade.com
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ export * from "./api";
17
+ export * from "./configuration";
18
+
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "snaptrade-typescript-sdk",
3
+ "version": "1.0.0",
4
+ "description": "OpenAPI client for snaptrade-typescript-sdk",
5
+ "author": "OpenAPI-Generator Contributors",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
9
+ },
10
+ "keywords": [
11
+ "axios",
12
+ "typescript",
13
+ "openapi-client",
14
+ "openapi-generator",
15
+ "snaptrade-typescript-sdk"
16
+ ],
17
+ "license": "Unlicense",
18
+ "main": "./dist/index.js",
19
+ "typings": "./dist/index.d.ts",
20
+ "scripts": {
21
+ "build": "tsc ",
22
+ "prepare": "npm run build"
23
+ },
24
+ "dependencies": {
25
+ "axios": "^0.26.1"
26
+ },
27
+ "devDependencies": {
28
+ "@types/node": "^12.11.5",
29
+ "typescript": "^4.0"
30
+ }
31
+ }