|
11 | 11 |
|
12 | 12 | /* tslint:disable:no-unused-locals */
|
13 | 13 | import { AccountDetail } from '../model/accountDetail';
|
| 14 | +import { StpGroup } from '../model/stpGroup'; |
| 15 | +import { StpGroupUser } from '../model/stpGroupUser'; |
14 | 16 | import { ObjectSerializer } from '../model/models';
|
15 | 17 | import { ApiClient } from './apiClient';
|
16 | 18 | import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
@@ -56,4 +58,197 @@ export class AccountApi {
|
56 | 58 | const authSettings = ['apiv4'];
|
57 | 59 | return this.client.request<AccountDetail>(config, 'AccountDetail', authSettings);
|
58 | 60 | }
|
| 61 | + |
| 62 | + /** |
| 63 | + * Retrieve the list of STP groups created by the main account user only |
| 64 | + * @summary List STP Groups |
| 65 | + * @param opts Optional parameters |
| 66 | + * @param opts.name Perform a fuzzy search based on the name |
| 67 | + */ |
| 68 | + public async listSTPGroups(opts: { name?: string }): Promise<{ response: AxiosResponse; body: Array<StpGroup> }> { |
| 69 | + const localVarPath = this.client.basePath + '/account/stp_groups'; |
| 70 | + const localVarQueryParameters: any = {}; |
| 71 | + const localVarHeaderParams: any = (<any>Object).assign({}, this.client.defaultHeaders); |
| 72 | + const produces = ['application/json']; |
| 73 | + // give precedence to 'application/json' |
| 74 | + if (produces.indexOf('application/json') >= 0) { |
| 75 | + localVarHeaderParams.Accept = 'application/json'; |
| 76 | + } else { |
| 77 | + localVarHeaderParams.Accept = produces.join(','); |
| 78 | + } |
| 79 | + |
| 80 | + opts = opts || {}; |
| 81 | + if (opts.name !== undefined) { |
| 82 | + localVarQueryParameters['name'] = ObjectSerializer.serialize(opts.name, 'string'); |
| 83 | + } |
| 84 | + |
| 85 | + const config: AxiosRequestConfig = { |
| 86 | + method: 'GET', |
| 87 | + params: localVarQueryParameters, |
| 88 | + headers: localVarHeaderParams, |
| 89 | + url: localVarPath, |
| 90 | + }; |
| 91 | + |
| 92 | + const authSettings = ['apiv4']; |
| 93 | + return this.client.request<Array<StpGroup>>(config, 'Array<StpGroup>', authSettings); |
| 94 | + } |
| 95 | + |
| 96 | + /** |
| 97 | + * Only the main account is allowed to create a new STP user group |
| 98 | + * @summary Create STP Group |
| 99 | + * @param stpGroup |
| 100 | + */ |
| 101 | + public async createSTPGroup(stpGroup: StpGroup): Promise<{ response: AxiosResponse; body: StpGroup }> { |
| 102 | + const localVarPath = this.client.basePath + '/account/stp_groups'; |
| 103 | + const localVarQueryParameters: any = {}; |
| 104 | + const localVarHeaderParams: any = (<any>Object).assign({}, this.client.defaultHeaders); |
| 105 | + const produces = ['application/json']; |
| 106 | + // give precedence to 'application/json' |
| 107 | + if (produces.indexOf('application/json') >= 0) { |
| 108 | + localVarHeaderParams.Accept = 'application/json'; |
| 109 | + } else { |
| 110 | + localVarHeaderParams.Accept = produces.join(','); |
| 111 | + } |
| 112 | + |
| 113 | + // verify required parameter 'stpGroup' is not null or undefined |
| 114 | + if (stpGroup === null || stpGroup === undefined) { |
| 115 | + throw new Error('Required parameter stpGroup was null or undefined when calling createSTPGroup.'); |
| 116 | + } |
| 117 | + |
| 118 | + const config: AxiosRequestConfig = { |
| 119 | + method: 'POST', |
| 120 | + params: localVarQueryParameters, |
| 121 | + headers: localVarHeaderParams, |
| 122 | + url: localVarPath, |
| 123 | + data: ObjectSerializer.serialize(stpGroup, 'StpGroup'), |
| 124 | + }; |
| 125 | + |
| 126 | + const authSettings = ['apiv4']; |
| 127 | + return this.client.request<StpGroup>(config, 'StpGroup', authSettings); |
| 128 | + } |
| 129 | + |
| 130 | + /** |
| 131 | + * Only the main account that created this STP group is allowed to list the user ID of the STP group |
| 132 | + * @summary List users of the STP group |
| 133 | + * @param stpId STP Group ID |
| 134 | + */ |
| 135 | + public async listSTPGroupsUsers(stpId: number): Promise<{ response: AxiosResponse; body: Array<StpGroupUser> }> { |
| 136 | + const localVarPath = |
| 137 | + this.client.basePath + |
| 138 | + '/account/stp_groups/{stp_id}/users'.replace('{' + 'stp_id' + '}', encodeURIComponent(String(stpId))); |
| 139 | + const localVarQueryParameters: any = {}; |
| 140 | + const localVarHeaderParams: any = (<any>Object).assign({}, this.client.defaultHeaders); |
| 141 | + const produces = ['application/json']; |
| 142 | + // give precedence to 'application/json' |
| 143 | + if (produces.indexOf('application/json') >= 0) { |
| 144 | + localVarHeaderParams.Accept = 'application/json'; |
| 145 | + } else { |
| 146 | + localVarHeaderParams.Accept = produces.join(','); |
| 147 | + } |
| 148 | + |
| 149 | + // verify required parameter 'stpId' is not null or undefined |
| 150 | + if (stpId === null || stpId === undefined) { |
| 151 | + throw new Error('Required parameter stpId was null or undefined when calling listSTPGroupsUsers.'); |
| 152 | + } |
| 153 | + |
| 154 | + const config: AxiosRequestConfig = { |
| 155 | + method: 'GET', |
| 156 | + params: localVarQueryParameters, |
| 157 | + headers: localVarHeaderParams, |
| 158 | + url: localVarPath, |
| 159 | + }; |
| 160 | + |
| 161 | + const authSettings = ['apiv4']; |
| 162 | + return this.client.request<Array<StpGroupUser>>(config, 'Array<StpGroupUser>', authSettings); |
| 163 | + } |
| 164 | + |
| 165 | + /** |
| 166 | + * - Only the master account that created the STP user group is allowed to add users to the STP user group.- Only accounts under the main account are allowed to be added. Cross-account is not permitted |
| 167 | + * @summary Add users to the STP group |
| 168 | + * @param stpId STP Group ID |
| 169 | + * @param requestBody User ID |
| 170 | + */ |
| 171 | + public async addSTPGroupUsers( |
| 172 | + stpId: number, |
| 173 | + requestBody: Array<number>, |
| 174 | + ): Promise<{ response: AxiosResponse; body: Array<StpGroupUser> }> { |
| 175 | + const localVarPath = |
| 176 | + this.client.basePath + |
| 177 | + '/account/stp_groups/{stp_id}/users'.replace('{' + 'stp_id' + '}', encodeURIComponent(String(stpId))); |
| 178 | + const localVarQueryParameters: any = {}; |
| 179 | + const localVarHeaderParams: any = (<any>Object).assign({}, this.client.defaultHeaders); |
| 180 | + const produces = ['application/json']; |
| 181 | + // give precedence to 'application/json' |
| 182 | + if (produces.indexOf('application/json') >= 0) { |
| 183 | + localVarHeaderParams.Accept = 'application/json'; |
| 184 | + } else { |
| 185 | + localVarHeaderParams.Accept = produces.join(','); |
| 186 | + } |
| 187 | + |
| 188 | + // verify required parameter 'stpId' is not null or undefined |
| 189 | + if (stpId === null || stpId === undefined) { |
| 190 | + throw new Error('Required parameter stpId was null or undefined when calling addSTPGroupUsers.'); |
| 191 | + } |
| 192 | + |
| 193 | + // verify required parameter 'requestBody' is not null or undefined |
| 194 | + if (requestBody === null || requestBody === undefined) { |
| 195 | + throw new Error('Required parameter requestBody was null or undefined when calling addSTPGroupUsers.'); |
| 196 | + } |
| 197 | + |
| 198 | + const config: AxiosRequestConfig = { |
| 199 | + method: 'POST', |
| 200 | + params: localVarQueryParameters, |
| 201 | + headers: localVarHeaderParams, |
| 202 | + url: localVarPath, |
| 203 | + data: ObjectSerializer.serialize(requestBody, 'Array<number>'), |
| 204 | + }; |
| 205 | + |
| 206 | + const authSettings = ['apiv4']; |
| 207 | + return this.client.request<Array<StpGroupUser>>(config, 'Array<StpGroupUser>', authSettings); |
| 208 | + } |
| 209 | + |
| 210 | + /** |
| 211 | + * - 只允许创建此STP组的主账号删除STP用户组用户 - 只允许删除当前主账户下的账户,不允许跨主账户 |
| 212 | + * @summary STP用户组中删除用户 |
| 213 | + * @param stpId STP Group ID |
| 214 | + * @param requestBody User ID |
| 215 | + */ |
| 216 | + public async deleteSTPGroupUsers( |
| 217 | + stpId: number, |
| 218 | + requestBody: Array<number>, |
| 219 | + ): Promise<{ response: AxiosResponse; body: Array<StpGroupUser> }> { |
| 220 | + const localVarPath = |
| 221 | + this.client.basePath + |
| 222 | + '/account/stp_groups/{stp_id}/users'.replace('{' + 'stp_id' + '}', encodeURIComponent(String(stpId))); |
| 223 | + const localVarQueryParameters: any = {}; |
| 224 | + const localVarHeaderParams: any = (<any>Object).assign({}, this.client.defaultHeaders); |
| 225 | + const produces = ['application/json']; |
| 226 | + // give precedence to 'application/json' |
| 227 | + if (produces.indexOf('application/json') >= 0) { |
| 228 | + localVarHeaderParams.Accept = 'application/json'; |
| 229 | + } else { |
| 230 | + localVarHeaderParams.Accept = produces.join(','); |
| 231 | + } |
| 232 | + |
| 233 | + // verify required parameter 'stpId' is not null or undefined |
| 234 | + if (stpId === null || stpId === undefined) { |
| 235 | + throw new Error('Required parameter stpId was null or undefined when calling deleteSTPGroupUsers.'); |
| 236 | + } |
| 237 | + |
| 238 | + // verify required parameter 'requestBody' is not null or undefined |
| 239 | + if (requestBody === null || requestBody === undefined) { |
| 240 | + throw new Error('Required parameter requestBody was null or undefined when calling deleteSTPGroupUsers.'); |
| 241 | + } |
| 242 | + |
| 243 | + const config: AxiosRequestConfig = { |
| 244 | + method: 'DELETE', |
| 245 | + params: localVarQueryParameters, |
| 246 | + headers: localVarHeaderParams, |
| 247 | + url: localVarPath, |
| 248 | + data: ObjectSerializer.serialize(requestBody, 'Array<number>'), |
| 249 | + }; |
| 250 | + |
| 251 | + const authSettings = ['apiv4']; |
| 252 | + return this.client.request<Array<StpGroupUser>>(config, 'Array<StpGroupUser>', authSettings); |
| 253 | + } |
59 | 254 | }
|
0 commit comments