@ibm-cloud/platform-services
Advanced tools
| /** | ||
| * (C) Copyright IBM Corp. 2026. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| /// <reference types="node" /> | ||
| import { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http'; | ||
| import { AbortSignal, BaseService, UserOptions } from 'ibm-cloud-sdk-core'; | ||
| /** | ||
| * The Account Management API allows for the management of Account | ||
| * | ||
| * API Version: 4.0.0 | ||
| */ | ||
| declare class AccountManagementV4 extends BaseService { | ||
| static DEFAULT_SERVICE_URL: string; | ||
| static DEFAULT_SERVICE_NAME: string; | ||
| /************************* | ||
| * Factory method | ||
| ************************/ | ||
| /** | ||
| * Constructs an instance of AccountManagementV4 with passed in options and external configuration. | ||
| * | ||
| * @param {UserOptions} [options] - The parameters to send to the service. | ||
| * @param {string} [options.serviceName] - The name of the service to configure | ||
| * @param {Authenticator} [options.authenticator] - The Authenticator object used to authenticate requests to the service | ||
| * @param {string} [options.serviceUrl] - The base URL for the service | ||
| * @returns {AccountManagementV4} | ||
| */ | ||
| static newInstance(options: UserOptions): AccountManagementV4; | ||
| /** | ||
| * Construct a AccountManagementV4 object. | ||
| * | ||
| * @param {Object} options - Options for the service. | ||
| * @param {string} [options.serviceUrl] - The base URL for the service | ||
| * @param {OutgoingHttpHeaders} [options.headers] - Default headers that shall be included with every request to the service. | ||
| * @param {Authenticator} options.authenticator - The Authenticator object used to authenticate requests to the service | ||
| * @constructor | ||
| * @returns {AccountManagementV4} | ||
| */ | ||
| constructor(options: UserOptions); | ||
| /************************* | ||
| * default | ||
| ************************/ | ||
| /** | ||
| * Get Account by Account ID. | ||
| * | ||
| * Returns the details of an account. | ||
| * | ||
| * @param {Object} params - The parameters to send to the service. | ||
| * @param {string} params.accountId - The unique identifier of the account you want to retrieve. | ||
| * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers | ||
| * @returns {Promise<AccountManagementV4.Response<AccountManagementV4.AccountResponse>>} | ||
| */ | ||
| getAccount(params: AccountManagementV4.GetAccountParams): Promise<AccountManagementV4.Response<AccountManagementV4.AccountResponse>>; | ||
| } | ||
| /************************* | ||
| * interfaces | ||
| ************************/ | ||
| declare namespace AccountManagementV4 { | ||
| /** An operation response. */ | ||
| export interface Response<T = any> { | ||
| result: T; | ||
| status: number; | ||
| statusText: string; | ||
| headers: IncomingHttpHeaders; | ||
| } | ||
| /** The callback for a service request. */ | ||
| export type Callback<T> = (error: any, response?: Response<T>) => void; | ||
| /** The body of a service request that returns no response data. */ | ||
| export interface EmptyObject { | ||
| } | ||
| /** A standard JS object, defined to avoid the limitations of `Object` and `object` */ | ||
| export interface JsonObject { | ||
| [key: string]: any; | ||
| } | ||
| /************************* | ||
| * request interfaces | ||
| ************************/ | ||
| interface DefaultParams { | ||
| headers?: OutgoingHttpHeaders; | ||
| signal?: AbortSignal; | ||
| } | ||
| /** Parameters for the `getAccount` operation. */ | ||
| export interface GetAccountParams extends DefaultParams { | ||
| /** The unique identifier of the account you want to retrieve. */ | ||
| accountId: string; | ||
| } | ||
| /************************* | ||
| * model interfaces | ||
| ************************/ | ||
| /** | ||
| * AccountResponseTraits. | ||
| */ | ||
| export interface AccountResponseTraits { | ||
| eu_supported: boolean; | ||
| poc: boolean; | ||
| hippa: boolean; | ||
| } | ||
| /** | ||
| * AccountResponse. | ||
| */ | ||
| export interface AccountResponse { | ||
| name: string; | ||
| id: string; | ||
| owner: string; | ||
| owner_userid: string; | ||
| owner_iamid: string; | ||
| type: string; | ||
| status: string; | ||
| linked_softlayer_account: string; | ||
| team_directory_enabled: boolean; | ||
| traits: AccountResponseTraits; | ||
| } | ||
| export {}; | ||
| } | ||
| export = AccountManagementV4; |
| "use strict"; | ||
| /** | ||
| * (C) Copyright IBM Corp. 2026. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| var __extends = (this && this.__extends) || (function () { | ||
| var extendStatics = function (d, b) { | ||
| extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
| return extendStatics(d, b); | ||
| }; | ||
| return function (d, b) { | ||
| if (typeof b !== "function" && b !== null) | ||
| throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| }; | ||
| })(); | ||
| var __assign = (this && this.__assign) || function () { | ||
| __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; | ||
| }; | ||
| return __assign.apply(this, arguments); | ||
| }; | ||
| /** | ||
| * IBM OpenAPI SDK Code Generator Version: 3.111.0-1bfb72c2-20260206-185521 | ||
| */ | ||
| var extend = require("extend"); | ||
| var ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core"); | ||
| var common_1 = require("../lib/common"); | ||
| /** | ||
| * The Account Management API allows for the management of Account | ||
| * | ||
| * API Version: 4.0.0 | ||
| */ | ||
| var AccountManagementV4 = /** @class */ (function (_super) { | ||
| __extends(AccountManagementV4, _super); | ||
| /** | ||
| * Construct a AccountManagementV4 object. | ||
| * | ||
| * @param {Object} options - Options for the service. | ||
| * @param {string} [options.serviceUrl] - The base URL for the service | ||
| * @param {OutgoingHttpHeaders} [options.headers] - Default headers that shall be included with every request to the service. | ||
| * @param {Authenticator} options.authenticator - The Authenticator object used to authenticate requests to the service | ||
| * @constructor | ||
| * @returns {AccountManagementV4} | ||
| */ | ||
| function AccountManagementV4(options) { | ||
| var _this = this; | ||
| options = options || {}; | ||
| _this = _super.call(this, options) || this; | ||
| if (options.serviceUrl) { | ||
| _this.setServiceUrl(options.serviceUrl); | ||
| } | ||
| else { | ||
| _this.setServiceUrl(AccountManagementV4.DEFAULT_SERVICE_URL); | ||
| } | ||
| return _this; | ||
| } | ||
| /************************* | ||
| * Factory method | ||
| ************************/ | ||
| /** | ||
| * Constructs an instance of AccountManagementV4 with passed in options and external configuration. | ||
| * | ||
| * @param {UserOptions} [options] - The parameters to send to the service. | ||
| * @param {string} [options.serviceName] - The name of the service to configure | ||
| * @param {Authenticator} [options.authenticator] - The Authenticator object used to authenticate requests to the service | ||
| * @param {string} [options.serviceUrl] - The base URL for the service | ||
| * @returns {AccountManagementV4} | ||
| */ | ||
| AccountManagementV4.newInstance = function (options) { | ||
| options = options || {}; | ||
| if (!options.serviceName) { | ||
| options.serviceName = this.DEFAULT_SERVICE_NAME; | ||
| } | ||
| if (!options.authenticator) { | ||
| options.authenticator = (0, ibm_cloud_sdk_core_1.getAuthenticatorFromEnvironment)(options.serviceName); | ||
| } | ||
| var service = new AccountManagementV4(options); | ||
| service.configureService(options.serviceName); | ||
| if (options.serviceUrl) { | ||
| service.setServiceUrl(options.serviceUrl); | ||
| } | ||
| return service; | ||
| }; | ||
| /************************* | ||
| * default | ||
| ************************/ | ||
| /** | ||
| * Get Account by Account ID. | ||
| * | ||
| * Returns the details of an account. | ||
| * | ||
| * @param {Object} params - The parameters to send to the service. | ||
| * @param {string} params.accountId - The unique identifier of the account you want to retrieve. | ||
| * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers | ||
| * @returns {Promise<AccountManagementV4.Response<AccountManagementV4.AccountResponse>>} | ||
| */ | ||
| AccountManagementV4.prototype.getAccount = function (params) { | ||
| var _params = __assign({}, params); | ||
| var _requiredParams = ['accountId']; | ||
| var _validParams = ['accountId', 'signal', 'headers']; | ||
| var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams); | ||
| if (_validationErrors) { | ||
| return Promise.reject(_validationErrors); | ||
| } | ||
| var path = { | ||
| 'account_id': _params.accountId, | ||
| }; | ||
| var sdkHeaders = (0, common_1.getSdkHeaders)(AccountManagementV4.DEFAULT_SERVICE_NAME, 'v4', 'getAccount'); | ||
| var parameters = { | ||
| options: { | ||
| url: '/v4/accounts/{account_id}', | ||
| method: 'GET', | ||
| path: path, | ||
| }, | ||
| defaultOptions: extend(true, {}, this.baseOptions, { | ||
| headers: extend(true, sdkHeaders, this.baseOptions.headers, { | ||
| 'Accept': 'application/json', | ||
| }, _params.headers), | ||
| axiosOptions: { | ||
| signal: _params.signal, | ||
| }, | ||
| }), | ||
| }; | ||
| return this.createRequest(parameters); | ||
| }; | ||
| AccountManagementV4.DEFAULT_SERVICE_URL = 'https://accounts.test.cloud.ibm.com'; | ||
| AccountManagementV4.DEFAULT_SERVICE_NAME = 'account_management'; | ||
| return AccountManagementV4; | ||
| }(ibm_cloud_sdk_core_1.BaseService)); | ||
| module.exports = AccountManagementV4; | ||
| //# sourceMappingURL=v4.js.map |
| {"version":3,"file":"v4.js","sourceRoot":"","sources":["../../account-management/v4.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AAEH,+BAAiC;AAEjC,yDAO4B;AAC5B,wCAA8C;AA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,mCAAc,EAAC,OAAO,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC;QACjF,IAAI,iBAAiB,EAAE;YACrB,OAAO,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;SAC1C;QAED,IAAM,IAAI,GAAG;YACX,YAAY,EAAE,OAAO,CAAC,SAAS;SAChC,CAAC;QAEF,IAAM,UAAU,GAAG,IAAA,sBAAa,EAAC,mBAAmB,CAAC,oBAAoB,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QAE/F,IAAM,UAAU,GAAG;YACjB,OAAO,EAAE;gBACP,GAAG,EAAE,2BAA2B;gBAChC,MAAM,EAAE,KAAK;gBACb,IAAI,MAAA;aACL;YACD,cAAc,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE;gBACjD,OAAO,EAAE,MAAM,CACb,IAAI,EACJ,UAAU,EACV,IAAI,CAAC,WAAW,CAAC,OAAO,EACxB;oBACE,QAAQ,EAAE,kBAAkB;iBAC7B,EACD,OAAO,CAAC,OAAO,CAChB;gBACD,YAAY,EAAE;oBACZ,MAAM,EAAE,OAAO,CAAC,MAAM;iBACvB;aACF,CAAC;SACH,CAAC;QAEF,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IA9GM,uCAAmB,GAAW,qCAAqC,CAAC;IAEpE,wCAAoB,GAAW,oBAAoB,CAAC;IA6G7D,0BAAC;CAAA,AAhHD,CAAkC,gCAAW,GAgH5C;AAuED,iBAAS,mBAAmB,CAAC"} |
| /** | ||
| * @jest-environment node | ||
| */ | ||
| /** | ||
| * (C) Copyright IBM Corp. 2026. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| /* eslint-disable no-console */ | ||
| const AccountManagementV4 = require('../dist/account-management/v4'); | ||
| // eslint-disable-next-line node/no-unpublished-require | ||
| const authHelper = require('../test/resources/auth-helper.js'); | ||
| // You can use the readExternalSources method to access additional configuration values | ||
| // const { readExternalSources } = require('ibm-cloud-sdk-core'); | ||
| // | ||
| // This file provides an example of how to use the account_management service. | ||
| // | ||
| // The following configuration properties are assumed to be defined: | ||
| // ACCOUNT_MANAGEMENT_URL=<service base url> | ||
| // ACCOUNT_MANAGEMENT_AUTH_TYPE=iam | ||
| // ACCOUNT_MANAGEMENT_APIKEY=<IAM apikey> | ||
| // ACCOUNT_MANAGEMENT_AUTH_URL=<IAM token service base URL - omit this if using the production environment> | ||
| // | ||
| // These configuration properties can be exported as environment variables, or stored | ||
| // in a configuration file and then: | ||
| // export IBM_CREDENTIALS_FILE=<name of configuration file> | ||
| // | ||
| const configFile = 'account_management_v4.env'; | ||
| const describe = authHelper.prepareTests(configFile); | ||
| // Save original console.log | ||
| const originalLog = console.log; | ||
| const originalWarn = console.warn; | ||
| // Mocks for console.log and console.warn | ||
| const consoleLogMock = jest.spyOn(console, 'log'); | ||
| const consoleWarnMock = jest.spyOn(console, 'warn'); | ||
| describe('AccountManagementV4', () => { | ||
| // Service instance | ||
| let accountManagementService; | ||
| // To access additional configuration values, uncomment this line and extract the values from config | ||
| // const config = readExternalSources(AccountManagementV4.DEFAULT_SERVICE_NAME); | ||
| test('Initialize service', async () => { | ||
| // begin-common | ||
| accountManagementService = AccountManagementV4.newInstance(); | ||
| // end-common | ||
| }); | ||
| test('getAccount request example', async () => { | ||
| consoleLogMock.mockImplementation((output) => { | ||
| originalLog(output); | ||
| }); | ||
| consoleWarnMock.mockImplementation((output) => { | ||
| // if an error occurs, display the message and then fail the test | ||
| originalWarn(output); | ||
| expect(true).toBeFalsy(); | ||
| }); | ||
| originalLog('getAccount() result:'); | ||
| // begin-getAccount | ||
| const params = { | ||
| accountId: 'testString', | ||
| }; | ||
| let res; | ||
| try { | ||
| res = await accountManagementService.getAccount(params); | ||
| console.log(JSON.stringify(res.result, null, 2)); | ||
| } catch (err) { | ||
| console.warn(err); | ||
| } | ||
| // end-getAccount | ||
| }); | ||
| }); |
+1
-1
| { | ||
| "name": "@ibm-cloud/platform-services", | ||
| "version": "0.81.3", | ||
| "version": "0.82.0", | ||
| "description": "Node.js client library for IBM Cloud Platform Services", | ||
@@ -5,0 +5,0 @@ "repository": { |
+1
-0
@@ -73,2 +73,3 @@ [](https://github.com/IBM/platform-services-node-sdk/actions/workflows/build.yaml) | ||
| --- | --- | ||
| [Account Management](https://test.cloud.ibm.com/apidocs/account-management) | @ibm-cloud/platform-services/account-management/v4 | ||
| [Case Management](https://cloud.ibm.com/apidocs/case-management?code=node) | @ibm-cloud/platform-services/case-management/v1 | ||
@@ -75,0 +76,0 @@ [Catalog Management](https://cloud.ibm.com/apidocs/resource-catalog/private-catalog?code=node) | @ibm-cloud/platform-services/catalog-management/v1 |
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
4324864
0.39%103
4.04%76006
0.47%141
0.71%34
3.03%