@3wks/sargon-api-node-client
Advanced tools
Comparing version 0.0.1 to 0.0.2
220
dist/api.js
@@ -15,12 +15,2 @@ "use strict"; | ||
*/ | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -34,29 +24,2 @@ return new (P || (P = Promise))(function (resolve, reject) { | ||
}; | ||
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 (_) 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 }; | ||
} | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
@@ -70,5 +33,5 @@ if (mod && mod.__esModule) return mod; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var url = __importStar(require("url")); | ||
var portableFetch = __importStar(require("portable-fetch")); | ||
var BASE_PATH = "http://localhost".replace(/\/+$/, ""); | ||
const url = __importStar(require("url")); | ||
const portableFetch = __importStar(require("portable-fetch")); | ||
const BASE_PATH = "http://localhost".replace(/\/+$/, ""); | ||
/** | ||
@@ -89,6 +52,4 @@ * | ||
*/ | ||
var BaseAPI = /** @class */ (function () { | ||
function BaseAPI(configuration, basePath, fetch) { | ||
if (basePath === void 0) { basePath = BASE_PATH; } | ||
if (fetch === void 0) { fetch = portableFetch; } | ||
class BaseAPI { | ||
constructor(configuration, basePath = BASE_PATH, fetch = portableFetch) { | ||
this.basePath = basePath; | ||
@@ -101,4 +62,3 @@ this.fetch = fetch; | ||
} | ||
return BaseAPI; | ||
}()); | ||
} | ||
exports.BaseAPI = BaseAPI; | ||
@@ -112,12 +72,9 @@ ; | ||
*/ | ||
var RequiredError = /** @class */ (function (_super) { | ||
__extends(RequiredError, _super); | ||
function RequiredError(field, msg) { | ||
var _this = _super.call(this, msg) || this; | ||
_this.field = field; | ||
_this.name = "RequiredError"; | ||
return _this; | ||
class RequiredError extends Error { | ||
constructor(field, msg) { | ||
super(msg); | ||
this.field = field; | ||
this.name = "RequiredError"; | ||
} | ||
return RequiredError; | ||
}(Error)); | ||
} | ||
exports.RequiredError = RequiredError; | ||
@@ -134,3 +91,3 @@ /** | ||
*/ | ||
var MemberStatusEnum; | ||
let MemberStatusEnum; | ||
(function (MemberStatusEnum) { | ||
@@ -163,57 +120,43 @@ MemberStatusEnum["Active"] = "Active"; | ||
*/ | ||
getMembers: function (q, date, memberNumber, p, i, o, options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var localVarPath, localVarUrlObj, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarAccessTokenValue, _a; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
localVarPath = "/members"; | ||
localVarUrlObj = url.parse(localVarPath, true); | ||
localVarRequestOptions = Object.assign({ method: 'GET' }, options); | ||
localVarHeaderParameter = {}; | ||
localVarQueryParameter = {}; | ||
if (!(configuration && configuration.accessToken)) return [3 /*break*/, 5]; | ||
if (!(typeof configuration.accessToken === 'function')) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, configuration.accessToken("AuthenticatedUser", ["member:self", "fund:operator", "fund:advisor", "integration"])]; | ||
case 1: | ||
_a = _b.sent(); | ||
return [3 /*break*/, 4]; | ||
case 2: return [4 /*yield*/, configuration.accessToken]; | ||
case 3: | ||
_a = _b.sent(); | ||
_b.label = 4; | ||
case 4: | ||
localVarAccessTokenValue = _a; | ||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; | ||
_b.label = 5; | ||
case 5: | ||
if (q !== undefined) { | ||
localVarQueryParameter['q'] = q; | ||
} | ||
if (date !== undefined) { | ||
localVarQueryParameter['date'] = date; | ||
} | ||
if (memberNumber !== undefined) { | ||
localVarQueryParameter['memberNumber'] = memberNumber; | ||
} | ||
if (p !== undefined) { | ||
localVarQueryParameter['p'] = p; | ||
} | ||
if (i !== undefined) { | ||
localVarQueryParameter['i'] = i; | ||
} | ||
if (o !== undefined) { | ||
localVarQueryParameter['o'] = o; | ||
} | ||
localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); | ||
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 | ||
delete localVarUrlObj.search; | ||
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); | ||
return [2 /*return*/, { | ||
url: url.format(localVarUrlObj), | ||
options: localVarRequestOptions, | ||
}]; | ||
} | ||
}); | ||
getMembers(q, date, memberNumber, p, i, o, options = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const localVarPath = `/members`; | ||
const localVarUrlObj = url.parse(localVarPath, true); | ||
const localVarRequestOptions = Object.assign({ method: 'GET' }, options); | ||
const localVarHeaderParameter = {}; | ||
const localVarQueryParameter = {}; | ||
// authentication AuthenticatedUser required | ||
// oauth required | ||
if (configuration && configuration.accessToken) { | ||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function' | ||
? yield configuration.accessToken("AuthenticatedUser", ["member:self", "fund:operator", "fund:advisor", "integration"]) | ||
: yield configuration.accessToken; | ||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; | ||
} | ||
if (q !== undefined) { | ||
localVarQueryParameter['q'] = q; | ||
} | ||
if (date !== undefined) { | ||
localVarQueryParameter['date'] = date; | ||
} | ||
if (memberNumber !== undefined) { | ||
localVarQueryParameter['memberNumber'] = memberNumber; | ||
} | ||
if (p !== undefined) { | ||
localVarQueryParameter['p'] = p; | ||
} | ||
if (i !== undefined) { | ||
localVarQueryParameter['i'] = i; | ||
} | ||
if (o !== undefined) { | ||
localVarQueryParameter['o'] = o; | ||
} | ||
localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); | ||
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 | ||
delete localVarUrlObj.search; | ||
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); | ||
return { | ||
url: url.format(localVarUrlObj), | ||
options: localVarRequestOptions, | ||
}; | ||
}); | ||
@@ -241,26 +184,14 @@ }, | ||
*/ | ||
getMembers: function (q, date, memberNumber, p, i, o, options) { | ||
var _this = this; | ||
return function (fetch, basePath) { | ||
if (fetch === void 0) { fetch = portableFetch; } | ||
if (basePath === void 0) { basePath = BASE_PATH; } | ||
return __awaiter(_this, void 0, void 0, function () { | ||
var localVarFetchArgs; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, exports.MembersApiFetchParamCreator(configuration).getMembers(q, date, memberNumber, p, i, o, options)]; | ||
case 1: | ||
localVarFetchArgs = _a.sent(); | ||
return [2 /*return*/, fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { | ||
if (response.status >= 200 && response.status < 300) { | ||
return response.json(); | ||
} | ||
else { | ||
throw response; | ||
} | ||
})]; | ||
} | ||
}); | ||
getMembers(q, date, memberNumber, p, i, o, options) { | ||
return (fetch = portableFetch, basePath = BASE_PATH) => __awaiter(this, void 0, void 0, function* () { | ||
const localVarFetchArgs = yield exports.MembersApiFetchParamCreator(configuration).getMembers(q, date, memberNumber, p, i, o, options); | ||
return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { | ||
if (response.status >= 200 && response.status < 300) { | ||
return response.json(); | ||
} | ||
else { | ||
throw response; | ||
} | ||
}); | ||
}; | ||
}); | ||
}, | ||
@@ -287,3 +218,3 @@ }; | ||
*/ | ||
getMembers: function (q, date, memberNumber, p, i, o, options) { | ||
getMembers(q, date, memberNumber, p, i, o, options) { | ||
return exports.MembersApiFp(configuration).getMembers(q, date, memberNumber, p, i, o, options)(fetch, basePath); | ||
@@ -299,7 +230,3 @@ }, | ||
*/ | ||
var MembersApi = /** @class */ (function (_super) { | ||
__extends(MembersApi, _super); | ||
function MembersApi() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
class MembersApi extends BaseAPI { | ||
/** | ||
@@ -318,11 +245,8 @@ * Return a paginated collection of accessible members. The API may be configured to limit the resulting Members Collection to ensure that only minimal relevant data is exposed and only when required. The Members Collection resource is subject to various limits and controls, these include: * Request Rate Limiting * Result Limiting * Minimum Query Length The date search feature searches on the member joinedDate attribute. | ||
*/ | ||
MembersApi.prototype.getMembers = function (q, date, memberNumber, p, i, o, options) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, exports.MembersApiFp(this.configuration).getMembers(q, date, memberNumber, p, i, o, options)(this.fetch, this.basePath)]; | ||
}); | ||
getMembers(q, date, memberNumber, p, i, o, options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return exports.MembersApiFp(this.configuration).getMembers(q, date, memberNumber, p, i, o, options)(this.fetch, this.basePath); | ||
}); | ||
}; | ||
return MembersApi; | ||
}(BaseAPI)); | ||
} | ||
} | ||
exports.MembersApi = MembersApi; |
@@ -15,5 +15,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Configuration = /** @class */ (function () { | ||
function Configuration(param) { | ||
if (param === void 0) { param = {}; } | ||
class Configuration { | ||
constructor(param = {}) { | ||
this.apiKey = param.apiKey; | ||
@@ -25,4 +24,3 @@ this.username = param.username; | ||
} | ||
return Configuration; | ||
}()); | ||
} | ||
exports.Configuration = Configuration; |
@@ -14,10 +14,2 @@ "use strict"; | ||
*/ | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -31,29 +23,2 @@ return new (P || (P = Promise))(function (resolve, reject) { | ||
}; | ||
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 (_) 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 }; | ||
} | ||
}; | ||
function __export(m) { | ||
@@ -68,25 +33,15 @@ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
__export(require("./configuration")); | ||
var client_oauth2_1 = __importDefault(require("client-oauth2")); | ||
var api_1 = require("./api"); | ||
var ApiClient = /** @class */ (function () { | ||
function ApiClient(options) { | ||
var _this = this; | ||
this.members = function () { | ||
return api_1.MembersApiFactory({ | ||
basePath: _this.options.basePath, | ||
accessToken: _this.getToken | ||
}); | ||
}; | ||
this.getToken = function () { return __awaiter(_this, void 0, void 0, function () { | ||
var token; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.client.credentials.getToken()]; | ||
case 1: | ||
token = _a.sent(); | ||
return [2 /*return*/, token.accessToken]; | ||
} | ||
}); | ||
}); }; | ||
this.options = __assign({ basePath: "API_PATH_HERE" }, options); | ||
const client_oauth2_1 = __importDefault(require("client-oauth2")); | ||
const api_1 = require("./api"); | ||
class ApiClient { | ||
constructor(options) { | ||
this.members = () => api_1.MembersApiFactory({ | ||
basePath: this.options.basePath, | ||
accessToken: this.getToken | ||
}); | ||
this.getToken = () => __awaiter(this, void 0, void 0, function* () { | ||
const token = yield this.client.credentials.getToken(); | ||
return token.accessToken; | ||
}); | ||
this.options = Object.assign({ basePath: "https://y8dgz7hjc6.execute-api.ap-southeast-2.amazonaws.com/prod" }, options); | ||
this.client = new client_oauth2_1.default({ | ||
@@ -97,3 +52,2 @@ clientId: this.options.clientId, | ||
} | ||
return ApiClient; | ||
}()); | ||
} |
{ | ||
"name": "@3wks/sargon-api-node-client", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "OpenAPI client for @3wks/sargon-api-node-client", | ||
@@ -13,2 +13,6 @@ "author": "OpenAPI-Generator Contributors", | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/3wks/sargon-node-api-client" | ||
}, | ||
"license": "Unlicense", | ||
@@ -15,0 +19,0 @@ "main": "./dist/index.js", |
@@ -1,2 +0,2 @@ | ||
## @3wks/sargon-api-node-client@0.0.1 | ||
## @3wks/sargon-api-node-client@0.0.2 | ||
@@ -39,3 +39,3 @@ This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments: | ||
``` | ||
npm install @3wks/sargon-api-node-client@0.0.1 --save | ||
npm install @3wks/sargon-api-node-client@0.0.2 --save | ||
``` | ||
@@ -42,0 +42,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
71508
16
1390
0
4