-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSDK.java
More file actions
executable file
·178 lines (155 loc) · 4.6 KB
/
SDK.java
File metadata and controls
executable file
·178 lines (155 loc) · 4.6 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
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
172
173
174
175
176
177
178
/*
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
*/
package structure.Structure;
import structure.Structure.utils.HTTPClient;
import structure.Structure.utils.SpeakeasyHTTPClient;
/**
* Structure provides company and people data. Use our dataset of 700 million people and 24 million companies to build products, enrich person profiles, power predictive modeling/ai, analysis, and more.
*/
public class SDK {
/**
* SERVERS contains the list of server urls available to the SDK.
*/
public static final String[] SERVERS = {
"https://www.structure.ac/api/v1",
};
/**
* Accounts
*/
public Accounts accounts;
/**
* Companies
*/
public Companies companies;
/**
* People
*/
public People people;
/**
* User
*/
public User user;
private HTTPClient _defaultClient;
private HTTPClient _securityClient;
private structure.Structure.models.shared.Security _security;
private String _serverUrl;
private String _language = "java";
private String _sdkVersion = "0.2.2";
private String _genVersion = "2.18.2";
/**
* The Builder class allows the configuration of a new instance of the SDK.
*/
public static class Builder {
private HTTPClient client;
private structure.Structure.models.shared.Security security;
private String serverUrl;
private java.util.Map<String, String> params = new java.util.HashMap<String, String>();
private Builder() {
}
/**
* Allows the default HTTP client to be overridden with a custom implementation.
* @param client The HTTP client to use for all requests.
* @return The builder instance.
*/
public Builder setClient(HTTPClient client) {
this.client = client;
return this;
}
/**
* Configures the SDK to use the provided security details.
* @param security The security details to use for all requests.
* @return The builder instance.
*/
public Builder setSecurity(structure.Structure.models.shared.Security security) {
this.security = security;
return this;
}
/**
* Allows the overriding of the default server URL.
* @param serverUrl The server URL to use for all requests.
* @return The builder instance.
*/
public Builder setServerURL(String serverUrl) {
this.serverUrl = serverUrl;
return this;
}
/**
* Allows the overriding of the default server URL with a templated URL populated with the provided parameters.
* @param serverUrl The server URL to use for all requests.
* @param params The parameters to use when templating the URL.
* @return The builder instance.
*/
public Builder setServerURL(String serverUrl, java.util.Map<String, String> params) {
this.serverUrl = serverUrl;
this.params = params;
return this;
}
/**
* Builds a new instance of the SDK.
* @return The SDK instance.
* @throws Exception Thrown if the SDK could not be built.
*/
public SDK build() throws Exception {
return new SDK(this.client, this.security, this.serverUrl, this.params);
}
}
/**
* Get a new instance of the SDK builder to configure a new instance of the SDK.
* @return The SDK builder instance.
*/
public static Builder builder() {
return new Builder();
}
private SDK(HTTPClient client, structure.Structure.models.shared.Security security, String serverUrl, java.util.Map<String, String> params) throws Exception {
this._defaultClient = client;
if (this._defaultClient == null) {
this._defaultClient = new SpeakeasyHTTPClient();
}
if (security != null) {
this._security = security;
this._securityClient = structure.Structure.utils.Utils.configureSecurityClient(this._defaultClient, this._security);
}
if (this._securityClient == null) {
this._securityClient = this._defaultClient;
}
if (serverUrl != null && !serverUrl.isBlank()) {
this._serverUrl = structure.Structure.utils.Utils.templateUrl(serverUrl, params);
}
if (this._serverUrl == null) {
this._serverUrl = SERVERS[0];
}
this.accounts = new Accounts(
this._defaultClient,
this._securityClient,
this._serverUrl,
this._language,
this._sdkVersion,
this._genVersion
);
this.companies = new Companies(
this._defaultClient,
this._securityClient,
this._serverUrl,
this._language,
this._sdkVersion,
this._genVersion
);
this.people = new People(
this._defaultClient,
this._securityClient,
this._serverUrl,
this._language,
this._sdkVersion,
this._genVersion
);
this.user = new User(
this._defaultClient,
this._securityClient,
this._serverUrl,
this._language,
this._sdkVersion,
this._genVersion
);
}
}