-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: auto generated code from open api specs
- Loading branch information
Showing
1,146 changed files
with
111,811 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
<groupId>com.sendgrid</groupId> | ||
<artifactId>sendgrid-java</artifactId> | ||
<name>Twilio SendGrid Java helper library</name> | ||
<version>4.10.2</version> | ||
<version>5.0.0-rc.1</version> | ||
<description>This Java module allows you to quickly and easily send emails through Twilio SendGrid using Java.</description> | ||
<url>https://github.com/sendgrid/sendgrid-java</url> | ||
<licenses> | ||
|
@@ -26,7 +26,7 @@ | |
<url>https://github.com/sendgrid/sendgrid-java</url> | ||
<connection>scm:git:[email protected]:sendgrid/sendgrid-java.git</connection> | ||
<developerConnection>scm:git:[email protected]:sendgrid/sendgrid-java.git</developerConnection> | ||
<tag>4.10.2</tag> | ||
<tag>5.0.0-rc.1</tag> | ||
</scm> | ||
<profiles> | ||
<profile> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/AuthenticateAccount.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* | ||
* This code was generated by | ||
* | ||
* SENDGRID-OAI-GENERATOR | ||
* | ||
* Twilio SendGrid Account Provisioning API | ||
* The Twilio SendGrid Account Provisioning API provides a platform for Twilio SendGrid resellers to manage their customer accounts. This API is for companies that have a formal reseller partnership with Twilio SendGrid. You can access Twilio SendGrid sub-account functionality without becoming a reseller. If you require sub-account functionality, see the Twilio [SendGrid Subusers](https://docs.sendgrid.com/ui/account-and-settings/subusers) feature, which is available with [Pro and Premier plans](https://sendgrid.com/pricing/). | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator. | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
package com.sendgrid.rest.api.v3.accountprovisioning; | ||
|
||
import com.sendgrid.base.apikey.ApiKeyBase; | ||
import com.sendgrid.constant.ApplicationConstants; | ||
import com.sendgrid.constant.Domains; | ||
import com.sendgrid.exception.ApiConnectionException; | ||
import com.sendgrid.exception.ApiErrorResponse; | ||
import com.sendgrid.exception.GenericApiError; | ||
import com.sendgrid.http.ApiKeyRestClient; | ||
import com.sendgrid.http.ApiResponse; | ||
import com.sendgrid.http.HttpMethod; | ||
import com.sendgrid.http.Request; | ||
import com.sendgrid.http.Response; | ||
import com.sendgrid.util.JsonUtil; | ||
import com.sendgrid.util.Matcher; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RequiredArgsConstructor | ||
public class AuthenticateAccount extends ApiKeyBase { | ||
|
||
private final String accountID; | ||
|
||
public ApiResponse<Void> send(final ApiKeyRestClient client) { | ||
String path = "/v3/partners/accounts/{accountID}/sso"; | ||
Request request = new Request( | ||
HttpMethod.POST, | ||
path, | ||
Domains.API.toString() | ||
); | ||
addPathParams(request); | ||
Response response = client.request(request); | ||
|
||
if (response == null) { | ||
throw new ApiConnectionException( | ||
"AuthenticateAccount creation failed: Unable to connect to server" | ||
); | ||
} else if ( | ||
!ApplicationConstants.SUCCESS.test(response.getStatusCode()) | ||
) { | ||
int statusCode = response.getStatusCode(); | ||
if (Matcher.matches(Integer.toString(statusCode), "401")) { | ||
Object error = JsonUtil.fromJson( | ||
response.getStream(), | ||
Object.class | ||
); | ||
throw new ApiErrorResponse( | ||
statusCode, | ||
null, | ||
error, | ||
response.getHeaders() | ||
); | ||
} | ||
|
||
if (Matcher.matches(Integer.toString(statusCode), "403")) { | ||
Object error = JsonUtil.fromJson( | ||
response.getStream(), | ||
Object.class | ||
); | ||
throw new ApiErrorResponse( | ||
statusCode, | ||
null, | ||
error, | ||
response.getHeaders() | ||
); | ||
} | ||
|
||
if (Matcher.matches(Integer.toString(statusCode), "404")) { | ||
Object error = JsonUtil.fromJson( | ||
response.getStream(), | ||
Object.class | ||
); | ||
throw new ApiErrorResponse( | ||
statusCode, | ||
null, | ||
error, | ||
response.getHeaders() | ||
); | ||
} | ||
|
||
GenericApiError error = JsonUtil.fromJson( | ||
response.getStream(), | ||
GenericApiError.class | ||
); | ||
throw new ApiErrorResponse( | ||
statusCode, | ||
null, | ||
error, | ||
response.getHeaders() | ||
); | ||
} | ||
int statusCode = response.getStatusCode(); | ||
return new ApiResponse(statusCode, response.getHeaders()); | ||
} | ||
|
||
private void addPathParams(Request request) { | ||
if (accountID != null) { | ||
request.addPathParam("accountID", accountID.toString()); | ||
} | ||
} | ||
} |
136 changes: 136 additions & 0 deletions
136
src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/CreateAccount.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/* | ||
* This code was generated by | ||
* | ||
* SENDGRID-OAI-GENERATOR | ||
* | ||
* Twilio SendGrid Account Provisioning API | ||
* The Twilio SendGrid Account Provisioning API provides a platform for Twilio SendGrid resellers to manage their customer accounts. This API is for companies that have a formal reseller partnership with Twilio SendGrid. You can access Twilio SendGrid sub-account functionality without becoming a reseller. If you require sub-account functionality, see the Twilio [SendGrid Subusers](https://docs.sendgrid.com/ui/account-and-settings/subusers) feature, which is available with [Pro and Premier plans](https://sendgrid.com/pricing/). | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator. | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
package com.sendgrid.rest.api.v3.accountprovisioning; | ||
|
||
import com.sendgrid.base.apikey.ApiKeyBase; | ||
import com.sendgrid.constant.ApplicationConstants; | ||
import com.sendgrid.constant.Domains; | ||
import com.sendgrid.exception.ApiConnectionException; | ||
import com.sendgrid.exception.ApiErrorResponse; | ||
import com.sendgrid.exception.GenericApiError; | ||
import com.sendgrid.http.ApiKeyRestClient; | ||
import com.sendgrid.http.ApiResponse; | ||
import com.sendgrid.http.HttpMethod; | ||
import com.sendgrid.http.Request; | ||
import com.sendgrid.http.Response; | ||
import com.sendgrid.rest.api.v3.accountprovisioning.models.AccountProvisioningAccountId; | ||
import com.sendgrid.rest.api.v3.accountprovisioning.models.CreateAccountParams; | ||
import com.sendgrid.util.JsonUtil; | ||
import com.sendgrid.util.Matcher; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@RequiredArgsConstructor | ||
public class CreateAccount extends ApiKeyBase { | ||
|
||
@Setter | ||
private String tTestAccount; | ||
|
||
@Setter | ||
private CreateAccountParams createAccountParams; | ||
|
||
public ApiResponse<AccountProvisioningAccountId> send( | ||
final ApiKeyRestClient client | ||
) { | ||
String path = "/v3/partners/accounts"; | ||
Request request = new Request( | ||
HttpMethod.POST, | ||
path, | ||
Domains.API.toString() | ||
); | ||
addHeaderParams(request); | ||
addBody(request); | ||
Response response = client.request(request); | ||
|
||
if (response == null) { | ||
throw new ApiConnectionException( | ||
"CreateAccount creation failed: Unable to connect to server" | ||
); | ||
} else if ( | ||
!ApplicationConstants.SUCCESS.test(response.getStatusCode()) | ||
) { | ||
int statusCode = response.getStatusCode(); | ||
if (Matcher.matches(Integer.toString(statusCode), "400")) { | ||
Object error = JsonUtil.fromJson( | ||
response.getStream(), | ||
Object.class | ||
); | ||
throw new ApiErrorResponse( | ||
statusCode, | ||
null, | ||
error, | ||
response.getHeaders() | ||
); | ||
} | ||
|
||
if (Matcher.matches(Integer.toString(statusCode), "401")) { | ||
Object error = JsonUtil.fromJson( | ||
response.getStream(), | ||
Object.class | ||
); | ||
throw new ApiErrorResponse( | ||
statusCode, | ||
null, | ||
error, | ||
response.getHeaders() | ||
); | ||
} | ||
|
||
if (Matcher.matches(Integer.toString(statusCode), "403")) { | ||
Object error = JsonUtil.fromJson( | ||
response.getStream(), | ||
Object.class | ||
); | ||
throw new ApiErrorResponse( | ||
statusCode, | ||
null, | ||
error, | ||
response.getHeaders() | ||
); | ||
} | ||
|
||
GenericApiError error = JsonUtil.fromJson( | ||
response.getStream(), | ||
GenericApiError.class | ||
); | ||
throw new ApiErrorResponse( | ||
statusCode, | ||
null, | ||
error, | ||
response.getHeaders() | ||
); | ||
} | ||
int statusCode = response.getStatusCode(); | ||
return new ApiResponse( | ||
statusCode, | ||
JsonUtil.fromJson( | ||
response.getStream(), | ||
AccountProvisioningAccountId.class | ||
), | ||
response.getHeaders() | ||
); | ||
} | ||
|
||
private void addHeaderParams(Request request) { | ||
if (tTestAccount != null) { | ||
request.addHeaderParam("T-Test-Account", tTestAccount.toString()); | ||
} | ||
} | ||
|
||
private void addBody(final Request request) { | ||
if (createAccountParams != null) { | ||
request.addBody(JsonUtil.toJson(createAccountParams)); | ||
} | ||
} | ||
} |
Oops, something went wrong.