-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathServerConfiguration.java
More file actions
executable file
·74 lines (66 loc) · 3.32 KB
/
ServerConfiguration.java
File metadata and controls
executable file
·74 lines (66 loc) · 3.32 KB
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
/*
* Regula Document Reader Web API
* Fast and reliable identity document verification for on-premises installation or cloud integration. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core # Documentation Go to [Regula Developer Documentation](https://docs.regulaforensics.com/develop/doc-reader-sdk/web-service) to read the technologies description, licensing information, release notes, and instructions on the integration, installation, migration, etc. # Technical Support To submit a request to the Support Team, visit [Regula Help Center](https://support.regulaforensics.com/hc/en-us/requests/new). # Business Enquiries To discuss business opportunities, fill the [Enquiry Form](https://explore.regula.app/docs-support-request) and specify your scenarios, applications, and technical requirements.
*
* The version of the OpenAPI document: 8.1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.regula.documentreader.webclient;
import java.util.Map;
/** Representing a Server configuration. */
@javax.annotation.Generated(
value = "org.openapitools.codegen.languages.JavaClientCodegen",
comments = "Generator version: 7.15.0")
public class ServerConfiguration {
public String URL;
public String description;
public Map<String, ServerVariable> variables;
/**
* @param URL A URL to the target host.
* @param description A description of the host designated by the URL.
* @param variables A map between a variable name and its value. The value is used for
* substitution in the server's URL template.
*/
public ServerConfiguration(
String URL, String description, Map<String, ServerVariable> variables) {
this.URL = URL;
this.description = description;
this.variables = variables;
}
/**
* Format URL template using given variables.
*
* @param variables A map between a variable name and its value.
* @return Formatted URL.
*/
public String URL(Map<String, String> variables) {
String url = this.URL;
// go through variables and replace placeholders
for (Map.Entry<String, ServerVariable> variable : this.variables.entrySet()) {
String name = variable.getKey();
ServerVariable serverVariable = variable.getValue();
String value = serverVariable.defaultValue;
if (variables != null && variables.containsKey(name)) {
value = variables.get(name);
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
throw new IllegalArgumentException(
"The variable " + name + " in the server URL has invalid value " + value + ".");
}
}
url = url.replace("{" + name + "}", value);
}
return url;
}
/**
* Format URL template using default server variables.
*
* @return Formatted URL.
*/
public String URL() {
return URL(null);
}
}