|
| 1 | +import { serializeEnterpriseConfigurationV2025R0 } from '../schemas/v2025R0/enterpriseConfigurationV2025R0'; |
| 2 | +import { deserializeEnterpriseConfigurationV2025R0 } from '../schemas/v2025R0/enterpriseConfigurationV2025R0'; |
| 3 | +import { serializeClientErrorV2025R0 } from '../schemas/v2025R0/clientErrorV2025R0'; |
| 4 | +import { deserializeClientErrorV2025R0 } from '../schemas/v2025R0/clientErrorV2025R0'; |
| 5 | +import { serializeBoxVersionHeaderV2025R0 } from '../parameters/v2025R0/boxVersionHeaderV2025R0'; |
| 6 | +import { deserializeBoxVersionHeaderV2025R0 } from '../parameters/v2025R0/boxVersionHeaderV2025R0'; |
| 7 | +import { ResponseFormat } from '../networking/fetchOptions'; |
| 8 | +import { EnterpriseConfigurationV2025R0 } from '../schemas/v2025R0/enterpriseConfigurationV2025R0'; |
| 9 | +import { ClientErrorV2025R0 } from '../schemas/v2025R0/clientErrorV2025R0'; |
| 10 | +import { BoxVersionHeaderV2025R0 } from '../parameters/v2025R0/boxVersionHeaderV2025R0'; |
| 11 | +import { BoxSdkError } from '../box/errors'; |
| 12 | +import { Authentication } from '../networking/auth'; |
| 13 | +import { NetworkSession } from '../networking/network'; |
| 14 | +import { FetchOptions } from '../networking/fetchOptions'; |
| 15 | +import { FetchResponse } from '../networking/fetchResponse'; |
| 16 | +import { prepareParams } from '../internal/utils'; |
| 17 | +import { toString } from '../internal/utils'; |
| 18 | +import { ByteStream } from '../internal/utils'; |
| 19 | +import { CancellationToken } from '../internal/utils'; |
| 20 | +import { sdToJson } from '../serialization/json'; |
| 21 | +import { SerializedData } from '../serialization/json'; |
| 22 | +import { sdIsEmpty } from '../serialization/json'; |
| 23 | +import { sdIsBoolean } from '../serialization/json'; |
| 24 | +import { sdIsNumber } from '../serialization/json'; |
| 25 | +import { sdIsString } from '../serialization/json'; |
| 26 | +import { sdIsList } from '../serialization/json'; |
| 27 | +import { sdIsMap } from '../serialization/json'; |
| 28 | +export class GetEnterpriseConfigurationByIdV2025R0Optionals { |
| 29 | + readonly headers: GetEnterpriseConfigurationByIdV2025R0Headers = |
| 30 | + new GetEnterpriseConfigurationByIdV2025R0Headers({}); |
| 31 | + readonly cancellationToken?: CancellationToken = void 0; |
| 32 | + constructor( |
| 33 | + fields: Omit< |
| 34 | + GetEnterpriseConfigurationByIdV2025R0Optionals, |
| 35 | + 'headers' | 'cancellationToken' |
| 36 | + > & |
| 37 | + Partial< |
| 38 | + Pick< |
| 39 | + GetEnterpriseConfigurationByIdV2025R0Optionals, |
| 40 | + 'headers' | 'cancellationToken' |
| 41 | + > |
| 42 | + >, |
| 43 | + ) { |
| 44 | + if (fields.headers !== undefined) { |
| 45 | + this.headers = fields.headers; |
| 46 | + } |
| 47 | + if (fields.cancellationToken !== undefined) { |
| 48 | + this.cancellationToken = fields.cancellationToken; |
| 49 | + } |
| 50 | + } |
| 51 | +} |
| 52 | +export interface GetEnterpriseConfigurationByIdV2025R0OptionalsInput { |
| 53 | + readonly headers?: GetEnterpriseConfigurationByIdV2025R0Headers; |
| 54 | + readonly cancellationToken?: undefined | CancellationToken; |
| 55 | +} |
| 56 | +export interface GetEnterpriseConfigurationByIdV2025R0QueryParams { |
| 57 | + /** |
| 58 | + * The comma-delimited list of the enterprise configuration categories. |
| 59 | + * Allowed values: `security`, `content_and_sharing`, `user_settings`, `shield`. */ |
| 60 | + readonly categories: string; |
| 61 | +} |
| 62 | +export class GetEnterpriseConfigurationByIdV2025R0Headers { |
| 63 | + /** |
| 64 | + * Version header. */ |
| 65 | + readonly boxVersion: BoxVersionHeaderV2025R0 = |
| 66 | + '2025.0' as BoxVersionHeaderV2025R0; |
| 67 | + /** |
| 68 | + * Extra headers that will be included in the HTTP request. */ |
| 69 | + readonly extraHeaders?: { |
| 70 | + readonly [key: string]: undefined | string; |
| 71 | + } = {}; |
| 72 | + constructor( |
| 73 | + fields: Omit< |
| 74 | + GetEnterpriseConfigurationByIdV2025R0Headers, |
| 75 | + 'boxVersion' | 'extraHeaders' |
| 76 | + > & |
| 77 | + Partial< |
| 78 | + Pick< |
| 79 | + GetEnterpriseConfigurationByIdV2025R0Headers, |
| 80 | + 'boxVersion' | 'extraHeaders' |
| 81 | + > |
| 82 | + >, |
| 83 | + ) { |
| 84 | + if (fields.boxVersion !== undefined) { |
| 85 | + this.boxVersion = fields.boxVersion; |
| 86 | + } |
| 87 | + if (fields.extraHeaders !== undefined) { |
| 88 | + this.extraHeaders = fields.extraHeaders; |
| 89 | + } |
| 90 | + } |
| 91 | +} |
| 92 | +export interface GetEnterpriseConfigurationByIdV2025R0HeadersInput { |
| 93 | + /** |
| 94 | + * Version header. */ |
| 95 | + readonly boxVersion?: BoxVersionHeaderV2025R0; |
| 96 | + /** |
| 97 | + * Extra headers that will be included in the HTTP request. */ |
| 98 | + readonly extraHeaders?: |
| 99 | + | undefined |
| 100 | + | { |
| 101 | + readonly [key: string]: undefined | string; |
| 102 | + }; |
| 103 | +} |
| 104 | +export class EnterpriseConfigurationsManager { |
| 105 | + readonly auth?: Authentication; |
| 106 | + readonly networkSession: NetworkSession = new NetworkSession({}); |
| 107 | + constructor( |
| 108 | + fields: Omit< |
| 109 | + EnterpriseConfigurationsManager, |
| 110 | + 'networkSession' | 'getEnterpriseConfigurationByIdV2025R0' |
| 111 | + > & |
| 112 | + Partial<Pick<EnterpriseConfigurationsManager, 'networkSession'>>, |
| 113 | + ) { |
| 114 | + if (fields.auth !== undefined) { |
| 115 | + this.auth = fields.auth; |
| 116 | + } |
| 117 | + if (fields.networkSession !== undefined) { |
| 118 | + this.networkSession = fields.networkSession; |
| 119 | + } |
| 120 | + } |
| 121 | + /** |
| 122 | + * Retrieves the configuration for an enterprise. |
| 123 | + * @param {string} enterpriseId The ID of the enterprise. |
| 124 | + Example: "3442311" |
| 125 | + * @param {GetEnterpriseConfigurationByIdV2025R0QueryParams} queryParams Query parameters of getEnterpriseConfigurationByIdV2025R0 method |
| 126 | + * @param {GetEnterpriseConfigurationByIdV2025R0OptionalsInput} optionalsInput |
| 127 | + * @returns {Promise<EnterpriseConfigurationV2025R0>} |
| 128 | + */ |
| 129 | + async getEnterpriseConfigurationByIdV2025R0( |
| 130 | + enterpriseId: string, |
| 131 | + queryParams: GetEnterpriseConfigurationByIdV2025R0QueryParams, |
| 132 | + optionalsInput: GetEnterpriseConfigurationByIdV2025R0OptionalsInput = {}, |
| 133 | + ): Promise<EnterpriseConfigurationV2025R0> { |
| 134 | + const optionals: GetEnterpriseConfigurationByIdV2025R0Optionals = |
| 135 | + new GetEnterpriseConfigurationByIdV2025R0Optionals({ |
| 136 | + headers: optionalsInput.headers, |
| 137 | + cancellationToken: optionalsInput.cancellationToken, |
| 138 | + }); |
| 139 | + const headers: any = optionals.headers; |
| 140 | + const cancellationToken: any = optionals.cancellationToken; |
| 141 | + const queryParamsMap: { |
| 142 | + readonly [key: string]: string; |
| 143 | + } = prepareParams({ |
| 144 | + ['categories']: toString(queryParams.categories) as string, |
| 145 | + }); |
| 146 | + const headersMap: { |
| 147 | + readonly [key: string]: string; |
| 148 | + } = prepareParams({ |
| 149 | + ...{ ['box-version']: toString(headers.boxVersion) as string }, |
| 150 | + ...headers.extraHeaders, |
| 151 | + }); |
| 152 | + const response: FetchResponse = |
| 153 | + await this.networkSession.networkClient.fetch( |
| 154 | + new FetchOptions({ |
| 155 | + url: ''.concat( |
| 156 | + this.networkSession.baseUrls.baseUrl, |
| 157 | + '/2.0/enterprise_configurations/', |
| 158 | + toString(enterpriseId) as string, |
| 159 | + ) as string, |
| 160 | + method: 'GET', |
| 161 | + params: queryParamsMap, |
| 162 | + headers: headersMap, |
| 163 | + responseFormat: 'json' as ResponseFormat, |
| 164 | + auth: this.auth, |
| 165 | + networkSession: this.networkSession, |
| 166 | + cancellationToken: cancellationToken, |
| 167 | + }), |
| 168 | + ); |
| 169 | + return { |
| 170 | + ...deserializeEnterpriseConfigurationV2025R0(response.data!), |
| 171 | + rawData: response.data!, |
| 172 | + }; |
| 173 | + } |
| 174 | +} |
| 175 | +export interface EnterpriseConfigurationsManagerInput { |
| 176 | + readonly auth?: Authentication; |
| 177 | + readonly networkSession?: NetworkSession; |
| 178 | +} |
0 commit comments