@api-client/core 0.14.4 → 0.14.6
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/build/src/sdk/GroupsSdk.d.ts +2 -0
- package/build/src/sdk/GroupsSdk.d.ts.map +1 -1
- package/build/src/sdk/GroupsSdk.js +64 -0
- package/build/src/sdk/GroupsSdk.js.map +1 -1
- package/build/src/sdk/RouteBuilder.d.ts +1 -0
- package/build/src/sdk/RouteBuilder.d.ts.map +1 -1
- package/build/src/sdk/RouteBuilder.js +3 -0
- package/build/src/sdk/RouteBuilder.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/data/models/example-generator-api.json +6 -6
- package/package.json +1 -1
- package/src/sdk/GroupsSdk.ts +64 -0
- package/src/sdk/RouteBuilder.ts +4 -0
|
@@ -42813,10 +42813,10 @@
|
|
|
42813
42813
|
"@id": "#210"
|
|
42814
42814
|
},
|
|
42815
42815
|
{
|
|
42816
|
-
"@id": "#
|
|
42816
|
+
"@id": "#216"
|
|
42817
42817
|
},
|
|
42818
42818
|
{
|
|
42819
|
-
"@id": "#
|
|
42819
|
+
"@id": "#213"
|
|
42820
42820
|
},
|
|
42821
42821
|
{
|
|
42822
42822
|
"@id": "#219"
|
|
@@ -44253,7 +44253,7 @@
|
|
|
44253
44253
|
"doc:ExternalDomainElement",
|
|
44254
44254
|
"doc:DomainElement"
|
|
44255
44255
|
],
|
|
44256
|
-
"doc:raw": "type: 'GENERAL'\
|
|
44256
|
+
"doc:raw": "-\n type: 'GENERAL'\n value: 'info@company.be'\n-\n type: 'IT_DEPT'\n value: 'it-service@company.be'\n",
|
|
44257
44257
|
"core:mediaType": "application/yaml",
|
|
44258
44258
|
"sourcemaps:sources": [
|
|
44259
44259
|
{
|
|
@@ -44274,7 +44274,7 @@
|
|
|
44274
44274
|
"doc:ExternalDomainElement",
|
|
44275
44275
|
"doc:DomainElement"
|
|
44276
44276
|
],
|
|
44277
|
-
"doc:raw": "
|
|
44277
|
+
"doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '21'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)21 302099'\n",
|
|
44278
44278
|
"core:mediaType": "application/yaml",
|
|
44279
44279
|
"sourcemaps:sources": [
|
|
44280
44280
|
{
|
|
@@ -45121,12 +45121,12 @@
|
|
|
45121
45121
|
{
|
|
45122
45122
|
"@id": "#215/source-map/lexical/element_0",
|
|
45123
45123
|
"sourcemaps:element": "amf://id#215",
|
|
45124
|
-
"sourcemaps:value": "[(1,0)-(
|
|
45124
|
+
"sourcemaps:value": "[(1,0)-(7,0)]"
|
|
45125
45125
|
},
|
|
45126
45126
|
{
|
|
45127
45127
|
"@id": "#218/source-map/lexical/element_0",
|
|
45128
45128
|
"sourcemaps:element": "amf://id#218",
|
|
45129
|
-
"sourcemaps:value": "[(1,0)-(
|
|
45129
|
+
"sourcemaps:value": "[(1,0)-(6,0)]"
|
|
45130
45130
|
},
|
|
45131
45131
|
{
|
|
45132
45132
|
"@id": "#221/source-map/lexical/element_0",
|
package/package.json
CHANGED
package/src/sdk/GroupsSdk.ts
CHANGED
|
@@ -147,4 +147,68 @@ export class GroupsSdk extends SdkBase {
|
|
|
147
147
|
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
+
|
|
151
|
+
async addUsers(oid: string, gid: string, uids: string[], request: SdkOptions = {}): Promise<GroupSchema> {
|
|
152
|
+
const { token } = request
|
|
153
|
+
const url = this.sdk.getUrl(RouteBuilder.groupUsers(oid, gid))
|
|
154
|
+
const body = JSON.stringify({ ids: uids })
|
|
155
|
+
const result = await this.sdk.http.post(url.toString(), {
|
|
156
|
+
token,
|
|
157
|
+
body,
|
|
158
|
+
headers: {
|
|
159
|
+
'content-type': 'application/json',
|
|
160
|
+
},
|
|
161
|
+
})
|
|
162
|
+
this.inspectCommonStatusCodes(result)
|
|
163
|
+
const E_PREFIX = 'Unable to add users to a group. '
|
|
164
|
+
if (result.status !== 200) {
|
|
165
|
+
this.logInvalidResponse(result)
|
|
166
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
167
|
+
}
|
|
168
|
+
if (!result.body) {
|
|
169
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
170
|
+
}
|
|
171
|
+
let data: GroupSchema
|
|
172
|
+
try {
|
|
173
|
+
data = JSON.parse(result.body)
|
|
174
|
+
} catch {
|
|
175
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
176
|
+
}
|
|
177
|
+
if (!data.key) {
|
|
178
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
179
|
+
}
|
|
180
|
+
return data
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
async removeUsers(oid: string, gid: string, uids: string[], request: SdkOptions = {}): Promise<GroupSchema> {
|
|
184
|
+
const { token } = request
|
|
185
|
+
const url = this.sdk.getUrl(RouteBuilder.groupUsers(oid, gid))
|
|
186
|
+
const body = JSON.stringify({ ids: uids })
|
|
187
|
+
const result = await this.sdk.http.delete(url.toString(), {
|
|
188
|
+
token,
|
|
189
|
+
body,
|
|
190
|
+
headers: {
|
|
191
|
+
'content-type': 'application/json',
|
|
192
|
+
},
|
|
193
|
+
})
|
|
194
|
+
this.inspectCommonStatusCodes(result)
|
|
195
|
+
const E_PREFIX = 'Unable to remove users from a group. '
|
|
196
|
+
if (result.status !== 200) {
|
|
197
|
+
this.logInvalidResponse(result)
|
|
198
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
199
|
+
}
|
|
200
|
+
if (!result.body) {
|
|
201
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
202
|
+
}
|
|
203
|
+
let data: GroupSchema
|
|
204
|
+
try {
|
|
205
|
+
data = JSON.parse(result.body)
|
|
206
|
+
} catch {
|
|
207
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
208
|
+
}
|
|
209
|
+
if (!data.key) {
|
|
210
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
211
|
+
}
|
|
212
|
+
return data
|
|
213
|
+
}
|
|
150
214
|
}
|
package/src/sdk/RouteBuilder.ts
CHANGED