-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathandroidFilesCompanyLevelApi.ts
171 lines (161 loc) · 8.12 KB
/
androidFilesCompanyLevelApi.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*
* The version of the OpenAPI document: v3
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
import Client from "../../client";
import {
AndroidApp,
AndroidAppsResponse,
AndroidCertificatesResponse,
ReprocessAndroidAppResponse,
RestServiceError,
UploadAndroidAppResponse,
UploadAndroidCertificateResponse,
ObjectSerializer
} from "../../typings/management/models";
import { IRequest } from "../../typings/requestOptions";
import Resource from "../resource";
export class AndroidFilesCompanyLevelApi extends Service {
private readonly API_BASEPATH: string = "https://management-test.adyen.com/v3";
private baseUrl: string;
public constructor(client: Client){
super(client);
this.baseUrl = this.createBaseUrl(this.API_BASEPATH);
}
/**
* @summary Get Android app
* @param companyId {@link string } The unique identifier of the company account.
* @param id {@link string } The unique identifier of the app.
* @param requestOptions {@link IRequest.Options }
* @return {@link AndroidApp }
*/
public async getAndroidApp(companyId: string, id: string, requestOptions?: IRequest.Options): Promise<AndroidApp> {
const endpoint = `${this.baseUrl}/companies/{companyId}/androidApps/{id}`
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)))
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
const resource = new Resource(this, endpoint);
const response = await getJsonResponse<string, AndroidApp>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "AndroidApp");
}
/**
* @summary Get a list of Android apps
* @param companyId {@link string } The unique identifier of the company account.
* @param requestOptions {@link IRequest.Options }
* @param pageNumber {@link number } The number of the page to fetch.
* @param pageSize {@link number } The number of items to have on a page, maximum 100. The default is 20 items on a page.
* @param packageName {@link string } The package name that uniquely identifies the Android app.
* @param versionCode {@link number } The version number of the app.
* @return {@link AndroidAppsResponse }
*/
public async listAndroidApps(companyId: string, pageNumber?: number, pageSize?: number, packageName?: string, versionCode?: number, requestOptions?: IRequest.Options): Promise<AndroidAppsResponse> {
const endpoint = `${this.baseUrl}/companies/{companyId}/androidApps`
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)));
const resource = new Resource(this, endpoint);
const hasDefinedQueryParams = pageNumber ?? pageSize ?? packageName ?? versionCode;
if(hasDefinedQueryParams) {
if(!requestOptions) requestOptions = {};
if(!requestOptions.params) requestOptions.params = {};
if(pageNumber) requestOptions.params["pageNumber"] = pageNumber;
if(pageSize) requestOptions.params["pageSize"] = pageSize;
if(packageName) requestOptions.params["packageName"] = packageName;
if(versionCode) requestOptions.params["versionCode"] = versionCode;
}
const response = await getJsonResponse<string, AndroidAppsResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "AndroidAppsResponse");
}
/**
* @summary Get a list of Android certificates
* @param companyId {@link string } The unique identifier of the company account.
* @param requestOptions {@link IRequest.Options }
* @param pageNumber {@link number } The number of the page to fetch.
* @param pageSize {@link number } The number of items to have on a page, maximum 100. The default is 20 items on a page.
* @param certificateName {@link string } The name of the certificate.
* @return {@link AndroidCertificatesResponse }
*/
public async listAndroidCertificates(companyId: string, pageNumber?: number, pageSize?: number, certificateName?: string, requestOptions?: IRequest.Options): Promise<AndroidCertificatesResponse> {
const endpoint = `${this.baseUrl}/companies/{companyId}/androidCertificates`
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)));
const resource = new Resource(this, endpoint);
const hasDefinedQueryParams = pageNumber ?? pageSize ?? certificateName;
if(hasDefinedQueryParams) {
if(!requestOptions) requestOptions = {};
if(!requestOptions.params) requestOptions.params = {};
if(pageNumber) requestOptions.params["pageNumber"] = pageNumber;
if(pageSize) requestOptions.params["pageSize"] = pageSize;
if(certificateName) requestOptions.params["certificateName"] = certificateName;
}
const response = await getJsonResponse<string, AndroidCertificatesResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "AndroidCertificatesResponse");
}
/**
* @summary Reprocess Android App
* @param companyId {@link string } The unique identifier of the company account.
* @param id {@link string } The unique identifier of the app.
* @param requestOptions {@link IRequest.Options }
* @return {@link ReprocessAndroidAppResponse }
*/
public async reprocessAndroidApp(companyId: string, id: string, requestOptions?: IRequest.Options): Promise<ReprocessAndroidAppResponse> {
const endpoint = `${this.baseUrl}/companies/{companyId}/androidApps/{id}`
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)))
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
const resource = new Resource(this, endpoint);
const response = await getJsonResponse<string, ReprocessAndroidAppResponse>(
resource,
"",
{ ...requestOptions, method: "PATCH" }
);
return ObjectSerializer.deserialize(response, "ReprocessAndroidAppResponse");
}
/**
* @summary Upload Android App
* @param companyId {@link string } The unique identifier of the company account.
* @param requestOptions {@link IRequest.Options }
* @return {@link UploadAndroidAppResponse }
*/
public async uploadAndroidApp(companyId: string, requestOptions?: IRequest.Options): Promise<UploadAndroidAppResponse> {
const endpoint = `${this.baseUrl}/companies/{companyId}/androidApps`
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)));
const resource = new Resource(this, endpoint);
const response = await getJsonResponse<string, UploadAndroidAppResponse>(
resource,
"",
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "UploadAndroidAppResponse");
}
/**
* @summary Upload Android Certificate
* @param companyId {@link string } The unique identifier of the company account.
* @param requestOptions {@link IRequest.Options }
* @return {@link UploadAndroidCertificateResponse }
*/
public async uploadAndroidCertificate(companyId: string, requestOptions?: IRequest.Options): Promise<UploadAndroidCertificateResponse> {
const endpoint = `${this.baseUrl}/companies/{companyId}/androidCertificates`
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)));
const resource = new Resource(this, endpoint);
const response = await getJsonResponse<string, UploadAndroidCertificateResponse>(
resource,
"",
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "UploadAndroidCertificateResponse");
}
}