@commercetools/history-sdk 1.18.0 → 2.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.
- package/CHANGELOG.md +28 -0
- package/README.md +112 -22
- package/dist/commercetools-history-sdk.browser.cjs.js +127 -198
- package/dist/commercetools-history-sdk.browser.esm.js +127 -198
- package/dist/commercetools-history-sdk.cjs.dev.js +127 -198
- package/dist/commercetools-history-sdk.cjs.prod.js +127 -198
- package/dist/commercetools-history-sdk.esm.js +127 -198
- package/dist/declarations/src/ctp/ctp-client.d.ts +2 -2
- package/dist/declarations/src/generated/client/api-root.d.ts +18 -25
- package/dist/declarations/src/generated/client/by-project-key-by-resource-type-by-id-request-builder.d.ts +48 -54
- package/dist/declarations/src/generated/client/by-project-key-by-resource-type-request-builder.d.ts +51 -57
- package/dist/declarations/src/generated/client/by-project-key-request-builder.d.ts +50 -56
- package/dist/declarations/src/generated/index.d.ts +12 -19
- package/dist/declarations/src/generated/models/change-value.d.ts +332 -339
- package/dist/declarations/src/generated/models/change.d.ts +4492 -4499
- package/dist/declarations/src/generated/models/common.d.ts +1115 -1121
- package/dist/declarations/src/generated/models/label.d.ts +83 -90
- package/dist/declarations/src/generated/shared/utils/common-types.d.ts +26 -33
- package/dist/declarations/src/generated/shared/utils/middleware.d.ts +8 -15
- package/dist/declarations/src/generated/shared/utils/requests-utils.d.ts +13 -20
- package/dist/declarations/src/generated/shared/utils/uri-utils.d.ts +7 -14
- package/dist/declarations/src/index.d.ts +2 -2
- package/package.json +9 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @commercetools/history-sdk
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#154](https://github.com/commercetools/commercetools-sdk-typescript/pull/154) [`25f1dea`](https://github.com/commercetools/commercetools-sdk-typescript/commit/25f1dea23eccdfdda01e9144ec2afe968ead58f2) Thanks [@jherey](https://github.com/jherey)! - This is the first major release of the sdk client
|
|
8
|
+
|
|
9
|
+
## 1.20.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#146](https://github.com/commercetools/commercetools-sdk-typescript/pull/146) [`1f6f830`](https://github.com/commercetools/commercetools-sdk-typescript/commit/1f6f830bb25d98c15ac96e06635c5e2aa07fe1e8) Thanks [@ajimae](https://github.com/ajimae)! - release a new version of typescript
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#137](https://github.com/commercetools/commercetools-sdk-typescript/pull/137) [`f119f8a`](https://github.com/commercetools/commercetools-sdk-typescript/commit/f119f8a26255790a6faf3667e07b500497a08c21) Thanks [@github-actions](https://github.com/apps/github-actions)! - Update generated SDKs
|
|
18
|
+
|
|
19
|
+
## 1.19.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- [#120](https://github.com/commercetools/commercetools-sdk-typescript/pull/120) [`4d01dba`](https://github.com/commercetools/commercetools-sdk-typescript/commit/4d01dbac9cfe38faaa0a11d3154a016759856772) Thanks [@github-actions](https://github.com/apps/github-actions)! - Update generated SDKs
|
|
24
|
+
|
|
25
|
+
## 1.18.1
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- [#108](https://github.com/commercetools/commercetools-sdk-typescript/pull/108) [`026d91a`](https://github.com/commercetools/commercetools-sdk-typescript/commit/026d91a747b445b0913eabb7eb91ecc7f3eb257e) Thanks [@github-actions](https://github.com/apps/github-actions)! - Update generated SDKs
|
|
30
|
+
|
|
3
31
|
## 1.18.0
|
|
4
32
|
|
|
5
33
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -1,36 +1,126 @@
|
|
|
1
|
-
# Typescript SDK for commercetools Audit log APIs.
|
|
1
|
+
# Typescript SDK for commercetools Audit log (history) APIs.
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Usage examples
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
npm install --save @commercetools/history-sdk
|
|
7
|
-
```
|
|
5
|
+
### Browser environment
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
```html
|
|
8
|
+
<script src="https://unpkg.com/@commercetools/sdk-client-v2@latest/dist/commercetools-sdk-client-v2.umd.js"></script>
|
|
9
|
+
<script src="https://unpkg.com/@commercetools/history-sdk@latest/dist/commercetools-history-sdk.umd.js"></script>
|
|
10
|
+
```
|
|
10
11
|
|
|
11
12
|
```html
|
|
12
|
-
<script src="https://unpkg.com/browse/@commercetools/history-sdk/dist/history-sdk.umd.js"></script>
|
|
13
13
|
<script>
|
|
14
|
-
// global:
|
|
14
|
+
// global: @commercetools/sdk-client-v2
|
|
15
|
+
// global: @commercetools/history-sdk
|
|
16
|
+
;(function () {
|
|
17
|
+
// We can now access the sdk-client-v2 and history-sdk object as:
|
|
18
|
+
// const { ClientBuilder } = this['@commercetools/sdk-client-v2']
|
|
19
|
+
// const { createApiBuilderFromCtpClient } = this['@commercetools/history-sdk']
|
|
20
|
+
// or
|
|
21
|
+
// const { ClientBuilder } = window['@commercetools/sdk-client-v2']
|
|
22
|
+
// const { createApiBuilderFromCtpClient } = window['@commercetools/history-sdk']
|
|
23
|
+
})()
|
|
15
24
|
</script>
|
|
16
25
|
```
|
|
17
26
|
|
|
18
|
-
###
|
|
27
|
+
### Node environment
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install --save @commercetools/sdk-client-v2
|
|
31
|
+
npm install --save @commercetools/history-sdk
|
|
32
|
+
```
|
|
19
33
|
|
|
20
34
|
```ts
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
35
|
+
const {
|
|
36
|
+
ClientBuilder,
|
|
37
|
+
createAuthForClientCredentialsFlow,
|
|
38
|
+
createHttpClient,
|
|
39
|
+
} = require('@commercetools/sdk-client-v2')
|
|
40
|
+
const { createApiBuilderFromCtpClient } = require('@commercetools/history-sdk')
|
|
41
|
+
const fetch = require('node-fetch')
|
|
42
|
+
|
|
43
|
+
const projectKey = 'mc-project-key'
|
|
44
|
+
const authMiddlewareOptions = {
|
|
45
|
+
host: 'https://auth.europe-west1.gcp.commercetools.com',
|
|
46
|
+
projectKey,
|
|
47
|
+
credentials: {
|
|
48
|
+
clientId: 'mc-client-id',
|
|
49
|
+
clientSecret: 'mc-client-secrets',
|
|
50
|
+
},
|
|
51
|
+
oauthUri: 'https://auth.europe-west1.gcp.commercetools.com',
|
|
52
|
+
scopes: [`manage_project:${projectKey}`],
|
|
53
|
+
fetch,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const httpMiddlewareOptions = {
|
|
57
|
+
host: 'https://history.europe-west1.gcp.commercetools.com',
|
|
58
|
+
fetch,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const client = new ClientBuilder()
|
|
62
|
+
.withProjectKey(projectKey)
|
|
63
|
+
.withMiddleware(createAuthForClientCredentialsFlow(authMiddlewareOptions))
|
|
64
|
+
.withMiddleware(createHttpClient(httpMiddlewareOptions))
|
|
65
|
+
.withUserAgentMiddleware()
|
|
66
|
+
.build()
|
|
67
|
+
|
|
68
|
+
// or
|
|
69
|
+
const client = new ClientBuilder()
|
|
70
|
+
.withProjectKey(projectKey)
|
|
71
|
+
.withClientCredentialsFlow(authMiddlewareOptions)
|
|
72
|
+
.withHttpMiddleware(httpMiddlewareOptions)
|
|
73
|
+
.withUserAgentMiddleware()
|
|
74
|
+
.build()
|
|
75
|
+
|
|
76
|
+
const apiRoot = createApiBuilderFromCtpClient(client)
|
|
77
|
+
|
|
78
|
+
// calling the history-sdk functions
|
|
79
|
+
// get project details
|
|
80
|
+
apiRoot
|
|
81
|
+
.withProjectKey({ projectKey })
|
|
82
|
+
.recommendations()
|
|
83
|
+
.projectCategories()
|
|
84
|
+
.withProductId({
|
|
85
|
+
productId: product.id,
|
|
86
|
+
})
|
|
87
|
+
.get()
|
|
88
|
+
.execute()
|
|
89
|
+
.then((x) => {
|
|
90
|
+
/*...*/
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
apiRoot
|
|
94
|
+
.withProjectKey({ projectKey })
|
|
95
|
+
.imageSearch()
|
|
96
|
+
.post({
|
|
97
|
+
queryArgs: {
|
|
98
|
+
limit: 20,
|
|
99
|
+
},
|
|
100
|
+
body: image,
|
|
101
|
+
headers: {
|
|
102
|
+
'Content-Type': 'image/jpeg',
|
|
103
|
+
},
|
|
104
|
+
})
|
|
105
|
+
.execute()
|
|
106
|
+
.then((x) => {
|
|
107
|
+
/*...*/
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
// -----------------------------------------------------------------------
|
|
111
|
+
// The sdk-client-v2 also has support for the old syntax
|
|
24
112
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
113
|
+
createClient,
|
|
114
|
+
createHttpClient,
|
|
115
|
+
createAuthForClientCredentialsFlow,
|
|
116
|
+
} from '@commercetools/sdk-client-v2'
|
|
117
|
+
import { createApiBuilderFromCtpClient } from '@commercetools/history-sdk'
|
|
28
118
|
import fetch from 'node-fetch'
|
|
29
119
|
|
|
30
120
|
const projectKey = 'some_project_key'
|
|
31
121
|
|
|
32
|
-
const authMiddleware =
|
|
33
|
-
host: 'https://auth.europe-west1.gcp.commercetools.com
|
|
122
|
+
const authMiddleware = createAuthForClientCredentialsFlow({
|
|
123
|
+
host: 'https://auth.europe-west1.gcp.commercetools.com',
|
|
34
124
|
projectKey,
|
|
35
125
|
credentials: {
|
|
36
126
|
clientId: 'some_id',
|
|
@@ -39,7 +129,7 @@ const authMiddleware = createAuthMiddlewareForClientCredentialsFlow({
|
|
|
39
129
|
fetch,
|
|
40
130
|
})
|
|
41
131
|
|
|
42
|
-
const httpMiddleware =
|
|
132
|
+
const httpMiddleware = createHttpClient({
|
|
43
133
|
host: 'https://history.europe-west1.gcp.commercetools.com',
|
|
44
134
|
fetch,
|
|
45
135
|
})
|
|
@@ -48,10 +138,10 @@ const ctpClient = createClient({
|
|
|
48
138
|
middlewares: [authMiddleware, httpMiddleware],
|
|
49
139
|
})
|
|
50
140
|
|
|
51
|
-
const apiRoot
|
|
141
|
+
const apiRoot = createApiBuilderFromCtpClient(ctpClient)
|
|
52
142
|
|
|
53
143
|
apiRoot
|
|
54
|
-
.
|
|
144
|
+
.withProjectKey({ projectKey })
|
|
55
145
|
.recommendations()
|
|
56
146
|
.projectCategories()
|
|
57
147
|
.withProductId({
|
|
@@ -59,7 +149,7 @@ apiRoot
|
|
|
59
149
|
})
|
|
60
150
|
.get()
|
|
61
151
|
.execute()
|
|
62
|
-
.then(x => {
|
|
152
|
+
.then((x) => {
|
|
63
153
|
/*...*/
|
|
64
154
|
})
|
|
65
155
|
|
|
@@ -76,7 +166,7 @@ apiRoot
|
|
|
76
166
|
},
|
|
77
167
|
})
|
|
78
168
|
.execute()
|
|
79
|
-
.then(x => {
|
|
169
|
+
.then((x) => {
|
|
80
170
|
/*...*/
|
|
81
171
|
})
|
|
82
172
|
```
|
|
@@ -19,86 +19,36 @@ function _defineProperty(obj, key, value) {
|
|
|
19
19
|
return obj;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (enumerableOnly) {
|
|
29
|
-
symbols = symbols.filter(function (sym) {
|
|
30
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
keys.push.apply(keys, symbols);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return keys;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function _objectSpread2(target) {
|
|
41
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
42
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
43
|
-
|
|
44
|
-
if (i % 2) {
|
|
45
|
-
ownKeys(Object(source), true).forEach(function (key) {
|
|
46
|
-
_defineProperty(target, key, source[key]);
|
|
47
|
-
});
|
|
48
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
49
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
50
|
-
} else {
|
|
51
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
52
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return target;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function _classCallCheck(instance, Constructor) {
|
|
61
|
-
if (!(instance instanceof Constructor)) {
|
|
62
|
-
throw new TypeError("Cannot call a class as a function");
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function _defineProperties(target, props) {
|
|
67
|
-
for (var i = 0; i < props.length; i++) {
|
|
68
|
-
var descriptor = props[i];
|
|
69
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
70
|
-
descriptor.configurable = true;
|
|
71
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
72
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
77
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
78
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
79
|
-
return Constructor;
|
|
80
|
-
}
|
|
22
|
+
/**
|
|
23
|
+
* Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
|
|
24
|
+
* Please don't change this file manually but run `rmf-codegen generate <raml_file_path> -o <output_path> -t typescript_client` to update it.
|
|
25
|
+
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
|
|
26
|
+
*/
|
|
81
27
|
|
|
82
28
|
function isDefined(value) {
|
|
83
29
|
return typeof value !== 'undefined' && value !== null;
|
|
84
30
|
}
|
|
85
31
|
|
|
86
32
|
function cleanObject(obj) {
|
|
87
|
-
return Object.keys(obj).reduce(
|
|
88
|
-
|
|
33
|
+
return Object.keys(obj).reduce((result, key) => {
|
|
34
|
+
const value = obj[key];
|
|
89
35
|
|
|
90
36
|
if (Array.isArray(value)) {
|
|
91
|
-
|
|
37
|
+
const values = value.filter(isDefined);
|
|
92
38
|
|
|
93
39
|
if (!values.length) {
|
|
94
40
|
return result;
|
|
95
41
|
}
|
|
96
42
|
|
|
97
|
-
return
|
|
43
|
+
return { ...result,
|
|
44
|
+
[key]: values
|
|
45
|
+
};
|
|
98
46
|
}
|
|
99
47
|
|
|
100
48
|
if (isDefined(value)) {
|
|
101
|
-
return
|
|
49
|
+
return { ...result,
|
|
50
|
+
[key]: value
|
|
51
|
+
};
|
|
102
52
|
}
|
|
103
53
|
|
|
104
54
|
return result;
|
|
@@ -106,152 +56,145 @@ function cleanObject(obj) {
|
|
|
106
56
|
}
|
|
107
57
|
|
|
108
58
|
function formatQueryString(variableMap) {
|
|
109
|
-
|
|
110
|
-
|
|
59
|
+
const map = cleanObject(variableMap);
|
|
60
|
+
const result = querystring.stringify(map);
|
|
111
61
|
|
|
112
62
|
if (result === '') {
|
|
113
63
|
return '';
|
|
114
64
|
}
|
|
115
65
|
|
|
116
|
-
return
|
|
66
|
+
return `?${result}`;
|
|
117
67
|
}
|
|
118
68
|
|
|
119
69
|
function buildRelativeUri(commonRequest) {
|
|
120
|
-
|
|
70
|
+
const pathMap = commonRequest.pathVariables;
|
|
121
71
|
var uri = commonRequest.uriTemplate;
|
|
122
72
|
|
|
123
|
-
for (
|
|
124
|
-
uri = uri.replace(
|
|
73
|
+
for (const param in pathMap) {
|
|
74
|
+
uri = uri.replace(`{${param}}`, `${pathMap[param]}`);
|
|
125
75
|
}
|
|
126
76
|
|
|
127
|
-
|
|
128
|
-
return
|
|
77
|
+
const resQuery = formatQueryString(commonRequest.queryParams || {});
|
|
78
|
+
return `${uri}${resQuery}`;
|
|
129
79
|
}
|
|
130
80
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
_classCallCheck(this, ApiRequest);
|
|
134
|
-
|
|
81
|
+
class ApiRequest {
|
|
82
|
+
constructor(request, requestExecutor) {
|
|
135
83
|
this.requestExecutor = requestExecutor;
|
|
136
84
|
|
|
137
85
|
_defineProperty(this, "request", void 0);
|
|
138
86
|
|
|
139
|
-
this.request =
|
|
87
|
+
this.request = { ...request,
|
|
140
88
|
uri: buildRelativeUri(request)
|
|
141
|
-
}
|
|
89
|
+
};
|
|
142
90
|
}
|
|
143
91
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
return this.request;
|
|
148
|
-
}
|
|
149
|
-
}, {
|
|
150
|
-
key: "execute",
|
|
151
|
-
value: function execute() {
|
|
152
|
-
return this.requestExecutor(this.request);
|
|
153
|
-
}
|
|
154
|
-
}]);
|
|
92
|
+
clientRequest() {
|
|
93
|
+
return this.request;
|
|
94
|
+
}
|
|
155
95
|
|
|
156
|
-
|
|
157
|
-
|
|
96
|
+
execute() {
|
|
97
|
+
return this.requestExecutor(this.request);
|
|
98
|
+
}
|
|
158
99
|
|
|
159
|
-
|
|
160
|
-
function ByProjectKeyByResourceTypeByIDRequestBuilder(args) {
|
|
161
|
-
_classCallCheck(this, ByProjectKeyByResourceTypeByIDRequestBuilder);
|
|
100
|
+
}
|
|
162
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
|
|
104
|
+
* Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
|
|
105
|
+
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
|
|
106
|
+
*/
|
|
107
|
+
class ByProjectKeyByResourceTypeByIDRequestBuilder {
|
|
108
|
+
constructor(args) {
|
|
163
109
|
this.args = args;
|
|
164
110
|
}
|
|
165
111
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
}]);
|
|
179
|
-
|
|
180
|
-
return ByProjectKeyByResourceTypeByIDRequestBuilder;
|
|
181
|
-
}();
|
|
112
|
+
get(methodArgs) {
|
|
113
|
+
return new ApiRequest({
|
|
114
|
+
baseUri: this.args.baseUri,
|
|
115
|
+
method: 'GET',
|
|
116
|
+
uriTemplate: '/{projectKey}/{resourceType}/{ID}',
|
|
117
|
+
pathVariables: this.args.pathArgs,
|
|
118
|
+
headers: { ...(methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers)
|
|
119
|
+
},
|
|
120
|
+
queryParams: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.queryArgs
|
|
121
|
+
}, this.args.executeRequest);
|
|
122
|
+
}
|
|
182
123
|
|
|
183
|
-
|
|
184
|
-
function ByProjectKeyByResourceTypeRequestBuilder(args) {
|
|
185
|
-
_classCallCheck(this, ByProjectKeyByResourceTypeRequestBuilder);
|
|
124
|
+
}
|
|
186
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
|
|
128
|
+
* Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
|
|
129
|
+
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
|
|
130
|
+
*/
|
|
131
|
+
class ByProjectKeyByResourceTypeRequestBuilder {
|
|
132
|
+
constructor(args) {
|
|
187
133
|
this.args = args;
|
|
188
134
|
}
|
|
189
135
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}, {
|
|
200
|
-
key: "get",
|
|
201
|
-
value: function get(methodArgs) {
|
|
202
|
-
return new ApiRequest({
|
|
203
|
-
baseUri: this.args.baseUri,
|
|
204
|
-
method: 'GET',
|
|
205
|
-
uriTemplate: '/{projectKey}/{resourceType}',
|
|
206
|
-
pathVariables: this.args.pathArgs,
|
|
207
|
-
headers: _objectSpread2({}, methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers),
|
|
208
|
-
queryParams: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.queryArgs
|
|
209
|
-
}, this.args.executeRequest);
|
|
210
|
-
}
|
|
211
|
-
}]);
|
|
136
|
+
withIDValue(childPathArgs) {
|
|
137
|
+
return new ByProjectKeyByResourceTypeByIDRequestBuilder({
|
|
138
|
+
pathArgs: { ...this.args.pathArgs,
|
|
139
|
+
...childPathArgs
|
|
140
|
+
},
|
|
141
|
+
executeRequest: this.args.executeRequest,
|
|
142
|
+
baseUri: this.args.baseUri
|
|
143
|
+
});
|
|
144
|
+
}
|
|
212
145
|
|
|
213
|
-
|
|
214
|
-
|
|
146
|
+
get(methodArgs) {
|
|
147
|
+
return new ApiRequest({
|
|
148
|
+
baseUri: this.args.baseUri,
|
|
149
|
+
method: 'GET',
|
|
150
|
+
uriTemplate: '/{projectKey}/{resourceType}',
|
|
151
|
+
pathVariables: this.args.pathArgs,
|
|
152
|
+
headers: { ...(methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers)
|
|
153
|
+
},
|
|
154
|
+
queryParams: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.queryArgs
|
|
155
|
+
}, this.args.executeRequest);
|
|
156
|
+
}
|
|
215
157
|
|
|
216
|
-
|
|
217
|
-
function ByProjectKeyRequestBuilder(args) {
|
|
218
|
-
_classCallCheck(this, ByProjectKeyRequestBuilder);
|
|
158
|
+
}
|
|
219
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
|
|
162
|
+
* Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
|
|
163
|
+
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
|
|
164
|
+
*/
|
|
165
|
+
class ByProjectKeyRequestBuilder {
|
|
166
|
+
constructor(args) {
|
|
220
167
|
this.args = args;
|
|
221
168
|
}
|
|
222
169
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}]);
|
|
170
|
+
withResourceTypeValue(childPathArgs) {
|
|
171
|
+
return new ByProjectKeyByResourceTypeRequestBuilder({
|
|
172
|
+
pathArgs: { ...this.args.pathArgs,
|
|
173
|
+
...childPathArgs
|
|
174
|
+
},
|
|
175
|
+
executeRequest: this.args.executeRequest,
|
|
176
|
+
baseUri: this.args.baseUri
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
get(methodArgs) {
|
|
181
|
+
return new ApiRequest({
|
|
182
|
+
baseUri: this.args.baseUri,
|
|
183
|
+
method: 'GET',
|
|
184
|
+
uriTemplate: '/{projectKey}',
|
|
185
|
+
pathVariables: this.args.pathArgs,
|
|
186
|
+
headers: { ...(methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers)
|
|
187
|
+
},
|
|
188
|
+
queryParams: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.queryArgs
|
|
189
|
+
}, this.args.executeRequest);
|
|
190
|
+
}
|
|
245
191
|
|
|
246
|
-
|
|
247
|
-
}();
|
|
192
|
+
}
|
|
248
193
|
|
|
249
|
-
|
|
250
|
-
|
|
194
|
+
class ApiRoot {
|
|
195
|
+
constructor(args) {
|
|
251
196
|
var _args$baseUri;
|
|
252
197
|
|
|
253
|
-
_classCallCheck(this, ApiRoot);
|
|
254
|
-
|
|
255
198
|
_defineProperty(this, "executeRequest", void 0);
|
|
256
199
|
|
|
257
200
|
_defineProperty(this, "baseUri", void 0);
|
|
@@ -260,51 +203,37 @@ var ApiRoot = /*#__PURE__*/function () {
|
|
|
260
203
|
this.baseUri = (_args$baseUri = args.baseUri) !== null && _args$baseUri !== void 0 ? _args$baseUri : 'https://history.europe-west1.gcp.commercetools.com';
|
|
261
204
|
}
|
|
262
205
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
}]);
|
|
206
|
+
withProjectKeyValue(childPathArgs) {
|
|
207
|
+
return new ByProjectKeyRequestBuilder({
|
|
208
|
+
pathArgs: { ...childPathArgs
|
|
209
|
+
},
|
|
210
|
+
executeRequest: this.executeRequest,
|
|
211
|
+
baseUri: this.baseUri
|
|
212
|
+
});
|
|
213
|
+
}
|
|
273
214
|
|
|
274
|
-
|
|
275
|
-
}();
|
|
215
|
+
}
|
|
276
216
|
|
|
277
217
|
/**
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
* ,d88b.d88b,
|
|
283
|
-
* 88888888888
|
|
284
|
-
* `Y8888888Y'
|
|
285
|
-
* `Y888Y'
|
|
286
|
-
* `Y'
|
|
287
|
-
*
|
|
218
|
+
* Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
|
|
219
|
+
* Please don't change this file manually but run `rmf-codegen generate <raml_file_path> -o <output_path> -t typescript_client` to update it.
|
|
220
|
+
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
|
|
288
221
|
*/
|
|
289
|
-
|
|
222
|
+
const createExecutorFromMiddlewares = (executor, midds) => {
|
|
290
223
|
if (!midds || midds.length == 0) {
|
|
291
224
|
return executor;
|
|
292
225
|
}
|
|
293
226
|
|
|
294
|
-
|
|
227
|
+
const reduced = midds.reduce(reduceMiddleware);
|
|
295
228
|
return middlewareToExecutor(reduced, executor);
|
|
296
229
|
};
|
|
297
230
|
|
|
298
231
|
function reduceMiddleware(middleware1, middleware2) {
|
|
299
|
-
return
|
|
300
|
-
return middleware1(request, middlewareToExecutor(middleware2, executor));
|
|
301
|
-
};
|
|
232
|
+
return (request, executor) => middleware1(request, middlewareToExecutor(middleware2, executor));
|
|
302
233
|
}
|
|
303
234
|
|
|
304
235
|
function middlewareToExecutor(middleware, executor) {
|
|
305
|
-
return
|
|
306
|
-
return middleware(request, executor);
|
|
307
|
-
};
|
|
236
|
+
return request => middleware(request, executor);
|
|
308
237
|
}
|
|
309
238
|
|
|
310
239
|
function createApiBuilderFromCtpClient(ctpClient, baseUri) {
|