ibm-cloud-sdk-core 4.0.0 → 4.0.2
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.
- package/.secrets.baseline +20 -30
- package/CHANGELOG.md +16 -4
- package/MIGRATION-V4.md +54 -0
- package/auth/authenticators/authenticator-interface.d.ts +3 -4
- package/auth/authenticators/authenticator-interface.js +1 -1
- package/auth/authenticators/authenticator.d.ts +5 -9
- package/auth/authenticators/authenticator.js +4 -8
- package/auth/authenticators/basic-authenticator.d.ts +12 -12
- package/auth/authenticators/basic-authenticator.js +12 -12
- package/auth/authenticators/bearer-token-authenticator.d.ts +11 -14
- package/auth/authenticators/bearer-token-authenticator.js +11 -14
- package/auth/authenticators/cloud-pak-for-data-authenticator.d.ts +15 -15
- package/auth/authenticators/cloud-pak-for-data-authenticator.js +15 -15
- package/auth/authenticators/container-authenticator.d.ts +23 -23
- package/auth/authenticators/container-authenticator.js +23 -23
- package/auth/authenticators/iam-authenticator.d.ts +20 -20
- package/auth/authenticators/iam-authenticator.js +20 -20
- package/auth/authenticators/iam-request-based-authenticator.d.ts +23 -25
- package/auth/authenticators/iam-request-based-authenticator.js +23 -25
- package/auth/authenticators/token-request-based-authenticator.d.ts +19 -24
- package/auth/authenticators/token-request-based-authenticator.js +19 -24
- package/auth/authenticators/vpc-instance-authenticator.d.ts +17 -16
- package/auth/authenticators/vpc-instance-authenticator.js +17 -16
- package/auth/token-managers/container-token-manager.d.ts +23 -25
- package/auth/token-managers/container-token-manager.js +23 -25
- package/auth/token-managers/cp4d-token-manager.d.ts +13 -13
- package/auth/token-managers/cp4d-token-manager.js +13 -13
- package/auth/token-managers/iam-request-based-token-manager.d.ts +26 -31
- package/auth/token-managers/iam-request-based-token-manager.js +26 -31
- package/auth/token-managers/iam-token-manager.d.ts +17 -16
- package/auth/token-managers/iam-token-manager.js +17 -16
- package/auth/token-managers/jwt-token-manager.d.ts +10 -13
- package/auth/token-managers/jwt-token-manager.js +13 -16
- package/auth/token-managers/token-manager.d.ts +23 -35
- package/auth/token-managers/token-manager.js +22 -34
- package/auth/token-managers/vpc-instance-token-manager.d.ts +15 -15
- package/auth/token-managers/vpc-instance-token-manager.js +15 -15
- package/auth/utils/get-authenticator-from-environment.d.ts +2 -2
- package/auth/utils/get-authenticator-from-environment.js +2 -2
- package/auth/utils/helpers.d.ts +34 -32
- package/auth/utils/helpers.js +34 -32
- package/auth/utils/read-external-sources.d.ts +2 -1
- package/auth/utils/read-external-sources.js +5 -4
- package/build/docs/ibm-cloud-sdk-core.atleastone.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.atmostone.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.authenticator._constructor_.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.authenticator.authenticate.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.authenticator.authenticationtype.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.authenticator.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.authenticatorinterface.authenticate.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice._constructor_.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice.configureservice.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice.createrequest.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.baseservice.enableretries.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice.getauthenticator.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.baseservice.setdefaultheaders.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice.setserviceurl.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator._constructor_.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator.authenticate.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator._constructor_.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.authenticate.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.buildrequestfileobject.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.checkcredentials.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator._constructor_.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.computebasicauthheader.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.constructserviceurl.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator._constructor_.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setcrtokenfilename.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setiamprofileid.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setiamprofilename.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.requesttoken.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setcrtokenfilename.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setiamprofileid.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setiamprofilename.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.cp4dtokenmanager._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.cp4dtokenmanager.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.fileobject.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.fileoptions.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.filestream.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.filewithmetadata.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.getauthenticatorfromenvironment.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.getcontenttype.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.getcurrenttime.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.getformat.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.getmissingparams.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.getnewlogger.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.getqueryparam.md +1 -5
- package/build/docs/ibm-cloud-sdk-core.iamauthenticator._constructor_.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.iamauthenticator.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator._constructor_.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.getrefreshtoken.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.md +7 -7
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.setclientidandsecret.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.setscope.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.getrefreshtoken.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.md +8 -8
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.requesttoken.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.savetokeninfo.md +1 -3
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.setclientidandsecret.md +3 -5
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.setscope.md +2 -4
- package/build/docs/ibm-cloud-sdk-core.iamrequestoptions.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.iamtokenmanager._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.iamtokenmanager.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.ishtml.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager._constructor_.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.requesttoken.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.savetokeninfo.md +1 -3
- package/build/docs/ibm-cloud-sdk-core.md +24 -24
- package/build/docs/ibm-cloud-sdk-core.onlyone.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.qs.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.readexternalsources.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.removesuffix.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.sdklogger.md +7 -7
- package/build/docs/ibm-cloud-sdk-core.streamtopromise.md +3 -1
- package/build/docs/ibm-cloud-sdk-core.striptrailingslash.md +4 -2
- package/build/docs/ibm-cloud-sdk-core.tokenmanager._constructor_.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.gettoken.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.md +15 -15
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.pacedrequesttoken.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.requesttoken.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.savetokeninfo.md +1 -3
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.setdisablesslverification.md +1 -3
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.setheaders.md +2 -4
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator._constructor_.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.authenticate.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.md +9 -9
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.setdisablesslverification.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.setheaders.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.tolowerkeys.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkforsuccessfulexecution.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkmediaheaders.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkurlandmethod.md +1 -3
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkuserheader.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.unittestutils.expecttobepromise.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.unittestutils.getoptions.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.useroptions.md +9 -9
- package/build/docs/ibm-cloud-sdk-core.validateinput.md +8 -2
- package/build/docs/ibm-cloud-sdk-core.validateparams.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.md +6 -6
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.setiamprofilecrn.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.setiamprofileid.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.setiamprofilecrn.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.setiamprofileid.md +2 -2
- package/docs/ibm-cloud-sdk-core.api.json +516 -241
- package/es/auth/authenticators/authenticator-interface.d.ts +3 -4
- package/es/auth/authenticators/authenticator-interface.js +1 -1
- package/es/auth/authenticators/authenticator.d.ts +5 -9
- package/es/auth/authenticators/authenticator.js +4 -8
- package/es/auth/authenticators/basic-authenticator.d.ts +12 -12
- package/es/auth/authenticators/basic-authenticator.js +12 -12
- package/es/auth/authenticators/bearer-token-authenticator.d.ts +11 -14
- package/es/auth/authenticators/bearer-token-authenticator.js +11 -14
- package/es/auth/authenticators/cloud-pak-for-data-authenticator.d.ts +15 -15
- package/es/auth/authenticators/cloud-pak-for-data-authenticator.js +15 -15
- package/es/auth/authenticators/container-authenticator.d.ts +23 -23
- package/es/auth/authenticators/container-authenticator.js +23 -23
- package/es/auth/authenticators/iam-authenticator.d.ts +20 -20
- package/es/auth/authenticators/iam-authenticator.js +20 -20
- package/es/auth/authenticators/iam-request-based-authenticator.d.ts +23 -25
- package/es/auth/authenticators/iam-request-based-authenticator.js +23 -25
- package/es/auth/authenticators/token-request-based-authenticator.d.ts +19 -24
- package/es/auth/authenticators/token-request-based-authenticator.js +19 -24
- package/es/auth/authenticators/vpc-instance-authenticator.d.ts +17 -16
- package/es/auth/authenticators/vpc-instance-authenticator.js +17 -16
- package/es/auth/token-managers/container-token-manager.d.ts +23 -25
- package/es/auth/token-managers/container-token-manager.js +23 -25
- package/es/auth/token-managers/cp4d-token-manager.d.ts +13 -13
- package/es/auth/token-managers/cp4d-token-manager.js +13 -13
- package/es/auth/token-managers/iam-request-based-token-manager.d.ts +26 -31
- package/es/auth/token-managers/iam-request-based-token-manager.js +26 -31
- package/es/auth/token-managers/iam-token-manager.d.ts +17 -16
- package/es/auth/token-managers/iam-token-manager.js +17 -16
- package/es/auth/token-managers/jwt-token-manager.d.ts +10 -13
- package/es/auth/token-managers/jwt-token-manager.js +13 -16
- package/es/auth/token-managers/token-manager.d.ts +23 -35
- package/es/auth/token-managers/token-manager.js +22 -34
- package/es/auth/token-managers/vpc-instance-token-manager.d.ts +15 -15
- package/es/auth/token-managers/vpc-instance-token-manager.js +15 -15
- package/es/auth/utils/get-authenticator-from-environment.d.ts +2 -2
- package/es/auth/utils/get-authenticator-from-environment.js +2 -2
- package/es/auth/utils/helpers.d.ts +34 -32
- package/es/auth/utils/helpers.js +34 -32
- package/es/auth/utils/read-external-sources.d.ts +2 -1
- package/es/auth/utils/read-external-sources.js +5 -4
- package/es/lib/base-service.d.ts +31 -32
- package/es/lib/base-service.js +31 -32
- package/es/lib/content-type.js +5 -5
- package/es/lib/get-new-logger.d.ts +2 -2
- package/es/lib/get-new-logger.js +2 -2
- package/es/lib/helper.d.ts +24 -31
- package/es/lib/helper.js +25 -32
- package/es/lib/querystring.d.ts +1 -1
- package/es/lib/querystring.js +3 -3
- package/es/lib/request-wrapper.d.ts +4 -6
- package/es/lib/request-wrapper.js +17 -23
- package/es/lib/sdk-test-helpers.d.ts +14 -19
- package/es/lib/sdk-test-helpers.js +14 -19
- package/es/lib/stream-to-promise.d.ts +3 -3
- package/es/lib/stream-to-promise.js +3 -3
- package/es/tsdoc-metadata.json +1 -1
- package/etc/ibm-cloud-sdk-core.api.md +12 -12
- package/ibm-cloud-sdk-core.d.ts +1402 -1449
- package/lib/base-service.d.ts +31 -32
- package/lib/base-service.js +31 -32
- package/lib/content-type.js +5 -5
- package/lib/get-new-logger.d.ts +2 -2
- package/lib/get-new-logger.js +2 -2
- package/lib/helper.d.ts +24 -31
- package/lib/helper.js +25 -32
- package/lib/querystring.d.ts +1 -1
- package/lib/querystring.js +3 -3
- package/lib/request-wrapper.d.ts +4 -6
- package/lib/request-wrapper.js +17 -23
- package/lib/sdk-test-helpers.d.ts +14 -19
- package/lib/sdk-test-helpers.js +14 -19
- package/lib/stream-to-promise.d.ts +3 -3
- package/lib/stream-to-promise.js +3 -3
- package/package.json +2 -2
- package/temp/ibm-cloud-sdk-core.api.json +516 -241
- package/temp/ibm-cloud-sdk-core.api.md +12 -12
- package/MIGRATION-V1.md +0 -42
package/es/auth/utils/helpers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2019,
|
|
2
|
+
* (C) Copyright IBM Corp. 2019, 2022.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -17,9 +17,9 @@ import { getMissingParams } from '../../lib/helper';
|
|
|
17
17
|
/**
|
|
18
18
|
* Compute and return a Basic Authorization header from a username and password.
|
|
19
19
|
*
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @returns
|
|
20
|
+
* @param username - The username or client id
|
|
21
|
+
* @param password - The password or client secret
|
|
22
|
+
* @returns a Basic Auth header with format "Basic <encoded-credentials>"
|
|
23
23
|
*/
|
|
24
24
|
export function computeBasicAuthHeader(username, password) {
|
|
25
25
|
const encodedCreds = Buffer.from(`${username}:${password}`).toString('base64');
|
|
@@ -31,11 +31,11 @@ function badCharAtAnEnd(value) {
|
|
|
31
31
|
return (value.startsWith('{') || value.startsWith('"') || value.endsWith('}') || value.endsWith('"'));
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* Checks credentials for common user mistakes of copying {, }, or " characters from the documentation
|
|
34
|
+
* Checks credentials for common user mistakes of copying \{, \}, or \" characters from the documentation
|
|
35
35
|
*
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
* @returns
|
|
36
|
+
* @param obj - the options object holding credentials
|
|
37
|
+
* @param credsToCheck - an array containing the keys of the credentials to check for problems
|
|
38
|
+
* @returns a string with the error message if there were problems, null if not
|
|
39
39
|
*/
|
|
40
40
|
export function checkCredentials(obj, credsToCheck) {
|
|
41
41
|
let errorMessage = '';
|
|
@@ -52,8 +52,11 @@ export function checkCredentials(obj, credsToCheck) {
|
|
|
52
52
|
return null;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
56
|
-
* @param
|
|
55
|
+
* Validates "options".
|
|
56
|
+
* @param options - a configuration options object
|
|
57
|
+
* @param requiredOptions - the list of properties that must be present in "options"
|
|
58
|
+
*
|
|
59
|
+
* @throws Error: "options" failed validation
|
|
57
60
|
*/
|
|
58
61
|
export function validateInput(options, requiredOptions) {
|
|
59
62
|
// check for required params
|
|
@@ -70,32 +73,33 @@ export function validateInput(options, requiredOptions) {
|
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
/**
|
|
73
|
-
*
|
|
76
|
+
* Gets the current time.
|
|
74
77
|
*
|
|
75
|
-
* @returns
|
|
78
|
+
* @returns the current time in seconds.
|
|
76
79
|
*/
|
|
77
80
|
export function getCurrentTime() {
|
|
78
81
|
return Math.floor(Date.now() / 1000);
|
|
79
82
|
}
|
|
80
83
|
/**
|
|
81
|
-
*
|
|
84
|
+
* Checks for only one of two elements being defined.
|
|
82
85
|
* Returns true if a is defined and b is undefined,
|
|
83
86
|
* or vice versa. Returns false if both are defined
|
|
84
87
|
* or both are undefined.
|
|
85
88
|
*
|
|
86
|
-
* @param
|
|
87
|
-
* @param
|
|
88
|
-
* @returns
|
|
89
|
+
* @param a - The first object
|
|
90
|
+
* @param b - The second object
|
|
91
|
+
* @returns true if and only if exactly one of a or b is defined
|
|
89
92
|
*/
|
|
90
93
|
export function onlyOne(a, b) {
|
|
91
94
|
return Boolean((a && !b) || (b && !a));
|
|
92
95
|
}
|
|
93
96
|
/**
|
|
94
|
-
*
|
|
97
|
+
* Removes a given suffix if it exists.
|
|
98
|
+
*
|
|
99
|
+
* @param str - the base string to operate on
|
|
100
|
+
* @param suffix - the suffix to remove, if present
|
|
95
101
|
*
|
|
96
|
-
* @
|
|
97
|
-
* @param {string} suffix - The suffix to remove, if present
|
|
98
|
-
* @returns {string}
|
|
102
|
+
* @returns the substring of "str" that remains after the suffix is removed
|
|
99
103
|
*/
|
|
100
104
|
export function removeSuffix(str, suffix) {
|
|
101
105
|
if (str.endsWith(suffix)) {
|
|
@@ -104,25 +108,23 @@ export function removeSuffix(str, suffix) {
|
|
|
104
108
|
return str;
|
|
105
109
|
}
|
|
106
110
|
/**
|
|
107
|
-
*
|
|
108
|
-
* Returns true if a or b is defined. Returns false if
|
|
109
|
-
* both are undefined.
|
|
111
|
+
* Checks for at least one of two elements being defined.
|
|
110
112
|
*
|
|
111
|
-
* @param
|
|
112
|
-
* @param
|
|
113
|
-
* @returns
|
|
113
|
+
* @param a - the first object
|
|
114
|
+
* @param b - the second object
|
|
115
|
+
* @returns true if a or b is defined; false if both are undefined
|
|
114
116
|
*/
|
|
115
117
|
export function atLeastOne(a, b) {
|
|
116
118
|
return Boolean(a || b);
|
|
117
119
|
}
|
|
118
120
|
/**
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
121
|
+
* Verifies that both properties are not specified.
|
|
122
|
+
*
|
|
123
|
+
* @param a - The first object
|
|
124
|
+
* @param b - The second object
|
|
122
125
|
*
|
|
123
|
-
* @
|
|
124
|
-
|
|
125
|
-
* @returns {boolean}
|
|
126
|
+
* @returns false if a and b are both defined, true otherwise
|
|
127
|
+
|
|
126
128
|
*/
|
|
127
129
|
export function atMostOne(a, b) {
|
|
128
130
|
return Boolean(!(a && b));
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* and will be converted to lower camel case.
|
|
6
6
|
*
|
|
7
7
|
* Only one source will be used at a time.
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
|
+
* @param serviceName - the service name prefix
|
|
9
10
|
*/
|
|
10
11
|
export declare function readExternalSources(serviceName: string): any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-restricted-syntax */
|
|
2
2
|
/**
|
|
3
|
-
* (C) Copyright IBM Corp. 2019,
|
|
3
|
+
* (C) Copyright IBM Corp. 2019, 2022.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -25,7 +25,8 @@ import { readCredentialsFile } from './file-reading-helpers';
|
|
|
25
25
|
* and will be converted to lower camel case.
|
|
26
26
|
*
|
|
27
27
|
* Only one source will be used at a time.
|
|
28
|
-
*
|
|
28
|
+
*
|
|
29
|
+
* @param serviceName - the service name prefix
|
|
29
30
|
*/
|
|
30
31
|
export function readExternalSources(serviceName) {
|
|
31
32
|
if (!serviceName) {
|
|
@@ -57,8 +58,8 @@ function getProperties(serviceName) {
|
|
|
57
58
|
* For example, if service.name is speech_to_text,
|
|
58
59
|
* env properties are SPEECH_TO_TEXT_USERNAME and SPEECH_TO_TEXT_PASSWORD
|
|
59
60
|
*
|
|
60
|
-
* @param
|
|
61
|
-
* @returns
|
|
61
|
+
* @param envObj - the object containing the credentials keyed by environment variables
|
|
62
|
+
* @returns the set of credentials
|
|
62
63
|
*/
|
|
63
64
|
function filterPropertiesByServiceName(envObj, serviceName) {
|
|
64
65
|
const credentials = {};
|
package/es/lib/base-service.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2014,
|
|
2
|
+
* (C) Copyright IBM Corp. 2014, 2022.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -63,40 +63,39 @@ export declare class BaseService {
|
|
|
63
63
|
private requestWrapperInstance;
|
|
64
64
|
/**
|
|
65
65
|
* Configuration values for a service.
|
|
66
|
-
*
|
|
67
|
-
* @param
|
|
66
|
+
*
|
|
67
|
+
* @param userOptions - the configuration options to set on the service instance.
|
|
68
|
+
* This should be an object with the following fields:
|
|
69
|
+
* - authenticator: (required) an Object used to authenticate requests to the service.
|
|
70
|
+
* - serviceUrl: (optional) the base url to use when contacting the service.
|
|
68
71
|
* The base url may differ between IBM Cloud regions.
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* @param {string} [userOptions.version] The API version date to use with the service,
|
|
72
|
-
* in "YYYY-MM-DD" format.
|
|
73
|
-
* @param {boolean} [userOptions.disableSslVerification] A flag that indicates
|
|
74
|
-
* whether verification of the token server's SSL certificate should be
|
|
72
|
+
* - headers: (optional) a set of HTTP headers that should be included with every request sent to the service
|
|
73
|
+
* - disableSslVerification: (optional) a flag that indicates whether verification of the server's SSL certificate should be
|
|
75
74
|
* disabled or not.
|
|
76
75
|
*/
|
|
77
76
|
constructor(userOptions: UserOptions);
|
|
78
77
|
/**
|
|
79
78
|
* Get the instance of the authenticator set on the service.
|
|
80
79
|
*
|
|
81
|
-
* @returns
|
|
80
|
+
* @returns the Authenticator instance
|
|
82
81
|
*/
|
|
83
82
|
getAuthenticator(): any;
|
|
84
83
|
/**
|
|
85
84
|
* Set the service URL to send requests to.
|
|
86
85
|
*
|
|
87
|
-
* @param
|
|
86
|
+
* @param url - the base URL for the service.
|
|
88
87
|
*/
|
|
89
88
|
setServiceUrl(url: string): void;
|
|
90
89
|
/**
|
|
91
90
|
* Set the HTTP headers to be sent in every request.
|
|
92
91
|
*
|
|
93
|
-
* @param
|
|
92
|
+
* @param headers - the map of headers to include in requests.
|
|
94
93
|
*/
|
|
95
94
|
setDefaultHeaders(headers: OutgoingHttpHeaders): void;
|
|
96
95
|
/**
|
|
97
96
|
* Turn request body compression on or off.
|
|
98
97
|
*
|
|
99
|
-
* @param
|
|
98
|
+
* @param setting - Will turn it on if 'true', off if 'false'.
|
|
100
99
|
*/
|
|
101
100
|
setEnableGzipCompression(setting: boolean): void;
|
|
102
101
|
/**
|
|
@@ -107,7 +106,7 @@ export declare class BaseService {
|
|
|
107
106
|
/**
|
|
108
107
|
* Enable retries for unfulfilled requests.
|
|
109
108
|
*
|
|
110
|
-
* @param
|
|
109
|
+
* @param retryOptions - the configuration for retries
|
|
111
110
|
*/
|
|
112
111
|
enableRetries(retryOptions?: RetryOptions): void;
|
|
113
112
|
/**
|
|
@@ -117,30 +116,30 @@ export declare class BaseService {
|
|
|
117
116
|
/**
|
|
118
117
|
* Configure the service using external configuration
|
|
119
118
|
*
|
|
120
|
-
* @param
|
|
119
|
+
* @param serviceName - the name of the service. This will be used to read from external
|
|
121
120
|
* configuration.
|
|
122
121
|
*/
|
|
123
122
|
protected configureService(serviceName: string): void;
|
|
124
123
|
/**
|
|
125
124
|
* Wrapper around `sendRequest` that enforces the request will be authenticated.
|
|
126
125
|
*
|
|
127
|
-
* @param
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
* @returns
|
|
126
|
+
* @param parameters - Service request options passed in by user.
|
|
127
|
+
* This should be an object with the following fields:
|
|
128
|
+
* - options.method: the http method
|
|
129
|
+
* - options.url: the path portion of the URL to be appended to the serviceUrl
|
|
130
|
+
* - options.path: the path parameters to be inserted into the URL
|
|
131
|
+
* - options.qs: the querystring to be included in the URL
|
|
132
|
+
* - options.body: the data to be sent as the request body
|
|
133
|
+
* - options.form: an object containing the key/value pairs for a www-form-urlencoded request.
|
|
134
|
+
* - options.formData: an object containing the contents for a multipart/form-data request
|
|
135
|
+
* The following processing is performed on formData values:
|
|
136
|
+
* - string: no special processing -- the value is sent as is
|
|
137
|
+
* - object: the value is converted to a JSON string before insertion into the form body
|
|
138
|
+
* - NodeJS.ReadableStream|Buffer|FileWithMetadata: sent as a file, with any associated metadata
|
|
139
|
+
* - array: each element of the array is sent as a separate form part using any special processing as described above
|
|
140
|
+
* - defaultOptions.serviceUrl: the base URL of the service
|
|
141
|
+
* - defaultOptions.headers: additional HTTP headers to be sent with the request
|
|
142
|
+
* @returns a Promise
|
|
144
143
|
*/
|
|
145
144
|
protected createRequest(parameters: any): Promise<any>;
|
|
146
145
|
private readOptionsFromExternalConfig;
|
package/es/lib/base-service.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2014,
|
|
2
|
+
* (C) Copyright IBM Corp. 2014, 2022.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -26,15 +26,14 @@ import { RequestWrapper } from './request-wrapper';
|
|
|
26
26
|
export class BaseService {
|
|
27
27
|
/**
|
|
28
28
|
* Configuration values for a service.
|
|
29
|
-
*
|
|
30
|
-
* @param
|
|
29
|
+
*
|
|
30
|
+
* @param userOptions - the configuration options to set on the service instance.
|
|
31
|
+
* This should be an object with the following fields:
|
|
32
|
+
* - authenticator: (required) an Object used to authenticate requests to the service.
|
|
33
|
+
* - serviceUrl: (optional) the base url to use when contacting the service.
|
|
31
34
|
* The base url may differ between IBM Cloud regions.
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* @param {string} [userOptions.version] The API version date to use with the service,
|
|
35
|
-
* in "YYYY-MM-DD" format.
|
|
36
|
-
* @param {boolean} [userOptions.disableSslVerification] A flag that indicates
|
|
37
|
-
* whether verification of the token server's SSL certificate should be
|
|
35
|
+
* - headers: (optional) a set of HTTP headers that should be included with every request sent to the service
|
|
36
|
+
* - disableSslVerification: (optional) a flag that indicates whether verification of the server's SSL certificate should be
|
|
38
37
|
* disabled or not.
|
|
39
38
|
*/
|
|
40
39
|
constructor(userOptions) {
|
|
@@ -75,7 +74,7 @@ export class BaseService {
|
|
|
75
74
|
/**
|
|
76
75
|
* Get the instance of the authenticator set on the service.
|
|
77
76
|
*
|
|
78
|
-
* @returns
|
|
77
|
+
* @returns the Authenticator instance
|
|
79
78
|
*/
|
|
80
79
|
getAuthenticator() {
|
|
81
80
|
return this.authenticator;
|
|
@@ -83,7 +82,7 @@ export class BaseService {
|
|
|
83
82
|
/**
|
|
84
83
|
* Set the service URL to send requests to.
|
|
85
84
|
*
|
|
86
|
-
* @param
|
|
85
|
+
* @param url - the base URL for the service.
|
|
87
86
|
*/
|
|
88
87
|
setServiceUrl(url) {
|
|
89
88
|
if (url) {
|
|
@@ -93,7 +92,7 @@ export class BaseService {
|
|
|
93
92
|
/**
|
|
94
93
|
* Set the HTTP headers to be sent in every request.
|
|
95
94
|
*
|
|
96
|
-
* @param
|
|
95
|
+
* @param headers - the map of headers to include in requests.
|
|
97
96
|
*/
|
|
98
97
|
setDefaultHeaders(headers) {
|
|
99
98
|
if (typeof headers !== 'object') {
|
|
@@ -105,7 +104,7 @@ export class BaseService {
|
|
|
105
104
|
/**
|
|
106
105
|
* Turn request body compression on or off.
|
|
107
106
|
*
|
|
108
|
-
* @param
|
|
107
|
+
* @param setting - Will turn it on if 'true', off if 'false'.
|
|
109
108
|
*/
|
|
110
109
|
setEnableGzipCompression(setting) {
|
|
111
110
|
this.requestWrapperInstance.setCompressRequestData(setting);
|
|
@@ -122,7 +121,7 @@ export class BaseService {
|
|
|
122
121
|
/**
|
|
123
122
|
* Enable retries for unfulfilled requests.
|
|
124
123
|
*
|
|
125
|
-
* @param
|
|
124
|
+
* @param retryOptions - the configuration for retries
|
|
126
125
|
*/
|
|
127
126
|
enableRetries(retryOptions) {
|
|
128
127
|
this.requestWrapperInstance.enableRetries(retryOptions);
|
|
@@ -136,7 +135,7 @@ export class BaseService {
|
|
|
136
135
|
/**
|
|
137
136
|
* Configure the service using external configuration
|
|
138
137
|
*
|
|
139
|
-
* @param
|
|
138
|
+
* @param serviceName - the name of the service. This will be used to read from external
|
|
140
139
|
* configuration.
|
|
141
140
|
*/
|
|
142
141
|
configureService(serviceName) {
|
|
@@ -152,23 +151,23 @@ export class BaseService {
|
|
|
152
151
|
/**
|
|
153
152
|
* Wrapper around `sendRequest` that enforces the request will be authenticated.
|
|
154
153
|
*
|
|
155
|
-
* @param
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
* @returns
|
|
154
|
+
* @param parameters - Service request options passed in by user.
|
|
155
|
+
* This should be an object with the following fields:
|
|
156
|
+
* - options.method: the http method
|
|
157
|
+
* - options.url: the path portion of the URL to be appended to the serviceUrl
|
|
158
|
+
* - options.path: the path parameters to be inserted into the URL
|
|
159
|
+
* - options.qs: the querystring to be included in the URL
|
|
160
|
+
* - options.body: the data to be sent as the request body
|
|
161
|
+
* - options.form: an object containing the key/value pairs for a www-form-urlencoded request.
|
|
162
|
+
* - options.formData: an object containing the contents for a multipart/form-data request
|
|
163
|
+
* The following processing is performed on formData values:
|
|
164
|
+
* - string: no special processing -- the value is sent as is
|
|
165
|
+
* - object: the value is converted to a JSON string before insertion into the form body
|
|
166
|
+
* - NodeJS.ReadableStream|Buffer|FileWithMetadata: sent as a file, with any associated metadata
|
|
167
|
+
* - array: each element of the array is sent as a separate form part using any special processing as described above
|
|
168
|
+
* - defaultOptions.serviceUrl: the base URL of the service
|
|
169
|
+
* - defaultOptions.headers: additional HTTP headers to be sent with the request
|
|
170
|
+
* @returns a Promise
|
|
172
171
|
*/
|
|
173
172
|
createRequest(parameters) {
|
|
174
173
|
// validate serviceUrl parameter has been set
|
package/es/lib/content-type.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable prettier/prettier */
|
|
2
2
|
/**
|
|
3
|
-
* (C) Copyright IBM Corp. 2019,
|
|
3
|
+
* (C) Copyright IBM Corp. 2019, 2022.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -39,8 +39,8 @@ const filenameContentTypes = {
|
|
|
39
39
|
/**
|
|
40
40
|
* Takes the beginning of an audio file and returns the associated content-type / mime type
|
|
41
41
|
*
|
|
42
|
-
* @param
|
|
43
|
-
* @return
|
|
42
|
+
* @param buffer - a Buffer containing at least the first 4 bytes of the file
|
|
43
|
+
* @return sthe contentType or undefined
|
|
44
44
|
*/
|
|
45
45
|
const fromHeader = (buffer) => {
|
|
46
46
|
const headerStr = buffer
|
|
@@ -56,8 +56,8 @@ const fromHeader = (buffer) => {
|
|
|
56
56
|
* Note: Blob and File objects include a .type property, but we're ignoring it because it's frequently either
|
|
57
57
|
* incorrect (e.g. video/ogg instead of audio/ogg) or else a different format than what's expected (e.g. audio/x-wav)
|
|
58
58
|
*
|
|
59
|
-
* @param
|
|
60
|
-
* @
|
|
59
|
+
* @param file - a String filename or url, or binary File/Blob object.
|
|
60
|
+
* @returns the content type
|
|
61
61
|
*/
|
|
62
62
|
const fromFilename = (file) => {
|
|
63
63
|
const ext = extname(
|
|
@@ -31,9 +31,9 @@ export interface SDKLogger {
|
|
|
31
31
|
* Additionally, the logger will be turned on automatically if the "NODE_DEBUG"
|
|
32
32
|
* environment variable is set to "axios".
|
|
33
33
|
*
|
|
34
|
-
* @param
|
|
34
|
+
* @param moduleName - the namespace for the logger. The name will appear in
|
|
35
35
|
* the logs and it will be the name used for configuring the log level.
|
|
36
36
|
*
|
|
37
|
-
* @returns
|
|
37
|
+
* @returns the new logger
|
|
38
38
|
*/
|
|
39
39
|
export declare function getNewLogger(moduleName: string): SDKLogger;
|
package/es/lib/get-new-logger.js
CHANGED
|
@@ -24,10 +24,10 @@ import logger from 'debug';
|
|
|
24
24
|
* Additionally, the logger will be turned on automatically if the "NODE_DEBUG"
|
|
25
25
|
* environment variable is set to "axios".
|
|
26
26
|
*
|
|
27
|
-
* @param
|
|
27
|
+
* @param moduleName - the namespace for the logger. The name will appear in
|
|
28
28
|
* the logs and it will be the name used for configuring the log level.
|
|
29
29
|
*
|
|
30
|
-
* @returns
|
|
30
|
+
* @returns the new logger
|
|
31
31
|
*/
|
|
32
32
|
export function getNewLogger(moduleName) {
|
|
33
33
|
const debug = logger(`${moduleName}:debug`);
|
package/es/lib/helper.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2014,
|
|
2
|
+
* (C) Copyright IBM Corp. 2014, 2022.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -35,31 +35,29 @@ export declare function isFileData(obj: any): obj is NodeJS.ReadableStream | Buf
|
|
|
35
35
|
export declare function isEmptyObject(obj: any): boolean;
|
|
36
36
|
/**
|
|
37
37
|
* This function retrieves the content type of the input.
|
|
38
|
-
* @param
|
|
39
|
-
* @returns
|
|
38
|
+
* @param inputData - The data to retrieve content type for.
|
|
39
|
+
* @returns the content type of the input.
|
|
40
40
|
*/
|
|
41
41
|
export declare function getContentType(inputData: NodeJS.ReadableStream | Buffer): Promise<string>;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
44
|
-
* @param
|
|
45
|
-
* @returns
|
|
43
|
+
* Strips trailing slashes from "url", if present.
|
|
44
|
+
* @param url - the url string
|
|
45
|
+
* @returns the url with any trailing slashes removed
|
|
46
46
|
*/
|
|
47
47
|
export declare function stripTrailingSlash(url: string): string;
|
|
48
48
|
/**
|
|
49
49
|
* Return a query parameter value from a URL
|
|
50
50
|
*
|
|
51
|
-
* @param
|
|
52
|
-
* @param
|
|
53
|
-
*
|
|
54
|
-
* @returns {string} the value of the `param` query parameter
|
|
55
|
-
* @throws if urlStr is an invalid URL
|
|
51
|
+
* @param urlStr - the url string.
|
|
52
|
+
* @param param - the name of the query parameter whose value should be returned
|
|
53
|
+
* @returns the value of the "param" query parameter
|
|
56
54
|
*/
|
|
57
55
|
export declare function getQueryParam(urlStr: string, param: string): string;
|
|
58
56
|
/**
|
|
59
57
|
* Validates that all required params are provided
|
|
60
58
|
* @param params - the method parameters.
|
|
61
59
|
* @param requires - the required parameter names.
|
|
62
|
-
* @returns
|
|
60
|
+
* @returns null if no errors found, otherwise an Error instance
|
|
63
61
|
*/
|
|
64
62
|
export declare function getMissingParams(params: {
|
|
65
63
|
[key: string]: any;
|
|
@@ -75,52 +73,47 @@ export declare function getMissingParams(params: {
|
|
|
75
73
|
* If null, then the "required params" check is bypassed.
|
|
76
74
|
* @param allParams - the names of all valid parameters.
|
|
77
75
|
* If null, then the "valid params" check is bypassed.
|
|
78
|
-
* @returns
|
|
76
|
+
* @returns null if no errors found, otherwise an Error instance
|
|
79
77
|
*/
|
|
80
78
|
export declare function validateParams(params: {
|
|
81
79
|
[key: string]: any;
|
|
82
80
|
}, requiredParams: string[], allParams: string[]): null | Error;
|
|
83
81
|
/**
|
|
84
82
|
* Return true if 'text' is html
|
|
85
|
-
* @param
|
|
86
|
-
* @returns
|
|
83
|
+
* @param text - The 'text' to analyze
|
|
84
|
+
* @returns true if 'text' has html tags
|
|
87
85
|
*/
|
|
88
86
|
export declare function isHTML(text: string): boolean;
|
|
89
87
|
/**
|
|
90
88
|
* Returns the first match from formats that is key the params map
|
|
91
89
|
* otherwise null
|
|
92
|
-
* @param
|
|
93
|
-
* @param
|
|
94
|
-
* @returns {string|null}
|
|
90
|
+
* @param params - The parameters.
|
|
91
|
+
* @param requires - The keys we want to check
|
|
95
92
|
*/
|
|
96
93
|
export declare function getFormat(params: {
|
|
97
94
|
[key: string]: any;
|
|
98
95
|
}, formats: string[]): string;
|
|
99
96
|
/**
|
|
100
97
|
* This function builds a `form-data` object for each file parameter.
|
|
101
|
-
* @param
|
|
102
|
-
* @
|
|
103
|
-
* @param {string} fileParam.filename The filename of the file.
|
|
104
|
-
* @param {string} fileParam.contentType The content type of the file.
|
|
105
|
-
* @returns {FileObject}
|
|
98
|
+
* @param fileParam - The FileWithMetadata instance that contains the file information
|
|
99
|
+
* @returns the FileObject instance
|
|
106
100
|
*/
|
|
107
101
|
export declare function buildRequestFileObject(fileParam: FileWithMetadata): Promise<FileObject>;
|
|
108
102
|
/**
|
|
109
103
|
* This function converts an object's keys to lower case.
|
|
110
104
|
* note: does not convert nested keys
|
|
111
|
-
* @param
|
|
112
|
-
* @returns
|
|
105
|
+
* @param obj - The object to convert the keys of.
|
|
106
|
+
* @returns the object with keys folded to lowercase
|
|
113
107
|
*/
|
|
114
108
|
export declare function toLowerKeys(obj: Object): Object;
|
|
115
109
|
/**
|
|
116
110
|
* Constructs a service URL by formatting a parameterized URL.
|
|
117
111
|
*
|
|
118
|
-
* @param
|
|
119
|
-
* @param
|
|
112
|
+
* @param parameterizedUrl - a URL that contains variable placeholders, e.g. '\{scheme\}://ibm.com'.
|
|
113
|
+
* @param defaultUrlVariables - a Map of variable names to default values.
|
|
120
114
|
* Each variable in the parameterized URL must have a default value specified in this map.
|
|
121
|
-
* @param
|
|
122
|
-
* If a variable is not provided in this map,
|
|
123
|
-
*
|
|
124
|
-
* @returns {string} The formatted URL with all variable placeholders replaced by values.
|
|
115
|
+
* @param providedUrlVariables - a Map of variable names to desired values.
|
|
116
|
+
* If a variable is not provided in this map, the default variable value will be used instead.
|
|
117
|
+
* @returns the formatted URL with all variable placeholders replaced by values.
|
|
125
118
|
*/
|
|
126
119
|
export declare function constructServiceUrl(parameterizedUrl: string, defaultUrlVariables: Map<string, string>, providedUrlVariables: Map<string, string> | null): string;
|