|
| 1 | +// TODO: better import syntax? |
| 2 | +import { BaseAPIRequestFactory, RequiredError } from './baseapi.ts'; |
| 3 | +import {Configuration} from '../configuration.ts'; |
| 4 | +import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http.ts'; |
| 5 | +import {ObjectSerializer} from '../models/ObjectSerializer.ts'; |
| 6 | +import {ApiException} from './exception.ts'; |
| 7 | +import {isCodeInRange} from '../util.ts'; |
| 8 | + |
| 9 | +import { IoK8sApimachineryPkgApisMetaV1APIGroup } from '../models/IoK8sApimachineryPkgApisMetaV1APIGroup.ts'; |
| 10 | + |
| 11 | +/** |
| 12 | + * no description |
| 13 | + */ |
| 14 | +export class AdmissionregistrationApiRequestFactory extends BaseAPIRequestFactory { |
| 15 | + |
| 16 | + /** |
| 17 | + * get information of a group |
| 18 | + */ |
| 19 | + public async getAdmissionregistrationAPIGroup(options?: Configuration): Promise<RequestContext> { |
| 20 | + let config = options || this.configuration; |
| 21 | + |
| 22 | + // Path Params |
| 23 | + const localVarPath = '/apis/admissionregistration.k8s.io/'; |
| 24 | + |
| 25 | + // Make Request Context |
| 26 | + const requestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); |
| 27 | + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") |
| 28 | + |
| 29 | + // Query Params |
| 30 | + |
| 31 | + // Header Params |
| 32 | + |
| 33 | + // Form Params |
| 34 | + |
| 35 | + |
| 36 | + // Body Params |
| 37 | + |
| 38 | + let authMethod = null; |
| 39 | + // Apply auth methods |
| 40 | + authMethod = config.authMethods["BearerToken"] |
| 41 | + if (authMethod) { |
| 42 | + await authMethod.applySecurityAuthentication(requestContext); |
| 43 | + } |
| 44 | + |
| 45 | + return requestContext; |
| 46 | + } |
| 47 | + |
| 48 | +} |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | +export class AdmissionregistrationApiResponseProcessor { |
| 53 | + |
| 54 | + /** |
| 55 | + * Unwraps the actual response sent by the server from the response context and deserializes the response content |
| 56 | + * to the expected objects |
| 57 | + * |
| 58 | + * @params response Response returned by the server for a request to getAdmissionregistrationAPIGroup |
| 59 | + * @throws ApiException if the response code was not in [200, 299] |
| 60 | + */ |
| 61 | + public async getAdmissionregistrationAPIGroup(response: ResponseContext): Promise<IoK8sApimachineryPkgApisMetaV1APIGroup > { |
| 62 | + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); |
| 63 | + if (isCodeInRange("200", response.httpStatusCode)) { |
| 64 | + const body: IoK8sApimachineryPkgApisMetaV1APIGroup = ObjectSerializer.deserialize( |
| 65 | + ObjectSerializer.parse(await response.body.text(), contentType), |
| 66 | + "IoK8sApimachineryPkgApisMetaV1APIGroup", "" |
| 67 | + ) as IoK8sApimachineryPkgApisMetaV1APIGroup; |
| 68 | + return body; |
| 69 | + } |
| 70 | + if (isCodeInRange("401", response.httpStatusCode)) { |
| 71 | + throw new ApiException<string>(response.httpStatusCode, "Unauthorized"); |
| 72 | + } |
| 73 | + |
| 74 | + // Work around for missing responses in specification, e.g. for petstore.yaml |
| 75 | + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { |
| 76 | + const body: IoK8sApimachineryPkgApisMetaV1APIGroup = ObjectSerializer.deserialize( |
| 77 | + ObjectSerializer.parse(await response.body.text(), contentType), |
| 78 | + "IoK8sApimachineryPkgApisMetaV1APIGroup", "" |
| 79 | + ) as IoK8sApimachineryPkgApisMetaV1APIGroup; |
| 80 | + return body; |
| 81 | + } |
| 82 | + |
| 83 | + let body = response.body || ""; |
| 84 | + throw new ApiException<string>(response.httpStatusCode, "Unknown API Status Code!\nBody: \"" + body + "\""); |
| 85 | + } |
| 86 | + |
| 87 | +} |
0 commit comments