• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Adyen / adyen-java-api-library / #2934

11 Dec 2023 05:06PM CUT coverage: 12.835%. First build
#2934

push

web-flow
Merge 0111dd892 into d70611050

173 of 797 new or added lines in 39 files covered. (21.71%)

12464 of 97111 relevant lines covered (12.83%)

0.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

26.67
/src/main/java/com/adyen/service/management/MyApiCredentialApi.java
1
/*
2
 * Management API
3
 *
4
 * The version of the OpenAPI document: 3
5
 * 
6
 *
7
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
8
 * https://openapi-generator.tech
9
 * Do not edit the class manually.
10
 */
11

12
package com.adyen.service.management;
13

14
import com.adyen.Client;
15
import com.adyen.Service;
16
import com.adyen.constants.ApiConstants;
17
import com.adyen.model.management.AllowedOrigin;
18
import com.adyen.model.management.AllowedOriginsResponse;
19
import com.adyen.model.management.CreateAllowedOriginRequest;
20
import com.adyen.model.management.GenerateClientKeyResponse;
21
import com.adyen.model.management.MeApiCredential;
22
import com.adyen.model.management.RestServiceError;
23
import com.adyen.model.RequestOptions;
24
import com.adyen.service.exception.ApiException;
25
import com.adyen.service.resource.Resource;
26

27
import java.io.IOException;
28
import java.util.HashMap;
29
import java.util.Map;
30

31
public class MyApiCredentialApi extends Service {
32

33
    public static final String API_VERSION = "3";
34

35
    protected String baseURL;
36

37
    /**
38
    *  constructor in {@link com.adyen.service.management package}.
39
    * @param client {@link Client } (required)
40
    */
41
    public MyApiCredentialApi(Client client) {
42
        super(client);
1✔
43
        this.baseURL = createBaseURL("https://management-test.adyen.com/v3");
1✔
44
    }
1✔
45

46
    /**
47
    *  constructor in {@link com.adyen.service.management package}.
48
    * Please use this constructor only if you would like to pass along your own url for routing or testing purposes. The latest API version is defined in this class as a constant.
49
    * @param client {@link Client } (required)
50
    * @param baseURL {@link String } (required)
51
    */
52
    public MyApiCredentialApi(Client client, String baseURL) {
53
        super(client);
×
54
        this.baseURL = baseURL;
×
55
    }
×
56

57
    /**
58
    * Add allowed origin
59
    *
60
    * @param createAllowedOriginRequest {@link CreateAllowedOriginRequest }  (required)
61
    * @return {@link AllowedOrigin }
62
    * @throws ApiException if fails to make API call
63
    */
64
    public AllowedOrigin addAllowedOrigin(CreateAllowedOriginRequest createAllowedOriginRequest) throws ApiException, IOException {
NEW
65
        return addAllowedOrigin(createAllowedOriginRequest, null);
×
66
    }
67

68
    /**
69
    * Add allowed origin
70
    *
71
    * @param createAllowedOriginRequest {@link CreateAllowedOriginRequest }  (required)
72
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
73
    * @return {@link AllowedOrigin }
74
    * @throws ApiException if fails to make API call
75
    */
76
    public AllowedOrigin addAllowedOrigin(CreateAllowedOriginRequest createAllowedOriginRequest, RequestOptions requestOptions) throws ApiException, IOException {
77

NEW
78
        String requestBody = createAllowedOriginRequest.toJson();
×
NEW
79
        Resource resource = new Resource(this, this.baseURL + "/me/allowedOrigins", null);
×
NEW
80
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, null);
×
NEW
81
        return AllowedOrigin.fromJson(jsonResult);
×
82
    }
83

84
    /**
85
    * Generate a client key
86
    *
87
    * @return {@link GenerateClientKeyResponse }
88
    * @throws ApiException if fails to make API call
89
    */
90
    public GenerateClientKeyResponse generateClientKey() throws ApiException, IOException {
NEW
91
        return generateClientKey(null);
×
92
    }
93

94
    /**
95
    * Generate a client key
96
    *
97
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
98
    * @return {@link GenerateClientKeyResponse }
99
    * @throws ApiException if fails to make API call
100
    */
101
    public GenerateClientKeyResponse generateClientKey(RequestOptions requestOptions) throws ApiException, IOException {
102

103
        String requestBody = null;
×
NEW
104
        Resource resource = new Resource(this, this.baseURL + "/me/generateClientKey", null);
×
NEW
105
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, null);
×
NEW
106
        return GenerateClientKeyResponse.fromJson(jsonResult);
×
107
    }
108

109
    /**
110
    * Get allowed origin details
111
    *
112
    * @param originId {@link String } Unique identifier of the allowed origin. (required)
113
    * @return {@link AllowedOrigin }
114
    * @throws ApiException if fails to make API call
115
    */
116
    public AllowedOrigin getAllowedOriginDetails(String originId) throws ApiException, IOException {
117
        return getAllowedOriginDetails(originId, null);
×
118
    }
119

120
    /**
121
    * Get allowed origin details
122
    *
123
    * @param originId {@link String } Unique identifier of the allowed origin. (required)
124
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
125
    * @return {@link AllowedOrigin }
126
    * @throws ApiException if fails to make API call
127
    */
128
    public AllowedOrigin getAllowedOriginDetails(String originId, RequestOptions requestOptions) throws ApiException, IOException {
129
        //Add path params
130
        Map<String, String> pathParams = new HashMap<>();
×
131
        if (originId == null) {
×
132
            throw new IllegalArgumentException("Please provide the originId path parameter");
×
133
        }
134
        pathParams.put("originId", originId);
×
135

136
        String requestBody = null;
×
137
        Resource resource = new Resource(this, this.baseURL + "/me/allowedOrigins/{originId}", null);
×
138
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams);
×
139
        return AllowedOrigin.fromJson(jsonResult);
×
140
    }
141

142
    /**
143
    * Get allowed origins
144
    *
145
    * @return {@link AllowedOriginsResponse }
146
    * @throws ApiException if fails to make API call
147
    */
148
    public AllowedOriginsResponse getAllowedOrigins() throws ApiException, IOException {
NEW
149
        return getAllowedOrigins(null);
×
150
    }
151

152
    /**
153
    * Get allowed origins
154
    *
155
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
156
    * @return {@link AllowedOriginsResponse }
157
    * @throws ApiException if fails to make API call
158
    */
159
    public AllowedOriginsResponse getAllowedOrigins(RequestOptions requestOptions) throws ApiException, IOException {
160

NEW
161
        String requestBody = null;
×
162
        Resource resource = new Resource(this, this.baseURL + "/me/allowedOrigins", null);
×
NEW
163
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, null);
×
NEW
164
        return AllowedOriginsResponse.fromJson(jsonResult);
×
165
    }
166

167
    /**
168
    * Get API credential details
169
    *
170
    * @return {@link MeApiCredential }
171
    * @throws ApiException if fails to make API call
172
    */
173
    public MeApiCredential getApiCredentialDetails() throws ApiException, IOException {
NEW
174
        return getApiCredentialDetails(null);
×
175
    }
176

177
    /**
178
    * Get API credential details
179
    *
180
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
181
    * @return {@link MeApiCredential }
182
    * @throws ApiException if fails to make API call
183
    */
184
    public MeApiCredential getApiCredentialDetails(RequestOptions requestOptions) throws ApiException, IOException {
185

186
        String requestBody = null;
×
NEW
187
        Resource resource = new Resource(this, this.baseURL + "/me", null);
×
NEW
188
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, null);
×
NEW
189
        return MeApiCredential.fromJson(jsonResult);
×
190
    }
191

192
    /**
193
    * Remove allowed origin
194
    *
195
    * @param originId {@link String } Unique identifier of the allowed origin. (required)
196
    * @throws ApiException if fails to make API call
197
    */
198
    public void removeAllowedOrigin(String originId) throws ApiException, IOException {
199
        removeAllowedOrigin(originId, null);
1✔
200
    }
1✔
201

202
    /**
203
    * Remove allowed origin
204
    *
205
    * @param originId {@link String } Unique identifier of the allowed origin. (required)
206
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
207
    * @throws ApiException if fails to make API call
208
    */
209
    public void removeAllowedOrigin(String originId, RequestOptions requestOptions) throws ApiException, IOException {
210
        //Add path params
211
        Map<String, String> pathParams = new HashMap<>();
1✔
212
        if (originId == null) {
1✔
NEW
213
            throw new IllegalArgumentException("Please provide the originId path parameter");
×
214
        }
215
        pathParams.put("originId", originId);
1✔
216

217
        String requestBody = null;
1✔
218
        Resource resource = new Resource(this, this.baseURL + "/me/allowedOrigins/{originId}", null);
1✔
219
        resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.DELETE, pathParams);
1✔
220
    }
1✔
221
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc