diff --git a/CHANGELOG.md b/CHANGELOG.md index c47f2cf8..a2fa1c4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Change Log All notable changes to this project will be documented in this file. +[2024-06-27] Version 5.0.0-rc.1 +-------------------------------- +- Generating Sendgrid Code using open api spec. + [2024-06-27] Version 5.0.0-rc.0 -------------------------------- - Release Candidate prep diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a5973600..005c7647 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -69,7 +69,7 @@ touch Example.java Add the example you want to test to Example.java, including the headers at the top of the file. ``` bash -javac -classpath ../repo/com/sendgrid/4.10.2/sendgrid-4.10.2-jar.jar:. Example.java && java -classpath ../repo/com/sendgrid/4.10.2/sendgrid-4.10.2-jar.jar:. Example +javac -classpath ../repo/com/sendgrid/5.0.0-rc.1/sendgrid-5.0.0-rc.1-jar.jar:. Example.java && java -classpath ../repo/com/sendgrid/5.0.0-rc.1/sendgrid-5.0.0-rc.1-jar.jar:. Example ``` diff --git a/README.md b/README.md index c00f214f..7c840693 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ Add the following to your build.gradle file in the root of your project. ... dependencies { ... - implementation 'com.sendgrid:sendgrid-java:4.10.2' + implementation 'com.sendgrid:sendgrid-java:5.0.0-rc.1' } repositories { @@ -81,7 +81,7 @@ mvn install You can just drop the jar file in. It's a fat jar - it has all the dependencies built in. -[sendgrid-java.jar](https://github.com/sendgrid/sendgrid-java/releases/download/4.10.2/sendgrid-java.jar) +[sendgrid-java.jar](https://github.com/sendgrid/sendgrid-java/releases/download/5.0.0-rc.1/sendgrid-java.jar) ## Dependencies diff --git a/pom.xml b/pom.xml index 3ac5876a..39321ba8 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ com.sendgrid sendgrid-java Twilio SendGrid Java helper library - 4.10.2 + 5.0.0-rc.1 This Java module allows you to quickly and easily send emails through Twilio SendGrid using Java. https://github.com/sendgrid/sendgrid-java @@ -26,7 +26,7 @@ https://github.com/sendgrid/sendgrid-java scm:git:git@github.com:sendgrid/sendgrid-java.git scm:git:git@github.com:sendgrid/sendgrid-java.git - 4.10.2 + 5.0.0-rc.1 diff --git a/src/main/java/com/sendgrid/constant/Config.java b/src/main/java/com/sendgrid/constant/Config.java index 19076f3d..8d129930 100644 --- a/src/main/java/com/sendgrid/constant/Config.java +++ b/src/main/java/com/sendgrid/constant/Config.java @@ -4,7 +4,7 @@ @UtilityClass public class Config { - public static final String VERSION = "5.0.0-rc.0"; + public static final String VERSION = "5.0.0-rc.1"; public static final String JAVA_VERSION = System.getProperty("java.version"); public static final String OS_NAME = System.getProperty("os.name"); public static final String OS_ARCH = System.getProperty("os.arch"); diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/AuthenticateAccount.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/AuthenticateAccount.java new file mode 100644 index 00000000..913a763a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/AuthenticateAccount.java @@ -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 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()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/CreateAccount.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/CreateAccount.java new file mode 100644 index 00000000..46660c36 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/CreateAccount.java @@ -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 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)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/DeleteAccount.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/DeleteAccount.java new file mode 100644 index 00000000..fe0e8ce3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/DeleteAccount.java @@ -0,0 +1,126 @@ +/* + * 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 DeleteAccount extends ApiKeyBase { + + private final String accountID; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/partners/accounts/{accountID}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteAccount 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() + ); + } + + 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()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/GetAccountState.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/GetAccountState.java new file mode 100644 index 00000000..249ce286 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/GetAccountState.java @@ -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.AccountProvisioningStateRead; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class GetAccountState extends ApiKeyBase { + + private final String accountID; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/partners/accounts/{accountID}/state"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetAccountState 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() + ); + } + + 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, + JsonUtil.fromJson( + response.getStream(), + AccountProvisioningStateRead.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (accountID != null) { + request.addPathParam("accountID", accountID.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/ListAccount.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/ListAccount.java new file mode 100644 index 00000000..b323fb8c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/ListAccount.java @@ -0,0 +1,139 @@ +/* + * 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.AccountList; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListAccount extends ApiKeyBase { + + @Setter + private String offset; + + @Setter + private Integer limit; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/partners/accounts"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListAccount 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() + ); + } + + 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, + JsonUtil.fromJson(response.getStream(), AccountList.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/ListAccountOffering.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/ListAccountOffering.java new file mode 100644 index 00000000..85288e50 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/ListAccountOffering.java @@ -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.AccountProvisioningOfferingList; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListAccountOffering extends ApiKeyBase { + + private final String accountID; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/partners/accounts/{accountID}/offerings"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListAccountOffering 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() + ); + } + + 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, + JsonUtil.fromJson( + response.getStream(), + AccountProvisioningOfferingList.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (accountID != null) { + request.addPathParam("accountID", accountID.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/ListOffering.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/ListOffering.java new file mode 100644 index 00000000..08d81f3b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/ListOffering.java @@ -0,0 +1,127 @@ +/* + * 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.AccountProvisioningCatalog; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListOffering extends ApiKeyBase { + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/partners/offerings"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListOffering 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() + ); + } + + 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, + JsonUtil.fromJson( + response.getStream(), + AccountProvisioningCatalog.class + ), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/UpdateAccountOffering.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/UpdateAccountOffering.java new file mode 100644 index 00000000..5999a4f0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/UpdateAccountOffering.java @@ -0,0 +1,135 @@ +/* + * 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.AccountProvisioningOfferingList; +import com.sendgrid.rest.api.v3.accountprovisioning.models.OfferingsToAdd; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateAccountOffering extends ApiKeyBase { + + private final String accountID; + + @Setter + private OfferingsToAdd offeringsToAdd; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/partners/accounts/{accountID}/offerings"; + Request request = new Request( + HttpMethod.PUT, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateAccountOffering 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(), + AccountProvisioningOfferingList.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (accountID != null) { + request.addPathParam("accountID", accountID.toString()); + } + } + + private void addBody(final Request request) { + if (offeringsToAdd != null) { + request.addBody(JsonUtil.toJson(offeringsToAdd)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/UpdateAccountState.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/UpdateAccountState.java new file mode 100644 index 00000000..b3d83f6e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/UpdateAccountState.java @@ -0,0 +1,125 @@ +/* + * 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.AccountProvisioningStateWrite; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateAccountState extends ApiKeyBase { + + private final String accountID; + + @Setter + private AccountProvisioningStateWrite accountProvisioningStateWrite; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/partners/accounts/{accountID}/state"; + Request request = new Request( + HttpMethod.PUT, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateAccountState 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, response.getHeaders()); + } + + private void addPathParams(Request request) { + if (accountID != null) { + request.addPathParam("accountID", accountID.toString()); + } + } + + private void addBody(final Request request) { + if (accountProvisioningStateWrite != null) { + request.addBody(JsonUtil.toJson(accountProvisioningStateWrite)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountList.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountList.java new file mode 100644 index 00000000..10a0cced --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountList.java @@ -0,0 +1,82 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.accountprovisioning.models.AccountProvisioningAccount; +import com.sendgrid.rest.api.v3.accountprovisioning.models.AccountProvisioningPagination; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AccountList { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("accounts") + @Getter + @Setter + private List accounts; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("pages") + @Getter + @Setter + private AccountProvisioningPagination pages; + + public AccountList() {} + + private AccountList(Builder builder) { + this.accounts = builder.accounts; + this.pages = builder.pages; + } + + // Builder class for constructing object + public static class Builder { + + private List accounts; + private AccountProvisioningPagination pages; + + public Builder() {} + + public Builder accounts(List accounts) { + this.accounts = accounts; + return this; + } + + public Builder pages(AccountProvisioningPagination pages) { + this.pages = pages; + return this; + } + + public AccountList build() { + return new AccountList(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AccountList.class.getSimpleName() + "(", + ")" + ); + if (accounts != null) joiner.add("accounts=" + accounts); + if (pages != null) joiner.add("pages=" + pages); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningAccount.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningAccount.java new file mode 100644 index 00000000..3c62934e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningAccount.java @@ -0,0 +1,73 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AccountProvisioningAccount { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private OffsetDateTime createdAt; + + public AccountProvisioningAccount() {} + + private AccountProvisioningAccount(Builder builder) { + this.id = builder.id; + this.createdAt = builder.createdAt; + } + + // Builder class for constructing object + public static class Builder { + + private String id; + private OffsetDateTime createdAt; + + public Builder(String id, OffsetDateTime createdAt) { + this.id = id; + this.createdAt = createdAt; + } + + public AccountProvisioningAccount build() { + return new AccountProvisioningAccount(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AccountProvisioningAccount.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningAccountId.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningAccountId.java new file mode 100644 index 00000000..d18696ee --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningAccountId.java @@ -0,0 +1,62 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AccountProvisioningAccountId { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("account_id") + @Getter + @Setter + private String accountId; + + public AccountProvisioningAccountId() {} + + private AccountProvisioningAccountId(Builder builder) { + this.accountId = builder.accountId; + } + + // Builder class for constructing object + public static class Builder { + + private String accountId; + + public Builder(String accountId) { + this.accountId = accountId; + } + + public AccountProvisioningAccountId build() { + return new AccountProvisioningAccountId(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AccountProvisioningAccountId.class.getSimpleName() + "(", + ")" + ); + if (accountId != null) joiner.add("accountId=" + accountId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningCatalog.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningCatalog.java new file mode 100644 index 00000000..00939c45 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningCatalog.java @@ -0,0 +1,67 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.accountprovisioning.models.CatalogEntry; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AccountProvisioningCatalog { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("catalog") + @Getter + @Setter + private List catalog; + + public AccountProvisioningCatalog() {} + + private AccountProvisioningCatalog(Builder builder) { + this.catalog = builder.catalog; + } + + // Builder class for constructing object + public static class Builder { + + private List catalog; + + public Builder() {} + + public Builder catalog(List catalog) { + this.catalog = catalog; + return this; + } + + public AccountProvisioningCatalog build() { + return new AccountProvisioningCatalog(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AccountProvisioningCatalog.class.getSimpleName() + "(", + ")" + ); + if (catalog != null) joiner.add("catalog=" + catalog); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningOfferingList.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningOfferingList.java new file mode 100644 index 00000000..ab98ee23 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningOfferingList.java @@ -0,0 +1,69 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.accountprovisioning.models.AccountProvisioningOfferingV1; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AccountProvisioningOfferingList { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("offerings") + @Getter + @Setter + private List offerings; + + public AccountProvisioningOfferingList() {} + + private AccountProvisioningOfferingList(Builder builder) { + this.offerings = builder.offerings; + } + + // Builder class for constructing object + public static class Builder { + + private List offerings; + + public Builder() {} + + public Builder offerings( + List offerings + ) { + this.offerings = offerings; + return this; + } + + public AccountProvisioningOfferingList build() { + return new AccountProvisioningOfferingList(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AccountProvisioningOfferingList.class.getSimpleName() + "(", + ")" + ); + if (offerings != null) joiner.add("offerings=" + offerings); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningOfferingV1.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningOfferingV1.java new file mode 100644 index 00000000..93547de5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningOfferingV1.java @@ -0,0 +1,87 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.accountprovisioning.models.Type; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AccountProvisioningOfferingV1 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private Type type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("quantity") + @Getter + @Setter + private Long quantity; + + public AccountProvisioningOfferingV1() {} + + private AccountProvisioningOfferingV1(Builder builder) { + this.name = builder.name; + this.type = builder.type; + this.quantity = builder.quantity; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private Type type; + private Long quantity; + + public Builder(String name, Type type) { + this.name = name; + this.type = type; + } + + public Builder quantity(Long quantity) { + this.quantity = quantity; + return this; + } + + public AccountProvisioningOfferingV1 build() { + return new AccountProvisioningOfferingV1(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AccountProvisioningOfferingV1.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (type != null) joiner.add("type=" + type); + if (quantity != null) joiner.add("quantity=" + quantity); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningPagination.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningPagination.java new file mode 100644 index 00000000..84499c67 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningPagination.java @@ -0,0 +1,79 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AccountProvisioningPagination { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last") + @Getter + @Setter + private String last; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("example") + @Getter + @Setter + private Object example; + + public AccountProvisioningPagination() {} + + private AccountProvisioningPagination(Builder builder) { + this.last = builder.last; + this.example = builder.example; + } + + // Builder class for constructing object + public static class Builder { + + private String last; + private Object example; + + public Builder() {} + + public Builder last(String last) { + this.last = last; + return this; + } + + public Builder example(Object example) { + this.example = example; + return this; + } + + public AccountProvisioningPagination build() { + return new AccountProvisioningPagination(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AccountProvisioningPagination.class.getSimpleName() + "(", + ")" + ); + if (last != null) joiner.add("last=" + last); + if (example != null) joiner.add("example=" + example); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningProfile.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningProfile.java new file mode 100644 index 00000000..2c21a37e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningProfile.java @@ -0,0 +1,151 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AccountProvisioningProfile { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("company_name") + @Getter + @Setter + private String companyName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("company_website") + @Getter + @Setter + private String companyWebsite; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("phone") + @Getter + @Setter + private String phone; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("timezone") + @Getter + @Setter + private String timezone; + + public AccountProvisioningProfile() {} + + private AccountProvisioningProfile(Builder builder) { + this.firstName = builder.firstName; + this.lastName = builder.lastName; + this.companyName = builder.companyName; + this.companyWebsite = builder.companyWebsite; + this.email = builder.email; + this.phone = builder.phone; + this.timezone = builder.timezone; + } + + // Builder class for constructing object + public static class Builder { + + private String firstName; + private String lastName; + private String companyName; + private String companyWebsite; + private String email; + private String phone; + private String timezone; + + public Builder() {} + + public Builder firstName(String firstName) { + this.firstName = firstName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = lastName; + return this; + } + + public Builder companyName(String companyName) { + this.companyName = companyName; + return this; + } + + public Builder companyWebsite(String companyWebsite) { + this.companyWebsite = companyWebsite; + return this; + } + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder phone(String phone) { + this.phone = phone; + return this; + } + + public Builder timezone(String timezone) { + this.timezone = timezone; + return this; + } + + public AccountProvisioningProfile build() { + return new AccountProvisioningProfile(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AccountProvisioningProfile.class.getSimpleName() + "(", + ")" + ); + if (firstName != null) joiner.add("firstName=" + firstName); + if (lastName != null) joiner.add("lastName=" + lastName); + if (companyName != null) joiner.add("companyName=" + companyName); + if (companyWebsite != null) joiner.add( + "companyWebsite=" + companyWebsite + ); + if (email != null) joiner.add("email=" + email); + if (phone != null) joiner.add("phone=" + phone); + if (timezone != null) joiner.add("timezone=" + timezone); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningStateRead.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningStateRead.java new file mode 100644 index 00000000..4cfbb40f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningStateRead.java @@ -0,0 +1,63 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.accountprovisioning.models.State; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AccountProvisioningStateRead { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state") + @Getter + @Setter + private State state; + + public AccountProvisioningStateRead() {} + + private AccountProvisioningStateRead(Builder builder) { + this.state = builder.state; + } + + // Builder class for constructing object + public static class Builder { + + private State state; + + public Builder(State state) { + this.state = state; + } + + public AccountProvisioningStateRead build() { + return new AccountProvisioningStateRead(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AccountProvisioningStateRead.class.getSimpleName() + "(", + ")" + ); + if (state != null) joiner.add("state=" + state); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningStateWrite.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningStateWrite.java new file mode 100644 index 00000000..02eb30dc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/AccountProvisioningStateWrite.java @@ -0,0 +1,63 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.accountprovisioning.models.State1; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AccountProvisioningStateWrite { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state") + @Getter + @Setter + private State1 state; + + public AccountProvisioningStateWrite() {} + + private AccountProvisioningStateWrite(Builder builder) { + this.state = builder.state; + } + + // Builder class for constructing object + public static class Builder { + + private State1 state; + + public Builder(State1 state) { + this.state = state; + } + + public AccountProvisioningStateWrite build() { + return new AccountProvisioningStateWrite(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AccountProvisioningStateWrite.class.getSimpleName() + "(", + ")" + ); + if (state != null) joiner.add("state=" + state); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/CatalogEntry.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/CatalogEntry.java new file mode 100644 index 00000000..f7f94117 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/CatalogEntry.java @@ -0,0 +1,81 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.accountprovisioning.models.AccountProvisioningOfferingV1; +import com.sendgrid.rest.api.v3.accountprovisioning.models.CatalogEntryEntitlements; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CatalogEntry { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("offering") + @Getter + @Setter + private AccountProvisioningOfferingV1 offering; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("entitlements") + @Getter + @Setter + private CatalogEntryEntitlements entitlements; + + public CatalogEntry() {} + + private CatalogEntry(Builder builder) { + this.offering = builder.offering; + this.entitlements = builder.entitlements; + } + + // Builder class for constructing object + public static class Builder { + + private AccountProvisioningOfferingV1 offering; + private CatalogEntryEntitlements entitlements; + + public Builder() {} + + public Builder offering(AccountProvisioningOfferingV1 offering) { + this.offering = offering; + return this; + } + + public Builder entitlements(CatalogEntryEntitlements entitlements) { + this.entitlements = entitlements; + return this; + } + + public CatalogEntry build() { + return new CatalogEntry(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CatalogEntry.class.getSimpleName() + "(", + ")" + ); + if (offering != null) joiner.add("offering=" + offering); + if (entitlements != null) joiner.add("entitlements=" + entitlements); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/CatalogEntryEntitlements.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/CatalogEntryEntitlements.java new file mode 100644 index 00000000..c31552b8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/CatalogEntryEntitlements.java @@ -0,0 +1,111 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CatalogEntryEntitlements { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email_sends_max_monthly") + @Getter + @Setter + private Long emailSendsMaxMonthly; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip_count") + @Getter + @Setter + private Long ipCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("teammates_max_total") + @Getter + @Setter + private Long teammatesMaxTotal; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("users_max_total") + @Getter + @Setter + private Long usersMaxTotal; + + public CatalogEntryEntitlements() {} + + private CatalogEntryEntitlements(Builder builder) { + this.emailSendsMaxMonthly = builder.emailSendsMaxMonthly; + this.ipCount = builder.ipCount; + this.teammatesMaxTotal = builder.teammatesMaxTotal; + this.usersMaxTotal = builder.usersMaxTotal; + } + + // Builder class for constructing object + public static class Builder { + + private Long emailSendsMaxMonthly; + private Long ipCount; + private Long teammatesMaxTotal; + private Long usersMaxTotal; + + public Builder() {} + + public Builder emailSendsMaxMonthly(Long emailSendsMaxMonthly) { + this.emailSendsMaxMonthly = emailSendsMaxMonthly; + return this; + } + + public Builder ipCount(Long ipCount) { + this.ipCount = ipCount; + return this; + } + + public Builder teammatesMaxTotal(Long teammatesMaxTotal) { + this.teammatesMaxTotal = teammatesMaxTotal; + return this; + } + + public Builder usersMaxTotal(Long usersMaxTotal) { + this.usersMaxTotal = usersMaxTotal; + return this; + } + + public CatalogEntryEntitlements build() { + return new CatalogEntryEntitlements(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CatalogEntryEntitlements.class.getSimpleName() + "(", + ")" + ); + if (emailSendsMaxMonthly != null) joiner.add( + "emailSendsMaxMonthly=" + emailSendsMaxMonthly + ); + if (ipCount != null) joiner.add("ipCount=" + ipCount); + if (teammatesMaxTotal != null) joiner.add( + "teammatesMaxTotal=" + teammatesMaxTotal + ); + if (usersMaxTotal != null) joiner.add("usersMaxTotal=" + usersMaxTotal); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/CreateAccountParams.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/CreateAccountParams.java new file mode 100644 index 00000000..6bdfc565 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/CreateAccountParams.java @@ -0,0 +1,79 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.accountprovisioning.models.AccountProvisioningOfferingV1; +import com.sendgrid.rest.api.v3.accountprovisioning.models.AccountProvisioningProfile; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateAccountParams { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("profile") + @Getter + @Setter + private AccountProvisioningProfile profile; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("offerings") + @Getter + @Setter + private List offerings; + + public CreateAccountParams() {} + + private CreateAccountParams(Builder builder) { + this.profile = builder.profile; + this.offerings = builder.offerings; + } + + // Builder class for constructing object + public static class Builder { + + private AccountProvisioningProfile profile; + private List offerings; + + public Builder(List offerings) { + this.offerings = offerings; + } + + public Builder profile(AccountProvisioningProfile profile) { + this.profile = profile; + return this; + } + + public CreateAccountParams build() { + return new CreateAccountParams(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateAccountParams.class.getSimpleName() + "(", + ")" + ); + if (profile != null) joiner.add("profile=" + profile); + if (offerings != null) joiner.add("offerings=" + offerings); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/ErrorResponse.java new file mode 100644 index 00000000..1c2c593c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/ErrorResponse.java @@ -0,0 +1,82 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_id") + @Getter + @Setter + private String errorId; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.errorId = builder.errorId; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private String errorId; + + public Builder(String message, String field, String errorId) { + this.message = message; + this.field = field; + this.errorId = errorId; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (errorId != null) joiner.add("errorId=" + errorId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/OfferingsToAdd.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/OfferingsToAdd.java new file mode 100644 index 00000000..8a385aa5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/OfferingsToAdd.java @@ -0,0 +1,64 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.accountprovisioning.models.AccountProvisioningOfferingV1; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class OfferingsToAdd { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("offerings") + @Getter + @Setter + private List offerings; + + public OfferingsToAdd() {} + + private OfferingsToAdd(Builder builder) { + this.offerings = builder.offerings; + } + + // Builder class for constructing object + public static class Builder { + + private List offerings; + + public Builder(List offerings) { + this.offerings = offerings; + } + + public OfferingsToAdd build() { + return new OfferingsToAdd(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + OfferingsToAdd.class.getSimpleName() + "(", + ")" + ); + if (offerings != null) joiner.add("offerings=" + offerings); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/State.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/State.java new file mode 100644 index 00000000..7ec52560 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/State.java @@ -0,0 +1,48 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum State { + ACTIVATED("activated"), + + DEACTIVATED("deactivated"), + + SUSPENDED("suspended"), + + BANNED("banned"), + + INDETERMINATE("indeterminate"); + + private final String value; + + private State(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static State forValue(final String value) { + return Promoter.enumFromString(value, State.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/State1.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/State1.java new file mode 100644 index 00000000..e0b7bd09 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/State1.java @@ -0,0 +1,42 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum State1 { + ACTIVATED("activated"), + + DEACTIVATED("deactivated"); + + private final String value; + + private State1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static State1 forValue(final String value) { + return Promoter.enumFromString(value, State1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/Type.java b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/Type.java new file mode 100644 index 00000000..dd8adffd --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/accountprovisioning/models/Type.java @@ -0,0 +1,42 @@ +/* + * 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.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Type { + PACKAGE("package"), + + ADDON("addon"); + + private final String value; + + private Type(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Type forValue(final String value) { + return Promoter.enumFromString(value, Type.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/alerts/CreateAlert.java b/src/main/java/com/sendgrid/rest/api/v3/alerts/CreateAlert.java new file mode 100644 index 00000000..dbdbbf58 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/alerts/CreateAlert.java @@ -0,0 +1,111 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Alerts API + * The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + * + * 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.alerts; + +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.alerts.models.CreateAlert201Response; +import com.sendgrid.rest.api.v3.alerts.models.CreateAlertRequest; +import com.sendgrid.rest.api.v3.alerts.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateAlert extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private CreateAlertRequest createAlertRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/alerts"; + 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( + "CreateAlert 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + CreateAlert201Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (createAlertRequest != null) { + request.addBody(JsonUtil.toJson(createAlertRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/alerts/DeleteAlert.java b/src/main/java/com/sendgrid/rest/api/v3/alerts/DeleteAlert.java new file mode 100644 index 00000000..81b973d2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/alerts/DeleteAlert.java @@ -0,0 +1,84 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Alerts API + * The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + * + * 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.alerts; + +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 lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteAlert extends ApiKeyBase { + + private final Integer alertId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/alerts/{alert_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteAlert creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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 (alertId != null) { + request.addPathParam("alert_id", alertId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/alerts/GetAlert.java b/src/main/java/com/sendgrid/rest/api/v3/alerts/GetAlert.java new file mode 100644 index 00000000..37fe4fa4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/alerts/GetAlert.java @@ -0,0 +1,91 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Alerts API + * The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + * + * 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.alerts; + +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.alerts.models.GetAlert200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetAlert extends ApiKeyBase { + + private final Integer alertId; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/alerts/{alert_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetAlert creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), GetAlert200Response.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (alertId != null) { + request.addPathParam("alert_id", alertId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/alerts/ListAlert.java b/src/main/java/com/sendgrid/rest/api/v3/alerts/ListAlert.java new file mode 100644 index 00000000..495cdb32 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/alerts/ListAlert.java @@ -0,0 +1,83 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Alerts API + * The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + * + * 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.alerts; + +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.alerts.models.ListAlert200ResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListAlert extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/alerts"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListAlert creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/alerts/UpdateAlert.java b/src/main/java/com/sendgrid/rest/api/v3/alerts/UpdateAlert.java new file mode 100644 index 00000000..42655995 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/alerts/UpdateAlert.java @@ -0,0 +1,105 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Alerts API + * The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + * + * 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.alerts; + +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.alerts.models.UpdateAlert200Response; +import com.sendgrid.rest.api.v3.alerts.models.UpdateAlertRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateAlert extends ApiKeyBase { + + private final Integer alertId; + + @Setter + private String onBehalfOf; + + @Setter + private UpdateAlertRequest updateAlertRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/alerts/{alert_id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateAlert creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + UpdateAlert200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (alertId != null) { + request.addPathParam("alert_id", alertId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateAlertRequest != null) { + request.addBody(JsonUtil.toJson(updateAlertRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/alerts/models/CreateAlert201Response.java b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/CreateAlert201Response.java new file mode 100644 index 00000000..05b3041c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/CreateAlert201Response.java @@ -0,0 +1,136 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Alerts API + * The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + * + * 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.alerts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateAlert201Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private Integer createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email_to") + @Getter + @Setter + private String emailTo; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("frequency") + @Getter + @Setter + private String frequency; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private Integer updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("percentage") + @Getter + @Setter + private Integer percentage; + + public CreateAlert201Response() {} + + private CreateAlert201Response(Builder builder) { + this.createdAt = builder.createdAt; + this.emailTo = builder.emailTo; + this.frequency = builder.frequency; + this.id = builder.id; + this.type = builder.type; + this.updatedAt = builder.updatedAt; + this.percentage = builder.percentage; + } + + // Builder class for constructing object + public static class Builder { + + private Integer createdAt; + private String emailTo; + private String frequency; + private Integer id; + private String type; + private Integer updatedAt; + private Integer percentage; + + public Builder( + Integer createdAt, + String emailTo, + Integer id, + String type, + Integer updatedAt + ) { + this.createdAt = createdAt; + this.emailTo = emailTo; + this.id = id; + this.type = type; + this.updatedAt = updatedAt; + } + + public Builder frequency(String frequency) { + this.frequency = frequency; + return this; + } + + public Builder percentage(Integer percentage) { + this.percentage = percentage; + return this; + } + + public CreateAlert201Response build() { + return new CreateAlert201Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateAlert201Response.class.getSimpleName() + "(", + ")" + ); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (emailTo != null) joiner.add("emailTo=" + emailTo); + if (frequency != null) joiner.add("frequency=" + frequency); + if (id != null) joiner.add("id=" + id); + if (type != null) joiner.add("type=" + type); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (percentage != null) joiner.add("percentage=" + percentage); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/alerts/models/CreateAlertRequest.java b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/CreateAlertRequest.java new file mode 100644 index 00000000..d60f28c1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/CreateAlertRequest.java @@ -0,0 +1,101 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Alerts API + * The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + * + * 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.alerts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.alerts.models.Type; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateAlertRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private Type type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email_to") + @Getter + @Setter + private String emailTo; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("frequency") + @Getter + @Setter + private String frequency; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("percentage") + @Getter + @Setter + private Integer percentage; + + public CreateAlertRequest() {} + + private CreateAlertRequest(Builder builder) { + this.type = builder.type; + this.emailTo = builder.emailTo; + this.frequency = builder.frequency; + this.percentage = builder.percentage; + } + + // Builder class for constructing object + public static class Builder { + + private Type type; + private String emailTo; + private String frequency; + private Integer percentage; + + public Builder(Type type, String emailTo) { + this.type = type; + this.emailTo = emailTo; + } + + public Builder frequency(String frequency) { + this.frequency = frequency; + return this; + } + + public Builder percentage(Integer percentage) { + this.percentage = percentage; + return this; + } + + public CreateAlertRequest build() { + return new CreateAlertRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateAlertRequest.class.getSimpleName() + "(", + ")" + ); + if (type != null) joiner.add("type=" + type); + if (emailTo != null) joiner.add("emailTo=" + emailTo); + if (frequency != null) joiner.add("frequency=" + frequency); + if (percentage != null) joiner.add("percentage=" + percentage); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/alerts/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/ErrorResponse.java new file mode 100644 index 00000000..c77cfe60 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Alerts API + * The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + * + * 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.alerts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.alerts.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/alerts/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..e8c3c308 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Alerts API + * The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + * + * 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.alerts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/alerts/models/GetAlert200Response.java b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/GetAlert200Response.java new file mode 100644 index 00000000..3befcc58 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/GetAlert200Response.java @@ -0,0 +1,137 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Alerts API + * The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + * + * 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.alerts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.alerts.models.Type2; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetAlert200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private Integer createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email_to") + @Getter + @Setter + private String emailTo; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("frequency") + @Getter + @Setter + private String frequency; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private Type2 type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private Integer updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("percentage") + @Getter + @Setter + private Integer percentage; + + public GetAlert200Response() {} + + private GetAlert200Response(Builder builder) { + this.createdAt = builder.createdAt; + this.emailTo = builder.emailTo; + this.frequency = builder.frequency; + this.id = builder.id; + this.type = builder.type; + this.updatedAt = builder.updatedAt; + this.percentage = builder.percentage; + } + + // Builder class for constructing object + public static class Builder { + + private Integer createdAt; + private String emailTo; + private String frequency; + private Integer id; + private Type2 type; + private Integer updatedAt; + private Integer percentage; + + public Builder( + Integer createdAt, + String emailTo, + Integer id, + Type2 type, + Integer updatedAt + ) { + this.createdAt = createdAt; + this.emailTo = emailTo; + this.id = id; + this.type = type; + this.updatedAt = updatedAt; + } + + public Builder frequency(String frequency) { + this.frequency = frequency; + return this; + } + + public Builder percentage(Integer percentage) { + this.percentage = percentage; + return this; + } + + public GetAlert200Response build() { + return new GetAlert200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetAlert200Response.class.getSimpleName() + "(", + ")" + ); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (emailTo != null) joiner.add("emailTo=" + emailTo); + if (frequency != null) joiner.add("frequency=" + frequency); + if (id != null) joiner.add("id=" + id); + if (type != null) joiner.add("type=" + type); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (percentage != null) joiner.add("percentage=" + percentage); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/alerts/models/ListAlert200ResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/ListAlert200ResponseInner.java new file mode 100644 index 00000000..9408858f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/ListAlert200ResponseInner.java @@ -0,0 +1,140 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Alerts API + * The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + * + * 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.alerts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.alerts.models.Type1; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListAlert200ResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private Integer createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email_to") + @Getter + @Setter + private String emailTo; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("percentage") + @Getter + @Setter + private Integer percentage; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private Type1 type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private Integer updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("frequency") + @Getter + @Setter + private String frequency; + + public ListAlert200ResponseInner() {} + + private ListAlert200ResponseInner(Builder builder) { + this.createdAt = builder.createdAt; + this.emailTo = builder.emailTo; + this.id = builder.id; + this.percentage = builder.percentage; + this.type = builder.type; + this.updatedAt = builder.updatedAt; + this.frequency = builder.frequency; + } + + // Builder class for constructing object + public static class Builder { + + private Integer createdAt; + private String emailTo; + private Integer id; + private Integer percentage; + private Type1 type; + private Integer updatedAt; + private String frequency; + + public Builder( + Integer createdAt, + String emailTo, + Integer id, + Type1 type + ) { + this.createdAt = createdAt; + this.emailTo = emailTo; + this.id = id; + this.type = type; + } + + public Builder percentage(Integer percentage) { + this.percentage = percentage; + return this; + } + + public Builder updatedAt(Integer updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder frequency(String frequency) { + this.frequency = frequency; + return this; + } + + public ListAlert200ResponseInner build() { + return new ListAlert200ResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListAlert200ResponseInner.class.getSimpleName() + "(", + ")" + ); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (emailTo != null) joiner.add("emailTo=" + emailTo); + if (id != null) joiner.add("id=" + id); + if (percentage != null) joiner.add("percentage=" + percentage); + if (type != null) joiner.add("type=" + type); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (frequency != null) joiner.add("frequency=" + frequency); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/alerts/models/Type.java b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/Type.java new file mode 100644 index 00000000..a9c38d98 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/Type.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Alerts API + * The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + * + * 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.alerts.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Type { + STATS_NOTIFICATION("stats_notification"), + + USAGE_LIMIT("usage_limit"); + + private final String value; + + private Type(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Type forValue(final String value) { + return Promoter.enumFromString(value, Type.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/alerts/models/Type1.java b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/Type1.java new file mode 100644 index 00000000..dd1e2891 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/Type1.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Alerts API + * The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + * + * 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.alerts.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Type1 { + USAGE_LIMIT("usage_limit"), + + STATS_NOTIFICATION("stats_notification"); + + private final String value; + + private Type1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Type1 forValue(final String value) { + return Promoter.enumFromString(value, Type1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/alerts/models/Type2.java b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/Type2.java new file mode 100644 index 00000000..c86d51c5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/Type2.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Alerts API + * The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + * + * 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.alerts.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Type2 { + USAGE_LIMIT("usage_limit"), + + STATS_NOTIFICATION("stats_notification"); + + private final String value; + + private Type2(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Type2 forValue(final String value) { + return Promoter.enumFromString(value, Type2.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/alerts/models/Type3.java b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/Type3.java new file mode 100644 index 00000000..6ac3fa05 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/Type3.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Alerts API + * The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + * + * 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.alerts.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Type3 { + USAGE_LIMIT("usage_limit"), + + STATS_NOTIFICATION("stats_notification"); + + private final String value; + + private Type3(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Type3 forValue(final String value) { + return Promoter.enumFromString(value, Type3.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/alerts/models/UpdateAlert200Response.java b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/UpdateAlert200Response.java new file mode 100644 index 00000000..399654bf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/UpdateAlert200Response.java @@ -0,0 +1,137 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Alerts API + * The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + * + * 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.alerts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.alerts.models.Type3; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateAlert200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private Integer createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email_to") + @Getter + @Setter + private String emailTo; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("frequency") + @Getter + @Setter + private String frequency; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private Type3 type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private Integer updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("percentage") + @Getter + @Setter + private Integer percentage; + + public UpdateAlert200Response() {} + + private UpdateAlert200Response(Builder builder) { + this.createdAt = builder.createdAt; + this.emailTo = builder.emailTo; + this.frequency = builder.frequency; + this.id = builder.id; + this.type = builder.type; + this.updatedAt = builder.updatedAt; + this.percentage = builder.percentage; + } + + // Builder class for constructing object + public static class Builder { + + private Integer createdAt; + private String emailTo; + private String frequency; + private Integer id; + private Type3 type; + private Integer updatedAt; + private Integer percentage; + + public Builder( + Integer createdAt, + String emailTo, + Integer id, + Type3 type, + Integer updatedAt + ) { + this.createdAt = createdAt; + this.emailTo = emailTo; + this.id = id; + this.type = type; + this.updatedAt = updatedAt; + } + + public Builder frequency(String frequency) { + this.frequency = frequency; + return this; + } + + public Builder percentage(Integer percentage) { + this.percentage = percentage; + return this; + } + + public UpdateAlert200Response build() { + return new UpdateAlert200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateAlert200Response.class.getSimpleName() + "(", + ")" + ); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (emailTo != null) joiner.add("emailTo=" + emailTo); + if (frequency != null) joiner.add("frequency=" + frequency); + if (id != null) joiner.add("id=" + id); + if (type != null) joiner.add("type=" + type); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (percentage != null) joiner.add("percentage=" + percentage); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/alerts/models/UpdateAlertRequest.java b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/UpdateAlertRequest.java new file mode 100644 index 00000000..dae59fb8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/alerts/models/UpdateAlertRequest.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Alerts API + * The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + * + * 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.alerts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateAlertRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email_to") + @Getter + @Setter + private String emailTo; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("frequency") + @Getter + @Setter + private String frequency; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("percentage") + @Getter + @Setter + private Integer percentage; + + public UpdateAlertRequest() {} + + private UpdateAlertRequest(Builder builder) { + this.emailTo = builder.emailTo; + this.frequency = builder.frequency; + this.percentage = builder.percentage; + } + + // Builder class for constructing object + public static class Builder { + + private String emailTo; + private String frequency; + private Integer percentage; + + public Builder() {} + + public Builder emailTo(String emailTo) { + this.emailTo = emailTo; + return this; + } + + public Builder frequency(String frequency) { + this.frequency = frequency; + return this; + } + + public Builder percentage(Integer percentage) { + this.percentage = percentage; + return this; + } + + public UpdateAlertRequest build() { + return new UpdateAlertRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateAlertRequest.class.getSimpleName() + "(", + ")" + ); + if (emailTo != null) joiner.add("emailTo=" + emailTo); + if (frequency != null) joiner.add("frequency=" + frequency); + if (percentage != null) joiner.add("percentage=" + percentage); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/apikeys/CreateApiKey.java b/src/main/java/com/sendgrid/rest/api/v3/apikeys/CreateApiKey.java new file mode 100644 index 00000000..5b42e738 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/apikeys/CreateApiKey.java @@ -0,0 +1,163 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid API Keys API + * The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + * + * 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.apikeys; + +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.apikeys.models.CreateApiKey201Response; +import com.sendgrid.rest.api.v3.apikeys.models.CreateApiKeyRequest; +import com.sendgrid.rest.api.v3.apikeys.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateApiKey extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private CreateApiKeyRequest createApiKeyRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/api_keys"; + 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( + "CreateApiKey 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + CreateApiKey201Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (createApiKeyRequest != null) { + request.addBody(JsonUtil.toJson(createApiKeyRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/apikeys/DeleteApiKey.java b/src/main/java/com/sendgrid/rest/api/v3/apikeys/DeleteApiKey.java new file mode 100644 index 00000000..cb18eb06 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/apikeys/DeleteApiKey.java @@ -0,0 +1,151 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid API Keys API + * The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + * + * 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.apikeys; + +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.apikeys.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteApiKey extends ApiKeyBase { + + private final String apiKeyId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/api_keys/{api_key_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteApiKey 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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 (apiKeyId != null) { + request.addPathParam("api_key_id", apiKeyId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/apikeys/GetApiKey.java b/src/main/java/com/sendgrid/rest/api/v3/apikeys/GetApiKey.java new file mode 100644 index 00000000..80085ecd --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/apikeys/GetApiKey.java @@ -0,0 +1,158 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid API Keys API + * The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + * + * 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.apikeys; + +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.apikeys.models.ErrorResponse; +import com.sendgrid.rest.api.v3.apikeys.models.GetApiKey200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetApiKey extends ApiKeyBase { + + private final String apiKeyId; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/api_keys/{api_key_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetApiKey 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), GetApiKey200Response.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (apiKeyId != null) { + request.addPathParam("api_key_id", apiKeyId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/apikeys/ListApiKey.java b/src/main/java/com/sendgrid/rest/api/v3/apikeys/ListApiKey.java new file mode 100644 index 00000000..d89b9a2e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/apikeys/ListApiKey.java @@ -0,0 +1,149 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid API Keys API + * The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + * + * 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.apikeys; + +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.apikeys.models.ErrorResponse; +import com.sendgrid.rest.api.v3.apikeys.models.ListApiKey200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListApiKey extends ApiKeyBase { + + @Setter + private Integer limit; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/api_keys"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListApiKey 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + ListApiKey200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/apikeys/UpdateApiKey.java b/src/main/java/com/sendgrid/rest/api/v3/apikeys/UpdateApiKey.java new file mode 100644 index 00000000..71ec51f0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/apikeys/UpdateApiKey.java @@ -0,0 +1,167 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid API Keys API + * The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + * + * 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.apikeys; + +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.apikeys.models.ApiKeyResponse; +import com.sendgrid.rest.api.v3.apikeys.models.ErrorResponse; +import com.sendgrid.rest.api.v3.apikeys.models.UpdateApiKeyRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateApiKey extends ApiKeyBase { + + private final String apiKeyId; + + @Setter + private String onBehalfOf; + + @Setter + private UpdateApiKeyRequest updateApiKeyRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/api_keys/{api_key_id}"; + Request request = new Request( + HttpMethod.PUT, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateApiKey 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), ApiKeyResponse.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (apiKeyId != null) { + request.addPathParam("api_key_id", apiKeyId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateApiKeyRequest != null) { + request.addBody(JsonUtil.toJson(updateApiKeyRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/apikeys/UpdateApiKeyName.java b/src/main/java/com/sendgrid/rest/api/v3/apikeys/UpdateApiKeyName.java new file mode 100644 index 00000000..675b257d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/apikeys/UpdateApiKeyName.java @@ -0,0 +1,167 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid API Keys API + * The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + * + * 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.apikeys; + +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.apikeys.models.ApiKeyResponse; +import com.sendgrid.rest.api.v3.apikeys.models.ErrorResponse; +import com.sendgrid.rest.api.v3.apikeys.models.UpdateApiKeyNameRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateApiKeyName extends ApiKeyBase { + + private final String apiKeyId; + + @Setter + private String onBehalfOf; + + @Setter + private UpdateApiKeyNameRequest updateApiKeyNameRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/api_keys/{api_key_id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateApiKeyName 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), ApiKeyResponse.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (apiKeyId != null) { + request.addPathParam("api_key_id", apiKeyId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateApiKeyNameRequest != null) { + request.addBody(JsonUtil.toJson(updateApiKeyNameRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/ApiKeyResponse.java b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/ApiKeyResponse.java new file mode 100644 index 00000000..4ed513df --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/ApiKeyResponse.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid API Keys API + * The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + * + * 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.apikeys.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ApiKeyResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("api_key_id") + @Getter + @Setter + private String apiKeyId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public ApiKeyResponse() {} + + private ApiKeyResponse(Builder builder) { + this.apiKeyId = builder.apiKeyId; + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String apiKeyId; + private String name; + + public Builder() {} + + public Builder apiKeyId(String apiKeyId) { + this.apiKeyId = apiKeyId; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public ApiKeyResponse build() { + return new ApiKeyResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ApiKeyResponse.class.getSimpleName() + "(", + ")" + ); + if (apiKeyId != null) joiner.add("apiKeyId=" + apiKeyId); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/ApiKeyScopesResponse.java b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/ApiKeyScopesResponse.java new file mode 100644 index 00000000..5110f27c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/ApiKeyScopesResponse.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid API Keys API + * The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + * + * 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.apikeys.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ApiKeyScopesResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("scopes") + @Getter + @Setter + private List scopes; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("api_key_id") + @Getter + @Setter + private String apiKeyId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public ApiKeyScopesResponse() {} + + private ApiKeyScopesResponse(Builder builder) { + this.scopes = builder.scopes; + this.apiKeyId = builder.apiKeyId; + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private List scopes; + private String apiKeyId; + private String name; + + public Builder() {} + + public Builder scopes(List scopes) { + this.scopes = scopes; + return this; + } + + public Builder apiKeyId(String apiKeyId) { + this.apiKeyId = apiKeyId; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public ApiKeyScopesResponse build() { + return new ApiKeyScopesResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ApiKeyScopesResponse.class.getSimpleName() + "(", + ")" + ); + if (scopes != null) joiner.add("scopes=" + scopes); + if (apiKeyId != null) joiner.add("apiKeyId=" + apiKeyId); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/CreateApiKey201Response.java b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/CreateApiKey201Response.java new file mode 100644 index 00000000..72d61bed --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/CreateApiKey201Response.java @@ -0,0 +1,108 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid API Keys API + * The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + * + * 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.apikeys.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateApiKey201Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("api_key") + @Getter + @Setter + private String apiKey; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("api_key_id") + @Getter + @Setter + private String apiKeyId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("scopes") + @Getter + @Setter + private List scopes; + + public CreateApiKey201Response() {} + + private CreateApiKey201Response(Builder builder) { + this.apiKey = builder.apiKey; + this.apiKeyId = builder.apiKeyId; + this.name = builder.name; + this.scopes = builder.scopes; + } + + // Builder class for constructing object + public static class Builder { + + private String apiKey; + private String apiKeyId; + private String name; + private List scopes; + + public Builder() {} + + public Builder apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + public Builder apiKeyId(String apiKeyId) { + this.apiKeyId = apiKeyId; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder scopes(List scopes) { + this.scopes = scopes; + return this; + } + + public CreateApiKey201Response build() { + return new CreateApiKey201Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateApiKey201Response.class.getSimpleName() + "(", + ")" + ); + if (apiKey != null) joiner.add("apiKey=" + apiKey); + if (apiKeyId != null) joiner.add("apiKeyId=" + apiKeyId); + if (name != null) joiner.add("name=" + name); + if (scopes != null) joiner.add("scopes=" + scopes); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/CreateApiKeyRequest.java b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/CreateApiKeyRequest.java new file mode 100644 index 00000000..5d8af2a2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/CreateApiKeyRequest.java @@ -0,0 +1,77 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid API Keys API + * The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + * + * 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.apikeys.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateApiKeyRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("scopes") + @Getter + @Setter + private List scopes; + + public CreateApiKeyRequest() {} + + private CreateApiKeyRequest(Builder builder) { + this.name = builder.name; + this.scopes = builder.scopes; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private List scopes; + + public Builder(String name) { + this.name = name; + } + + public Builder scopes(List scopes) { + this.scopes = scopes; + return this; + } + + public CreateApiKeyRequest build() { + return new CreateApiKeyRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateApiKeyRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (scopes != null) joiner.add("scopes=" + scopes); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/ErrorResponse.java new file mode 100644 index 00000000..4b7cb00b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid API Keys API + * The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + * + * 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.apikeys.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.apikeys.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..b65faa80 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid API Keys API + * The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + * + * 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.apikeys.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/GetApiKey200Response.java b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/GetApiKey200Response.java new file mode 100644 index 00000000..fa298f88 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/GetApiKey200Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid API Keys API + * The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + * + * 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.apikeys.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.apikeys.models.ApiKeyScopesResponse; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetApiKey200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + public GetApiKey200Response() {} + + private GetApiKey200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + + public Builder() {} + + public Builder result(List result) { + this.result = result; + return this; + } + + public GetApiKey200Response build() { + return new GetApiKey200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetApiKey200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/ListApiKey200Response.java b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/ListApiKey200Response.java new file mode 100644 index 00000000..e7f2d59e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/ListApiKey200Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid API Keys API + * The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + * + * 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.apikeys.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.apikeys.models.ApiKeyResponse; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListApiKey200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + public ListApiKey200Response() {} + + private ListApiKey200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + + public Builder() {} + + public Builder result(List result) { + this.result = result; + return this; + } + + public ListApiKey200Response build() { + return new ListApiKey200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListApiKey200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/UpdateApiKeyNameRequest.java b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/UpdateApiKeyNameRequest.java new file mode 100644 index 00000000..5ad1c04e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/UpdateApiKeyNameRequest.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid API Keys API + * The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + * + * 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.apikeys.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateApiKeyNameRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public UpdateApiKeyNameRequest() {} + + private UpdateApiKeyNameRequest(Builder builder) { + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + + public Builder(String name) { + this.name = name; + } + + public UpdateApiKeyNameRequest build() { + return new UpdateApiKeyNameRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateApiKeyNameRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/UpdateApiKeyRequest.java b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/UpdateApiKeyRequest.java new file mode 100644 index 00000000..15807eb5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/apikeys/models/UpdateApiKeyRequest.java @@ -0,0 +1,77 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid API Keys API + * The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + * + * 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.apikeys.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateApiKeyRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("scopes") + @Getter + @Setter + private List scopes; + + public UpdateApiKeyRequest() {} + + private UpdateApiKeyRequest(Builder builder) { + this.name = builder.name; + this.scopes = builder.scopes; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private List scopes; + + public Builder(String name) { + this.name = name; + } + + public Builder scopes(List scopes) { + this.scopes = scopes; + return this; + } + + public UpdateApiKeyRequest build() { + return new UpdateApiKeyRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateApiKeyRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (scopes != null) joiner.add("scopes=" + scopes); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/AddIpToAuthenticatedDomain.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/AddIpToAuthenticatedDomain.java new file mode 100644 index 00000000..47150302 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/AddIpToAuthenticatedDomain.java @@ -0,0 +1,105 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication; + +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.domainauthentication.models.AddIpToAuthenticatedDomainRequest; +import com.sendgrid.rest.api.v3.domainauthentication.models.AuthenticatedDomainSpf; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class AddIpToAuthenticatedDomain extends ApiKeyBase { + + private final Integer id; + + @Setter + private String onBehalfOf; + + @Setter + private AddIpToAuthenticatedDomainRequest addIpToAuthenticatedDomainRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/whitelabel/domains/{id}/ips"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "AddIpToAuthenticatedDomain creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + AuthenticatedDomainSpf.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (addIpToAuthenticatedDomainRequest != null) { + request.addBody(JsonUtil.toJson(addIpToAuthenticatedDomainRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/AssociateSubuserWithDomain.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/AssociateSubuserWithDomain.java new file mode 100644 index 00000000..54cc2600 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/AssociateSubuserWithDomain.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication; + +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.domainauthentication.models.AssociateSubuserWithDomainRequest; +import com.sendgrid.rest.api.v3.domainauthentication.models.AuthenticatedDomainSpf; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class AssociateSubuserWithDomain extends ApiKeyBase { + + private final Integer domainId; + + @Setter + private AssociateSubuserWithDomainRequest associateSubuserWithDomainRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/whitelabel/domains/{domain_id}/subuser"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "AssociateSubuserWithDomain creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + AuthenticatedDomainSpf.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (domainId != null) { + request.addPathParam("domain_id", domainId.toString()); + } + } + + private void addBody(final Request request) { + if (associateSubuserWithDomainRequest != null) { + request.addBody(JsonUtil.toJson(associateSubuserWithDomainRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/AssociateSubuserWithDomainMultiple.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/AssociateSubuserWithDomainMultiple.java new file mode 100644 index 00000000..30f44e14 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/AssociateSubuserWithDomainMultiple.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication; + +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.domainauthentication.models.AssociateSubuserWithDomainRequest; +import com.sendgrid.rest.api.v3.domainauthentication.models.AuthenticatedDomainSpf; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class AssociateSubuserWithDomainMultiple extends ApiKeyBase { + + private final Integer domainId; + + @Setter + private AssociateSubuserWithDomainRequest associateSubuserWithDomainRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/whitelabel/domains/{domain_id}/subuser:add"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "AssociateSubuserWithDomainMultiple creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + AuthenticatedDomainSpf.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (domainId != null) { + request.addPathParam("domain_id", domainId.toString()); + } + } + + private void addBody(final Request request) { + if (associateSubuserWithDomainRequest != null) { + request.addBody(JsonUtil.toJson(associateSubuserWithDomainRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/AuthenticateDomain.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/AuthenticateDomain.java new file mode 100644 index 00000000..9bf1d70e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/AuthenticateDomain.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication; + +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.domainauthentication.models.AuthenticateDomainRequest; +import com.sendgrid.rest.api.v3.domainauthentication.models.AuthenticatedDomain; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class AuthenticateDomain extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private AuthenticateDomainRequest authenticateDomainRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/whitelabel/domains"; + 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( + "AuthenticateDomain creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), AuthenticatedDomain.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (authenticateDomainRequest != null) { + request.addBody(JsonUtil.toJson(authenticateDomainRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/DeleteAuthenticatedDomain.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/DeleteAuthenticatedDomain.java new file mode 100644 index 00000000..9f78abb1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/DeleteAuthenticatedDomain.java @@ -0,0 +1,88 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication; + +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 lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteAuthenticatedDomain extends ApiKeyBase { + + private final String domainId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/domains/{domain_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteAuthenticatedDomain creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (domainId != null) { + request.addPathParam("domain_id", domainId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/DeleteIpFromAuthenticatedDomain.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/DeleteIpFromAuthenticatedDomain.java new file mode 100644 index 00000000..3d7f73ce --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/DeleteIpFromAuthenticatedDomain.java @@ -0,0 +1,98 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication; + +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.domainauthentication.models.AuthenticatedDomainSpf; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteIpFromAuthenticatedDomain extends ApiKeyBase { + + private final Integer id; + private final String ip; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/whitelabel/domains/{id}/ips/{ip}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteIpFromAuthenticatedDomain creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + AuthenticatedDomainSpf.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + if (ip != null) { + request.addPathParam("ip", ip.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/DisassociateAuthenticatedDomainFromUser.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/DisassociateAuthenticatedDomainFromUser.java new file mode 100644 index 00000000..643a19e2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/DisassociateAuthenticatedDomainFromUser.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication; + +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 lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DisassociateAuthenticatedDomainFromUser extends ApiKeyBase { + + @Setter + private String username; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/domains/subuser"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DisassociateAuthenticatedDomainFromUser creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (username != null) { + request.addQueryParam("username", username.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/DisassociateSubuserFromDomain.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/DisassociateSubuserFromDomain.java new file mode 100644 index 00000000..f0dc65d0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/DisassociateSubuserFromDomain.java @@ -0,0 +1,88 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication; + +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 lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DisassociateSubuserFromDomain extends ApiKeyBase { + + private final Integer domainId; + + @Setter + private String username; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/domains/{domain_id}/subuser"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DisassociateSubuserFromDomain creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (domainId != null) { + request.addPathParam("domain_id", domainId.toString()); + } + } + + private void addQueryParams(Request request) { + if (username != null) { + request.addQueryParam("username", username.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/EmailDnsRecord.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/EmailDnsRecord.java new file mode 100644 index 00000000..804eac8c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/EmailDnsRecord.java @@ -0,0 +1,91 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication; + +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.domainauthentication.models.EmailDnsRecord400Response; +import com.sendgrid.rest.api.v3.domainauthentication.models.EmailDnsRecordRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class EmailDnsRecord extends ApiKeyBase { + + @Setter + private EmailDnsRecordRequest emailDnsRecordRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/dns/email"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "EmailDnsRecord 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")) { + EmailDnsRecord400Response error = JsonUtil.fromJson( + response.getStream(), + EmailDnsRecord400Response.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 addBody(final Request request) { + if (emailDnsRecordRequest != null) { + request.addBody(JsonUtil.toJson(emailDnsRecordRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/GetAuthenticatedDomain.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/GetAuthenticatedDomain.java new file mode 100644 index 00000000..be1d04f7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/GetAuthenticatedDomain.java @@ -0,0 +1,91 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication; + +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.domainauthentication.models.AuthenticatedDomain; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetAuthenticatedDomain extends ApiKeyBase { + + private final String domainId; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/whitelabel/domains/{domain_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetAuthenticatedDomain creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), AuthenticatedDomain.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (domainId != null) { + request.addPathParam("domain_id", domainId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/ListAllAuthenticatedDomainWithUser.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/ListAllAuthenticatedDomainWithUser.java new file mode 100644 index 00000000..3e624d3f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/ListAllAuthenticatedDomainWithUser.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication; + +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.domainauthentication.models.ListAllAuthenticatedDomainWithUser200ResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListAllAuthenticatedDomainWithUser extends ApiKeyBase { + + private final String username; + + public ApiResponse< + List + > send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/domains/subuser/all"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListAllAuthenticatedDomainWithUser creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (username != null) { + request.addQueryParam("username", username.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/ListAuthenticatedDomain.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/ListAuthenticatedDomain.java new file mode 100644 index 00000000..dc2e1e96 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/ListAuthenticatedDomain.java @@ -0,0 +1,117 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication; + +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 java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListAuthenticatedDomain extends ApiKeyBase { + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private Boolean excludeSubusers; + + @Setter + private String username; + + @Setter + private String domain; + + @Setter + private String onBehalfOf; + + public ApiResponse> send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/domains"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListAuthenticatedDomain creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (excludeSubusers != null) { + request.addQueryParam( + "exclude_subusers", + excludeSubusers.toString() + ); + } + if (username != null) { + request.addQueryParam("username", username.toString()); + } + if (domain != null) { + request.addQueryParam("domain", domain.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/ListAuthenticatedDomainWithUser.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/ListAuthenticatedDomainWithUser.java new file mode 100644 index 00000000..a0c91a81 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/ListAuthenticatedDomainWithUser.java @@ -0,0 +1,83 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication; + +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.domainauthentication.models.AuthenticatedDomainSpf; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListAuthenticatedDomainWithUser extends ApiKeyBase { + + private final String username; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/whitelabel/domains/subuser"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListAuthenticatedDomainWithUser creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + AuthenticatedDomainSpf.class + ), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (username != null) { + request.addQueryParam("username", username.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/ListDefaultAuthenticatedDomain.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/ListDefaultAuthenticatedDomain.java new file mode 100644 index 00000000..fd98c3f7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/ListDefaultAuthenticatedDomain.java @@ -0,0 +1,90 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication; + +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 java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListDefaultAuthenticatedDomain extends ApiKeyBase { + + @Setter + private String domain; + + @Setter + private String onBehalfOf; + + public ApiResponse> send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/domains/default"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListDefaultAuthenticatedDomain creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (domain != null) { + request.addQueryParam("domain", domain.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/UpdateAuthenticatedDomain.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/UpdateAuthenticatedDomain.java new file mode 100644 index 00000000..764544c6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/UpdateAuthenticatedDomain.java @@ -0,0 +1,100 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication; + +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.domainauthentication.models.UpdateAuthenticatedDomainRequest; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateAuthenticatedDomain extends ApiKeyBase { + + private final String domainId; + + @Setter + private String onBehalfOf; + + @Setter + private UpdateAuthenticatedDomainRequest updateAuthenticatedDomainRequest; + + public ApiResponse> send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/domains/{domain_id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateAuthenticatedDomain creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (domainId != null) { + request.addPathParam("domain_id", domainId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateAuthenticatedDomainRequest != null) { + request.addBody(JsonUtil.toJson(updateAuthenticatedDomainRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/ValidateAuthenticatedDomain.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/ValidateAuthenticatedDomain.java new file mode 100644 index 00000000..cc0db049 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/ValidateAuthenticatedDomain.java @@ -0,0 +1,110 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication; + +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.domainauthentication.models.ValidateAuthenticatedDomain200Response; +import com.sendgrid.rest.api.v3.domainauthentication.models.ValidateAuthenticatedDomain500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ValidateAuthenticatedDomain extends ApiKeyBase { + + private final Integer id; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/whitelabel/domains/{id}/validate"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ValidateAuthenticatedDomain creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ValidateAuthenticatedDomain500Response error = + JsonUtil.fromJson( + response.getStream(), + ValidateAuthenticatedDomain500Response.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(), + ValidateAuthenticatedDomain200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AddIpToAuthenticatedDomainRequest.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AddIpToAuthenticatedDomainRequest.java new file mode 100644 index 00000000..17225ffa --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AddIpToAuthenticatedDomainRequest.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddIpToAuthenticatedDomainRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + public AddIpToAuthenticatedDomainRequest() {} + + private AddIpToAuthenticatedDomainRequest(Builder builder) { + this.ip = builder.ip; + } + + // Builder class for constructing object + public static class Builder { + + private String ip; + + public Builder(String ip) { + this.ip = ip; + } + + public AddIpToAuthenticatedDomainRequest build() { + return new AddIpToAuthenticatedDomainRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddIpToAuthenticatedDomainRequest.class.getSimpleName() + "(", + ")" + ); + if (ip != null) joiner.add("ip=" + ip); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AssociateSubuserWithDomainRequest.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AssociateSubuserWithDomainRequest.java new file mode 100644 index 00000000..24594332 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AssociateSubuserWithDomainRequest.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AssociateSubuserWithDomainRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + public AssociateSubuserWithDomainRequest() {} + + private AssociateSubuserWithDomainRequest(Builder builder) { + this.username = builder.username; + } + + // Builder class for constructing object + public static class Builder { + + private String username; + + public Builder(String username) { + this.username = username; + } + + public AssociateSubuserWithDomainRequest build() { + return new AssociateSubuserWithDomainRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AssociateSubuserWithDomainRequest.class.getSimpleName() + "(", + ")" + ); + if (username != null) joiner.add("username=" + username); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticateDomainRequest.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticateDomainRequest.java new file mode 100644 index 00000000..0419e5d4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticateDomainRequest.java @@ -0,0 +1,179 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AuthenticateDomainRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("domain") + @Getter + @Setter + private String domain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subdomain") + @Getter + @Setter + private String subdomain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ips") + @Getter + @Setter + private List ips; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_spf") + @Getter + @Setter + private Boolean customSpf; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("default") + @Getter + @Setter + private Boolean _default; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("automatic_security") + @Getter + @Setter + private Boolean automaticSecurity; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_dkim_selector") + @Getter + @Setter + private String customDkimSelector; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("region") + @Getter + @Setter + private String region; + + public AuthenticateDomainRequest() {} + + private AuthenticateDomainRequest(Builder builder) { + this.domain = builder.domain; + this.subdomain = builder.subdomain; + this.username = builder.username; + this.ips = builder.ips; + this.customSpf = builder.customSpf; + this._default = builder._default; + this.automaticSecurity = builder.automaticSecurity; + this.customDkimSelector = builder.customDkimSelector; + this.region = builder.region; + } + + // Builder class for constructing object + public static class Builder { + + private String domain; + private String subdomain; + private String username; + private List ips; + private Boolean customSpf; + private Boolean _default; + private Boolean automaticSecurity; + private String customDkimSelector; + private String region; + + public Builder(String domain) { + this.domain = domain; + } + + public Builder subdomain(String subdomain) { + this.subdomain = subdomain; + return this; + } + + public Builder username(String username) { + this.username = username; + return this; + } + + public Builder ips(List ips) { + this.ips = ips; + return this; + } + + public Builder customSpf(Boolean customSpf) { + this.customSpf = customSpf; + return this; + } + + public Builder _default(Boolean _default) { + this._default = _default; + return this; + } + + public Builder automaticSecurity(Boolean automaticSecurity) { + this.automaticSecurity = automaticSecurity; + return this; + } + + public Builder customDkimSelector(String customDkimSelector) { + this.customDkimSelector = customDkimSelector; + return this; + } + + public Builder region(String region) { + this.region = region; + return this; + } + + public AuthenticateDomainRequest build() { + return new AuthenticateDomainRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AuthenticateDomainRequest.class.getSimpleName() + "(", + ")" + ); + if (domain != null) joiner.add("domain=" + domain); + if (subdomain != null) joiner.add("subdomain=" + subdomain); + if (username != null) joiner.add("username=" + username); + if (ips != null) joiner.add("ips=" + ips); + if (customSpf != null) joiner.add("customSpf=" + customSpf); + if (_default != null) joiner.add("_default=" + _default); + if (automaticSecurity != null) joiner.add( + "automaticSecurity=" + automaticSecurity + ); + if (customDkimSelector != null) joiner.add( + "customDkimSelector=" + customDkimSelector + ); + if (region != null) joiner.add("region=" + region); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomain.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomain.java new file mode 100644 index 00000000..85b6dae6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomain.java @@ -0,0 +1,190 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.domainauthentication.models.ListAllAuthenticatedDomainWithUser200ResponseInnerDns; +import java.math.BigDecimal; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AuthenticatedDomain { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private BigDecimal id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("user_id") + @Getter + @Setter + private BigDecimal userId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subdomain") + @Getter + @Setter + private String subdomain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("domain") + @Getter + @Setter + private String domain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ips") + @Getter + @Setter + private List ips; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_spf") + @Getter + @Setter + private Boolean customSpf; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("default") + @Getter + @Setter + private Boolean _default; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("legacy") + @Getter + @Setter + private Boolean legacy; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("automatic_security") + @Getter + @Setter + private Boolean automaticSecurity; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Boolean valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("dns") + @Getter + @Setter + private ListAllAuthenticatedDomainWithUser200ResponseInnerDns dns; + + public AuthenticatedDomain() {} + + private AuthenticatedDomain(Builder builder) { + this.id = builder.id; + this.userId = builder.userId; + this.subdomain = builder.subdomain; + this.domain = builder.domain; + this.username = builder.username; + this.ips = builder.ips; + this.customSpf = builder.customSpf; + this._default = builder._default; + this.legacy = builder.legacy; + this.automaticSecurity = builder.automaticSecurity; + this.valid = builder.valid; + this.dns = builder.dns; + } + + // Builder class for constructing object + public static class Builder { + + private BigDecimal id; + private BigDecimal userId; + private String subdomain; + private String domain; + private String username; + private List ips; + private Boolean customSpf; + private Boolean _default; + private Boolean legacy; + private Boolean automaticSecurity; + private Boolean valid; + private ListAllAuthenticatedDomainWithUser200ResponseInnerDns dns; + + public Builder( + BigDecimal id, + BigDecimal userId, + String subdomain, + String domain, + String username, + List ips, + Boolean customSpf, + Boolean _default, + Boolean legacy, + Boolean automaticSecurity, + Boolean valid, + ListAllAuthenticatedDomainWithUser200ResponseInnerDns dns + ) { + this.id = id; + this.userId = userId; + this.subdomain = subdomain; + this.domain = domain; + this.username = username; + this.ips = ips; + this.customSpf = customSpf; + this._default = _default; + this.legacy = legacy; + this.automaticSecurity = automaticSecurity; + this.valid = valid; + this.dns = dns; + } + + public AuthenticatedDomain build() { + return new AuthenticatedDomain(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AuthenticatedDomain.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (userId != null) joiner.add("userId=" + userId); + if (subdomain != null) joiner.add("subdomain=" + subdomain); + if (domain != null) joiner.add("domain=" + domain); + if (username != null) joiner.add("username=" + username); + if (ips != null) joiner.add("ips=" + ips); + if (customSpf != null) joiner.add("customSpf=" + customSpf); + if (_default != null) joiner.add("_default=" + _default); + if (legacy != null) joiner.add("legacy=" + legacy); + if (automaticSecurity != null) joiner.add( + "automaticSecurity=" + automaticSecurity + ); + if (valid != null) joiner.add("valid=" + valid); + if (dns != null) joiner.add("dns=" + dns); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpf.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpf.java new file mode 100644 index 00000000..62b11430 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpf.java @@ -0,0 +1,192 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.domainauthentication.models.AuthenticatedDomainSpfDns; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AuthenticatedDomainSpf { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("domain") + @Getter + @Setter + private String domain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subdomain") + @Getter + @Setter + private String subdomain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("user_id") + @Getter + @Setter + private Integer userId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ips") + @Getter + @Setter + private List ips; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_spf") + @Getter + @Setter + private Boolean customSpf; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("default") + @Getter + @Setter + private Boolean _default; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("legacy") + @Getter + @Setter + private Boolean legacy; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("automatic_security") + @Getter + @Setter + private Boolean automaticSecurity; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Boolean valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("dns") + @Getter + @Setter + private AuthenticatedDomainSpfDns dns; + + public AuthenticatedDomainSpf() {} + + private AuthenticatedDomainSpf(Builder builder) { + this.id = builder.id; + this.domain = builder.domain; + this.subdomain = builder.subdomain; + this.username = builder.username; + this.userId = builder.userId; + this.ips = builder.ips; + this.customSpf = builder.customSpf; + this._default = builder._default; + this.legacy = builder.legacy; + this.automaticSecurity = builder.automaticSecurity; + this.valid = builder.valid; + this.dns = builder.dns; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private String domain; + private String subdomain; + private String username; + private Integer userId; + private List ips; + private Boolean customSpf; + private Boolean _default; + private Boolean legacy; + private Boolean automaticSecurity; + private Boolean valid; + private AuthenticatedDomainSpfDns dns; + + public Builder( + Integer id, + String domain, + String username, + Integer userId, + List ips, + Boolean customSpf, + Boolean _default, + Boolean legacy, + Boolean automaticSecurity, + Boolean valid, + AuthenticatedDomainSpfDns dns + ) { + this.id = id; + this.domain = domain; + this.username = username; + this.userId = userId; + this.ips = ips; + this.customSpf = customSpf; + this._default = _default; + this.legacy = legacy; + this.automaticSecurity = automaticSecurity; + this.valid = valid; + this.dns = dns; + } + + public Builder subdomain(String subdomain) { + this.subdomain = subdomain; + return this; + } + + public AuthenticatedDomainSpf build() { + return new AuthenticatedDomainSpf(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AuthenticatedDomainSpf.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (domain != null) joiner.add("domain=" + domain); + if (subdomain != null) joiner.add("subdomain=" + subdomain); + if (username != null) joiner.add("username=" + username); + if (userId != null) joiner.add("userId=" + userId); + if (ips != null) joiner.add("ips=" + ips); + if (customSpf != null) joiner.add("customSpf=" + customSpf); + if (_default != null) joiner.add("_default=" + _default); + if (legacy != null) joiner.add("legacy=" + legacy); + if (automaticSecurity != null) joiner.add( + "automaticSecurity=" + automaticSecurity + ); + if (valid != null) joiner.add("valid=" + valid); + if (dns != null) joiner.add("dns=" + dns); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpfDns.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpfDns.java new file mode 100644 index 00000000..bde7b9f5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpfDns.java @@ -0,0 +1,101 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.domainauthentication.models.AuthenticatedDomainSpfDnsDkim; +import com.sendgrid.rest.api.v3.domainauthentication.models.AuthenticatedDomainSpfDnsDomainSpf; +import com.sendgrid.rest.api.v3.domainauthentication.models.AuthenticatedDomainSpfDnsMailServer; +import com.sendgrid.rest.api.v3.domainauthentication.models.AuthenticatedDomainSpfDnsSubdomainSpf; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AuthenticatedDomainSpfDns { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("mail_server") + @Getter + @Setter + private AuthenticatedDomainSpfDnsMailServer mailServer; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subdomain_spf") + @Getter + @Setter + private AuthenticatedDomainSpfDnsSubdomainSpf subdomainSpf; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("domain_spf") + @Getter + @Setter + private AuthenticatedDomainSpfDnsDomainSpf domainSpf; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("dkim") + @Getter + @Setter + private AuthenticatedDomainSpfDnsDkim dkim; + + public AuthenticatedDomainSpfDns() {} + + private AuthenticatedDomainSpfDns(Builder builder) { + this.mailServer = builder.mailServer; + this.subdomainSpf = builder.subdomainSpf; + this.domainSpf = builder.domainSpf; + this.dkim = builder.dkim; + } + + // Builder class for constructing object + public static class Builder { + + private AuthenticatedDomainSpfDnsMailServer mailServer; + private AuthenticatedDomainSpfDnsSubdomainSpf subdomainSpf; + private AuthenticatedDomainSpfDnsDomainSpf domainSpf; + private AuthenticatedDomainSpfDnsDkim dkim; + + public Builder( + AuthenticatedDomainSpfDnsMailServer mailServer, + AuthenticatedDomainSpfDnsSubdomainSpf subdomainSpf, + AuthenticatedDomainSpfDnsDomainSpf domainSpf, + AuthenticatedDomainSpfDnsDkim dkim + ) { + this.mailServer = mailServer; + this.subdomainSpf = subdomainSpf; + this.domainSpf = domainSpf; + this.dkim = dkim; + } + + public AuthenticatedDomainSpfDns build() { + return new AuthenticatedDomainSpfDns(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AuthenticatedDomainSpfDns.class.getSimpleName() + "(", + ")" + ); + if (mailServer != null) joiner.add("mailServer=" + mailServer); + if (subdomainSpf != null) joiner.add("subdomainSpf=" + subdomainSpf); + if (domainSpf != null) joiner.add("domainSpf=" + domainSpf); + if (dkim != null) joiner.add("dkim=" + dkim); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpfDnsDkim.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpfDnsDkim.java new file mode 100644 index 00000000..d5ca8401 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpfDnsDkim.java @@ -0,0 +1,92 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AuthenticatedDomainSpfDnsDkim { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("host") + @Getter + @Setter + private String host; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("data") + @Getter + @Setter + private String data; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Boolean valid; + + public AuthenticatedDomainSpfDnsDkim() {} + + private AuthenticatedDomainSpfDnsDkim(Builder builder) { + this.host = builder.host; + this.type = builder.type; + this.data = builder.data; + this.valid = builder.valid; + } + + // Builder class for constructing object + public static class Builder { + + private String host; + private String type; + private String data; + private Boolean valid; + + public Builder(String host, String type, String data, Boolean valid) { + this.host = host; + this.type = type; + this.data = data; + this.valid = valid; + } + + public AuthenticatedDomainSpfDnsDkim build() { + return new AuthenticatedDomainSpfDnsDkim(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AuthenticatedDomainSpfDnsDkim.class.getSimpleName() + "(", + ")" + ); + if (host != null) joiner.add("host=" + host); + if (type != null) joiner.add("type=" + type); + if (data != null) joiner.add("data=" + data); + if (valid != null) joiner.add("valid=" + valid); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpfDnsDomainSpf.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpfDnsDomainSpf.java new file mode 100644 index 00000000..f28a256c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpfDnsDomainSpf.java @@ -0,0 +1,92 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AuthenticatedDomainSpfDnsDomainSpf { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("host") + @Getter + @Setter + private String host; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("data") + @Getter + @Setter + private String data; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Boolean valid; + + public AuthenticatedDomainSpfDnsDomainSpf() {} + + private AuthenticatedDomainSpfDnsDomainSpf(Builder builder) { + this.host = builder.host; + this.type = builder.type; + this.data = builder.data; + this.valid = builder.valid; + } + + // Builder class for constructing object + public static class Builder { + + private String host; + private String type; + private String data; + private Boolean valid; + + public Builder(String host, String type, String data, Boolean valid) { + this.host = host; + this.type = type; + this.data = data; + this.valid = valid; + } + + public AuthenticatedDomainSpfDnsDomainSpf build() { + return new AuthenticatedDomainSpfDnsDomainSpf(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AuthenticatedDomainSpfDnsDomainSpf.class.getSimpleName() + "(", + ")" + ); + if (host != null) joiner.add("host=" + host); + if (type != null) joiner.add("type=" + type); + if (data != null) joiner.add("data=" + data); + if (valid != null) joiner.add("valid=" + valid); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpfDnsMailServer.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpfDnsMailServer.java new file mode 100644 index 00000000..e38dfdc4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpfDnsMailServer.java @@ -0,0 +1,92 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AuthenticatedDomainSpfDnsMailServer { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("host") + @Getter + @Setter + private String host; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("data") + @Getter + @Setter + private String data; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Boolean valid; + + public AuthenticatedDomainSpfDnsMailServer() {} + + private AuthenticatedDomainSpfDnsMailServer(Builder builder) { + this.host = builder.host; + this.type = builder.type; + this.data = builder.data; + this.valid = builder.valid; + } + + // Builder class for constructing object + public static class Builder { + + private String host; + private String type; + private String data; + private Boolean valid; + + public Builder(String host, String type, String data, Boolean valid) { + this.host = host; + this.type = type; + this.data = data; + this.valid = valid; + } + + public AuthenticatedDomainSpfDnsMailServer build() { + return new AuthenticatedDomainSpfDnsMailServer(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AuthenticatedDomainSpfDnsMailServer.class.getSimpleName() + "(", + ")" + ); + if (host != null) joiner.add("host=" + host); + if (type != null) joiner.add("type=" + type); + if (data != null) joiner.add("data=" + data); + if (valid != null) joiner.add("valid=" + valid); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpfDnsSubdomainSpf.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpfDnsSubdomainSpf.java new file mode 100644 index 00000000..01ad41d2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/AuthenticatedDomainSpfDnsSubdomainSpf.java @@ -0,0 +1,92 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AuthenticatedDomainSpfDnsSubdomainSpf { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("host") + @Getter + @Setter + private String host; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("data") + @Getter + @Setter + private String data; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Boolean valid; + + public AuthenticatedDomainSpfDnsSubdomainSpf() {} + + private AuthenticatedDomainSpfDnsSubdomainSpf(Builder builder) { + this.host = builder.host; + this.type = builder.type; + this.data = builder.data; + this.valid = builder.valid; + } + + // Builder class for constructing object + public static class Builder { + + private String host; + private String type; + private String data; + private Boolean valid; + + public Builder(String host, String type, String data, Boolean valid) { + this.host = host; + this.type = type; + this.data = data; + this.valid = valid; + } + + public AuthenticatedDomainSpfDnsSubdomainSpf build() { + return new AuthenticatedDomainSpfDnsSubdomainSpf(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AuthenticatedDomainSpfDnsSubdomainSpf.class.getSimpleName() + "(", + ")" + ); + if (host != null) joiner.add("host=" + host); + if (type != null) joiner.add("type=" + type); + if (data != null) joiner.add("data=" + data); + if (valid != null) joiner.add("valid=" + valid); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/EmailDnsRecord400Response.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/EmailDnsRecord400Response.java new file mode 100644 index 00000000..5d74d24b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/EmailDnsRecord400Response.java @@ -0,0 +1,66 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.domainauthentication.models.EmailDnsRecord400ResponseErrors; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class EmailDnsRecord400Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private EmailDnsRecord400ResponseErrors errors; + + public EmailDnsRecord400Response() {} + + private EmailDnsRecord400Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private EmailDnsRecord400ResponseErrors errors; + + public Builder() {} + + public Builder errors(EmailDnsRecord400ResponseErrors errors) { + this.errors = errors; + return this; + } + + public EmailDnsRecord400Response build() { + return new EmailDnsRecord400Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + EmailDnsRecord400Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/EmailDnsRecord400ResponseErrors.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/EmailDnsRecord400ResponseErrors.java new file mode 100644 index 00000000..27a00564 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/EmailDnsRecord400ResponseErrors.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class EmailDnsRecord400ResponseErrors { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error") + @Getter + @Setter + private String error; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + public EmailDnsRecord400ResponseErrors() {} + + private EmailDnsRecord400ResponseErrors(Builder builder) { + this.error = builder.error; + this.field = builder.field; + } + + // Builder class for constructing object + public static class Builder { + + private String error; + private String field; + + public Builder() {} + + public Builder error(String error) { + this.error = error; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public EmailDnsRecord400ResponseErrors build() { + return new EmailDnsRecord400ResponseErrors(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + EmailDnsRecord400ResponseErrors.class.getSimpleName() + "(", + ")" + ); + if (error != null) joiner.add("error=" + error); + if (field != null) joiner.add("field=" + field); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/EmailDnsRecordRequest.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/EmailDnsRecordRequest.java new file mode 100644 index 00000000..7a5d81bc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/EmailDnsRecordRequest.java @@ -0,0 +1,96 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class EmailDnsRecordRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("link_id") + @Getter + @Setter + private Integer linkId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("domain_id") + @Getter + @Setter + private Integer domainId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public EmailDnsRecordRequest() {} + + private EmailDnsRecordRequest(Builder builder) { + this.linkId = builder.linkId; + this.domainId = builder.domainId; + this.email = builder.email; + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private Integer linkId; + private Integer domainId; + private String email; + private String message; + + public Builder(Integer linkId, Integer domainId, String email) { + this.linkId = linkId; + this.domainId = domainId; + this.email = email; + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public EmailDnsRecordRequest build() { + return new EmailDnsRecordRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + EmailDnsRecordRequest.class.getSimpleName() + "(", + ")" + ); + if (linkId != null) joiner.add("linkId=" + linkId); + if (domainId != null) joiner.add("domainId=" + domainId); + if (email != null) joiner.add("email=" + email); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ListAllAuthenticatedDomainWithUser200ResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ListAllAuthenticatedDomainWithUser200ResponseInner.java new file mode 100644 index 00000000..caa8df85 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ListAllAuthenticatedDomainWithUser200ResponseInner.java @@ -0,0 +1,193 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.domainauthentication.models.ListAllAuthenticatedDomainWithUser200ResponseInnerDns; +import java.math.BigDecimal; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListAllAuthenticatedDomainWithUser200ResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private BigDecimal id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("user_id") + @Getter + @Setter + private BigDecimal userId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subdomain") + @Getter + @Setter + private String subdomain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("domain") + @Getter + @Setter + private String domain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ips") + @Getter + @Setter + private List ips; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_spf") + @Getter + @Setter + private Boolean customSpf; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("default") + @Getter + @Setter + private Boolean _default; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("legacy") + @Getter + @Setter + private Boolean legacy; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("automatic_security") + @Getter + @Setter + private Boolean automaticSecurity; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Boolean valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("dns") + @Getter + @Setter + private ListAllAuthenticatedDomainWithUser200ResponseInnerDns dns; + + public ListAllAuthenticatedDomainWithUser200ResponseInner() {} + + private ListAllAuthenticatedDomainWithUser200ResponseInner( + Builder builder + ) { + this.id = builder.id; + this.userId = builder.userId; + this.subdomain = builder.subdomain; + this.domain = builder.domain; + this.username = builder.username; + this.ips = builder.ips; + this.customSpf = builder.customSpf; + this._default = builder._default; + this.legacy = builder.legacy; + this.automaticSecurity = builder.automaticSecurity; + this.valid = builder.valid; + this.dns = builder.dns; + } + + // Builder class for constructing object + public static class Builder { + + private BigDecimal id; + private BigDecimal userId; + private String subdomain; + private String domain; + private String username; + private List ips; + private Boolean customSpf; + private Boolean _default; + private Boolean legacy; + private Boolean automaticSecurity; + private Boolean valid; + private ListAllAuthenticatedDomainWithUser200ResponseInnerDns dns; + + public Builder( + BigDecimal id, + BigDecimal userId, + String subdomain, + String domain, + String username, + List ips, + Boolean customSpf, + Boolean _default, + Boolean legacy, + Boolean automaticSecurity, + Boolean valid, + ListAllAuthenticatedDomainWithUser200ResponseInnerDns dns + ) { + this.id = id; + this.userId = userId; + this.subdomain = subdomain; + this.domain = domain; + this.username = username; + this.ips = ips; + this.customSpf = customSpf; + this._default = _default; + this.legacy = legacy; + this.automaticSecurity = automaticSecurity; + this.valid = valid; + this.dns = dns; + } + + public ListAllAuthenticatedDomainWithUser200ResponseInner build() { + return new ListAllAuthenticatedDomainWithUser200ResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListAllAuthenticatedDomainWithUser200ResponseInner.class.getSimpleName() + + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (userId != null) joiner.add("userId=" + userId); + if (subdomain != null) joiner.add("subdomain=" + subdomain); + if (domain != null) joiner.add("domain=" + domain); + if (username != null) joiner.add("username=" + username); + if (ips != null) joiner.add("ips=" + ips); + if (customSpf != null) joiner.add("customSpf=" + customSpf); + if (_default != null) joiner.add("_default=" + _default); + if (legacy != null) joiner.add("legacy=" + legacy); + if (automaticSecurity != null) joiner.add( + "automaticSecurity=" + automaticSecurity + ); + if (valid != null) joiner.add("valid=" + valid); + if (dns != null) joiner.add("dns=" + dns); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ListAllAuthenticatedDomainWithUser200ResponseInnerDns.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ListAllAuthenticatedDomainWithUser200ResponseInnerDns.java new file mode 100644 index 00000000..b0fc3f08 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ListAllAuthenticatedDomainWithUser200ResponseInnerDns.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.domainauthentication.models.ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1; +import com.sendgrid.rest.api.v3.domainauthentication.models.ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListAllAuthenticatedDomainWithUser200ResponseInnerDns { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("mail_cname") + @Getter + @Setter + private ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname mailCname; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("dkim1") + @Getter + @Setter + private ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1 dkim1; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("dkim2") + @Getter + @Setter + private ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1 dkim2; + + public ListAllAuthenticatedDomainWithUser200ResponseInnerDns() {} + + private ListAllAuthenticatedDomainWithUser200ResponseInnerDns( + Builder builder + ) { + this.mailCname = builder.mailCname; + this.dkim1 = builder.dkim1; + this.dkim2 = builder.dkim2; + } + + // Builder class for constructing object + public static class Builder { + + private ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname mailCname; + private ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1 dkim1; + private ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1 dkim2; + + public Builder( + ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname mailCname, + ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1 dkim1, + ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1 dkim2 + ) { + this.mailCname = mailCname; + this.dkim1 = dkim1; + this.dkim2 = dkim2; + } + + public ListAllAuthenticatedDomainWithUser200ResponseInnerDns build() { + return new ListAllAuthenticatedDomainWithUser200ResponseInnerDns( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListAllAuthenticatedDomainWithUser200ResponseInnerDns.class.getSimpleName() + + "(", + ")" + ); + if (mailCname != null) joiner.add("mailCname=" + mailCname); + if (dkim1 != null) joiner.add("dkim1=" + dkim1); + if (dkim2 != null) joiner.add("dkim2=" + dkim2); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1.java new file mode 100644 index 00000000..4e69193c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1.java @@ -0,0 +1,97 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Boolean valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("host") + @Getter + @Setter + private String host; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("data") + @Getter + @Setter + private String data; + + public ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1() {} + + private ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1( + Builder builder + ) { + this.valid = builder.valid; + this.type = builder.type; + this.host = builder.host; + this.data = builder.data; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean valid; + private String type; + private String host; + private String data; + + public Builder(Boolean valid, String type, String host, String data) { + this.valid = valid; + this.type = type; + this.host = host; + this.data = data; + } + + public ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1 build() { + return new ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1.class.getSimpleName() + + "(", + ")" + ); + if (valid != null) joiner.add("valid=" + valid); + if (type != null) joiner.add("type=" + type); + if (host != null) joiner.add("host=" + host); + if (data != null) joiner.add("data=" + data); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname.java new file mode 100644 index 00000000..93d2b309 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname.java @@ -0,0 +1,97 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Boolean valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("host") + @Getter + @Setter + private String host; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("data") + @Getter + @Setter + private String data; + + public ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname() {} + + private ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname( + Builder builder + ) { + this.valid = builder.valid; + this.type = builder.type; + this.host = builder.host; + this.data = builder.data; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean valid; + private String type; + private String host; + private String data; + + public Builder(Boolean valid, String type, String host, String data) { + this.valid = valid; + this.type = type; + this.host = host; + this.data = data; + } + + public ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname build() { + return new ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname.class.getSimpleName() + + "(", + ")" + ); + if (valid != null) joiner.add("valid=" + valid); + if (type != null) joiner.add("type=" + type); + if (host != null) joiner.add("host=" + host); + if (data != null) joiner.add("data=" + data); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/UpdateAuthenticatedDomainRequest.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/UpdateAuthenticatedDomainRequest.java new file mode 100644 index 00000000..1792b0a3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/UpdateAuthenticatedDomainRequest.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateAuthenticatedDomainRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("default") + @Getter + @Setter + private Boolean _default; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_spf") + @Getter + @Setter + private Boolean customSpf; + + public UpdateAuthenticatedDomainRequest() {} + + private UpdateAuthenticatedDomainRequest(Builder builder) { + this._default = builder._default; + this.customSpf = builder.customSpf; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean _default; + private Boolean customSpf; + + public Builder() {} + + public Builder _default(Boolean _default) { + this._default = _default; + return this; + } + + public Builder customSpf(Boolean customSpf) { + this.customSpf = customSpf; + return this; + } + + public UpdateAuthenticatedDomainRequest build() { + return new UpdateAuthenticatedDomainRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateAuthenticatedDomainRequest.class.getSimpleName() + "(", + ")" + ); + if (_default != null) joiner.add("_default=" + _default); + if (customSpf != null) joiner.add("customSpf=" + customSpf); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain200Response.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain200Response.java new file mode 100644 index 00000000..204b00e5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain200Response.java @@ -0,0 +1,98 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.domainauthentication.models.ValidateAuthenticatedDomain200ResponseValidationResults; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateAuthenticatedDomain200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Boolean valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("validation_results") + @Getter + @Setter + private ValidateAuthenticatedDomain200ResponseValidationResults validationResults; + + public ValidateAuthenticatedDomain200Response() {} + + private ValidateAuthenticatedDomain200Response(Builder builder) { + this.id = builder.id; + this.valid = builder.valid; + this.validationResults = builder.validationResults; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private Boolean valid; + private ValidateAuthenticatedDomain200ResponseValidationResults validationResults; + + public Builder() {} + + public Builder id(Integer id) { + this.id = id; + return this; + } + + public Builder valid(Boolean valid) { + this.valid = valid; + return this; + } + + public Builder validationResults( + ValidateAuthenticatedDomain200ResponseValidationResults validationResults + ) { + this.validationResults = validationResults; + return this; + } + + public ValidateAuthenticatedDomain200Response build() { + return new ValidateAuthenticatedDomain200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateAuthenticatedDomain200Response.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (valid != null) joiner.add("valid=" + valid); + if (validationResults != null) joiner.add( + "validationResults=" + validationResults + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain200ResponseValidationResults.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain200ResponseValidationResults.java new file mode 100644 index 00000000..4209e1b3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain200ResponseValidationResults.java @@ -0,0 +1,123 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.domainauthentication.models.ValidateAuthenticatedDomain200ResponseValidationResultsDkim1; +import com.sendgrid.rest.api.v3.domainauthentication.models.ValidateAuthenticatedDomain200ResponseValidationResultsMailCname; +import com.sendgrid.rest.api.v3.domainauthentication.models.ValidateAuthenticatedDomain200ResponseValidationResultsSpf; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateAuthenticatedDomain200ResponseValidationResults { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("mail_cname") + @Getter + @Setter + private ValidateAuthenticatedDomain200ResponseValidationResultsMailCname mailCname; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("dkim1") + @Getter + @Setter + private ValidateAuthenticatedDomain200ResponseValidationResultsDkim1 dkim1; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("dkim2") + @Getter + @Setter + private ValidateAuthenticatedDomain200ResponseValidationResultsDkim1 dkim2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spf") + @Getter + @Setter + private ValidateAuthenticatedDomain200ResponseValidationResultsSpf spf; + + public ValidateAuthenticatedDomain200ResponseValidationResults() {} + + private ValidateAuthenticatedDomain200ResponseValidationResults( + Builder builder + ) { + this.mailCname = builder.mailCname; + this.dkim1 = builder.dkim1; + this.dkim2 = builder.dkim2; + this.spf = builder.spf; + } + + // Builder class for constructing object + public static class Builder { + + private ValidateAuthenticatedDomain200ResponseValidationResultsMailCname mailCname; + private ValidateAuthenticatedDomain200ResponseValidationResultsDkim1 dkim1; + private ValidateAuthenticatedDomain200ResponseValidationResultsDkim1 dkim2; + private ValidateAuthenticatedDomain200ResponseValidationResultsSpf spf; + + public Builder() {} + + public Builder mailCname( + ValidateAuthenticatedDomain200ResponseValidationResultsMailCname mailCname + ) { + this.mailCname = mailCname; + return this; + } + + public Builder dkim1( + ValidateAuthenticatedDomain200ResponseValidationResultsDkim1 dkim1 + ) { + this.dkim1 = dkim1; + return this; + } + + public Builder dkim2( + ValidateAuthenticatedDomain200ResponseValidationResultsDkim1 dkim2 + ) { + this.dkim2 = dkim2; + return this; + } + + public Builder spf( + ValidateAuthenticatedDomain200ResponseValidationResultsSpf spf + ) { + this.spf = spf; + return this; + } + + public ValidateAuthenticatedDomain200ResponseValidationResults build() { + return new ValidateAuthenticatedDomain200ResponseValidationResults( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateAuthenticatedDomain200ResponseValidationResults.class.getSimpleName() + + "(", + ")" + ); + if (mailCname != null) joiner.add("mailCname=" + mailCname); + if (dkim1 != null) joiner.add("dkim1=" + dkim1); + if (dkim2 != null) joiner.add("dkim2=" + dkim2); + if (spf != null) joiner.add("spf=" + spf); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain200ResponseValidationResultsDkim1.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain200ResponseValidationResultsDkim1.java new file mode 100644 index 00000000..b97a2843 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain200ResponseValidationResultsDkim1.java @@ -0,0 +1,84 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateAuthenticatedDomain200ResponseValidationResultsDkim1 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Boolean valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reason") + @Getter + @Setter + private String reason; + + public ValidateAuthenticatedDomain200ResponseValidationResultsDkim1() {} + + private ValidateAuthenticatedDomain200ResponseValidationResultsDkim1( + Builder builder + ) { + this.valid = builder.valid; + this.reason = builder.reason; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean valid; + private String reason; + + public Builder() {} + + public Builder valid(Boolean valid) { + this.valid = valid; + return this; + } + + public Builder reason(String reason) { + this.reason = reason; + return this; + } + + public ValidateAuthenticatedDomain200ResponseValidationResultsDkim1 build() { + return new ValidateAuthenticatedDomain200ResponseValidationResultsDkim1( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateAuthenticatedDomain200ResponseValidationResultsDkim1.class.getSimpleName() + + "(", + ")" + ); + if (valid != null) joiner.add("valid=" + valid); + if (reason != null) joiner.add("reason=" + reason); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain200ResponseValidationResultsMailCname.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain200ResponseValidationResultsMailCname.java new file mode 100644 index 00000000..1d26c6c5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain200ResponseValidationResultsMailCname.java @@ -0,0 +1,84 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateAuthenticatedDomain200ResponseValidationResultsMailCname { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Boolean valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reason") + @Getter + @Setter + private String reason; + + public ValidateAuthenticatedDomain200ResponseValidationResultsMailCname() {} + + private ValidateAuthenticatedDomain200ResponseValidationResultsMailCname( + Builder builder + ) { + this.valid = builder.valid; + this.reason = builder.reason; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean valid; + private String reason; + + public Builder() {} + + public Builder valid(Boolean valid) { + this.valid = valid; + return this; + } + + public Builder reason(String reason) { + this.reason = reason; + return this; + } + + public ValidateAuthenticatedDomain200ResponseValidationResultsMailCname build() { + return new ValidateAuthenticatedDomain200ResponseValidationResultsMailCname( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateAuthenticatedDomain200ResponseValidationResultsMailCname.class.getSimpleName() + + "(", + ")" + ); + if (valid != null) joiner.add("valid=" + valid); + if (reason != null) joiner.add("reason=" + reason); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain200ResponseValidationResultsSpf.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain200ResponseValidationResultsSpf.java new file mode 100644 index 00000000..a7ae46b8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain200ResponseValidationResultsSpf.java @@ -0,0 +1,84 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateAuthenticatedDomain200ResponseValidationResultsSpf { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Boolean valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reason") + @Getter + @Setter + private String reason; + + public ValidateAuthenticatedDomain200ResponseValidationResultsSpf() {} + + private ValidateAuthenticatedDomain200ResponseValidationResultsSpf( + Builder builder + ) { + this.valid = builder.valid; + this.reason = builder.reason; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean valid; + private String reason; + + public Builder() {} + + public Builder valid(Boolean valid) { + this.valid = valid; + return this; + } + + public Builder reason(String reason) { + this.reason = reason; + return this; + } + + public ValidateAuthenticatedDomain200ResponseValidationResultsSpf build() { + return new ValidateAuthenticatedDomain200ResponseValidationResultsSpf( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateAuthenticatedDomain200ResponseValidationResultsSpf.class.getSimpleName() + + "(", + ")" + ); + if (valid != null) joiner.add("valid=" + valid); + if (reason != null) joiner.add("reason=" + reason); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain500Response.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain500Response.java new file mode 100644 index 00000000..6e9feb3a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain500Response.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.domainauthentication.models.ValidateAuthenticatedDomain500ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateAuthenticatedDomain500Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ValidateAuthenticatedDomain500Response() {} + + private ValidateAuthenticatedDomain500Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors( + List errors + ) { + this.errors = errors; + return this; + } + + public ValidateAuthenticatedDomain500Response build() { + return new ValidateAuthenticatedDomain500Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateAuthenticatedDomain500Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain500ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain500ResponseErrorsInner.java new file mode 100644 index 00000000..8e10937a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/domainauthentication/models/ValidateAuthenticatedDomain500ResponseErrorsInner.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Domain Authentication API + * The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + * + * 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.domainauthentication.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateAuthenticatedDomain500ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public ValidateAuthenticatedDomain500ResponseErrorsInner() {} + + private ValidateAuthenticatedDomain500ResponseErrorsInner(Builder builder) { + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + + public Builder(String message) { + this.message = message; + } + + public ValidateAuthenticatedDomain500ResponseErrorsInner build() { + return new ValidateAuthenticatedDomain500ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateAuthenticatedDomain500ResponseErrorsInner.class.getSimpleName() + + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/DownloadCsv.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/DownloadCsv.java new file mode 100644 index 00000000..328f4ebf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/DownloadCsv.java @@ -0,0 +1,112 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity; + +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.emailactivity.models.DownloadCsv200Response; +import com.sendgrid.rest.api.v3.emailactivity.models.ListMessage429Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.UUID; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DownloadCsv extends ApiKeyBase { + + private final UUID downloadUuid; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/messages/download/{download_uuid}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DownloadCsv creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ListMessage429Response error = JsonUtil.fromJson( + response.getStream(), + ListMessage429Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ListMessage429Response error = JsonUtil.fromJson( + response.getStream(), + ListMessage429Response.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(), + DownloadCsv200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (downloadUuid != null) { + request.addPathParam("download_uuid", downloadUuid.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/GetMessage.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/GetMessage.java new file mode 100644 index 00000000..8dc063bf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/GetMessage.java @@ -0,0 +1,120 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity; + +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.emailactivity.models.GetMessage404Response; +import com.sendgrid.rest.api.v3.emailactivity.models.ListMessage429Response; +import com.sendgrid.rest.api.v3.emailactivity.models.Message; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class GetMessage extends ApiKeyBase { + + private final String msgId; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/messages/{msg_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetMessage 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")) { + ListMessage429Response error = JsonUtil.fromJson( + response.getStream(), + ListMessage429Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + GetMessage404Response error = JsonUtil.fromJson( + response.getStream(), + GetMessage404Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "429")) { + ListMessage429Response error = JsonUtil.fromJson( + response.getStream(), + ListMessage429Response.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(), Message.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (msgId != null) { + request.addPathParam("msg_id", msgId.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/ListMessage.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/ListMessage.java new file mode 100644 index 00000000..439a76e2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/ListMessage.java @@ -0,0 +1,120 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity; + +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.emailactivity.models.ListMessage200Response; +import com.sendgrid.rest.api.v3.emailactivity.models.ListMessage400Response; +import com.sendgrid.rest.api.v3.emailactivity.models.ListMessage429Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.math.BigDecimal; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListMessage extends ApiKeyBase { + + private final String query; + + @Setter + private BigDecimal limit; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/messages"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListMessage 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")) { + ListMessage400Response error = JsonUtil.fromJson( + response.getStream(), + ListMessage400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "429")) { + ListMessage429Response error = JsonUtil.fromJson( + response.getStream(), + ListMessage429Response.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(), + ListMessage200Response.class + ), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (query != null) { + request.addQueryParam("query", query.toString()); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/RequestCsv.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/RequestCsv.java new file mode 100644 index 00000000..76331ad7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/RequestCsv.java @@ -0,0 +1,126 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity; + +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.emailactivity.models.ListMessage429Response; +import com.sendgrid.rest.api.v3.emailactivity.models.RequestCsv202Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class RequestCsv extends ApiKeyBase { + + @Setter + private String query; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/messages/download"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "RequestCsv 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")) { + ListMessage429Response error = JsonUtil.fromJson( + response.getStream(), + ListMessage429Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "429")) { + ListMessage429Response error = JsonUtil.fromJson( + response.getStream(), + ListMessage429Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ListMessage429Response error = JsonUtil.fromJson( + response.getStream(), + ListMessage429Response.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(), + RequestCsv202Response.class + ), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (query != null) { + request.addQueryParam("query", query.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/AbbvMessage.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/AbbvMessage.java new file mode 100644 index 00000000..2b020a47 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/AbbvMessage.java @@ -0,0 +1,142 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailactivity.models.Status; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AbbvMessage { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("from_email") + @Getter + @Setter + private String fromEmail; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("msg_id") + @Getter + @Setter + private String msgId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subject") + @Getter + @Setter + private String subject; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("to_email") + @Getter + @Setter + private String toEmail; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private Status status; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("opens_count") + @Getter + @Setter + private Integer opensCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("clicks_count") + @Getter + @Setter + private Integer clicksCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_event_time") + @Getter + @Setter + private String lastEventTime; + + public AbbvMessage() {} + + private AbbvMessage(Builder builder) { + this.fromEmail = builder.fromEmail; + this.msgId = builder.msgId; + this.subject = builder.subject; + this.toEmail = builder.toEmail; + this.status = builder.status; + this.opensCount = builder.opensCount; + this.clicksCount = builder.clicksCount; + this.lastEventTime = builder.lastEventTime; + } + + // Builder class for constructing object + public static class Builder { + + private String fromEmail; + private String msgId; + private String subject; + private String toEmail; + private Status status; + private Integer opensCount; + private Integer clicksCount; + private String lastEventTime; + + public Builder( + String fromEmail, + String msgId, + String subject, + String toEmail, + Status status, + Integer opensCount, + Integer clicksCount, + String lastEventTime + ) { + this.fromEmail = fromEmail; + this.msgId = msgId; + this.subject = subject; + this.toEmail = toEmail; + this.status = status; + this.opensCount = opensCount; + this.clicksCount = clicksCount; + this.lastEventTime = lastEventTime; + } + + public AbbvMessage build() { + return new AbbvMessage(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AbbvMessage.class.getSimpleName() + "(", + ")" + ); + if (fromEmail != null) joiner.add("fromEmail=" + fromEmail); + if (msgId != null) joiner.add("msgId=" + msgId); + if (subject != null) joiner.add("subject=" + subject); + if (toEmail != null) joiner.add("toEmail=" + toEmail); + if (status != null) joiner.add("status=" + status); + if (opensCount != null) joiner.add("opensCount=" + opensCount); + if (clicksCount != null) joiner.add("clicksCount=" + clicksCount); + if (lastEventTime != null) joiner.add("lastEventTime=" + lastEventTime); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/BounceType.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/BounceType.java new file mode 100644 index 00000000..fcc65725 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/BounceType.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum BounceType { + SOFT("soft"), + + HARD("hard"); + + private final String value; + + private BounceType(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static BounceType forValue(final String value) { + return Promoter.enumFromString(value, BounceType.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/BounceType1.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/BounceType1.java new file mode 100644 index 00000000..975f5ebe --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/BounceType1.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum BounceType1 { + SOFT("soft"), + + HARD("hard"); + + private final String value; + + private BounceType1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static BounceType1 forValue(final String value) { + return Promoter.enumFromString(value, BounceType1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/DownloadCsv200Response.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/DownloadCsv200Response.java new file mode 100644 index 00000000..32349f0b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/DownloadCsv200Response.java @@ -0,0 +1,77 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.net.URI; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DownloadCsv200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("presigned_url") + @Getter + @Setter + private URI presignedUrl; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("csv") + @Getter + @Setter + private String csv; + + public DownloadCsv200Response() {} + + private DownloadCsv200Response(Builder builder) { + this.presignedUrl = builder.presignedUrl; + this.csv = builder.csv; + } + + // Builder class for constructing object + public static class Builder { + + private URI presignedUrl; + private String csv; + + public Builder(String csv) { + this.csv = csv; + } + + public Builder presignedUrl(URI presignedUrl) { + this.presignedUrl = presignedUrl; + return this; + } + + public DownloadCsv200Response build() { + return new DownloadCsv200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DownloadCsv200Response.class.getSimpleName() + "(", + ")" + ); + if (presignedUrl != null) joiner.add("presignedUrl=" + presignedUrl); + if (csv != null) joiner.add("csv=" + csv); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/EmailActivityResponseBaseProps.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/EmailActivityResponseBaseProps.java new file mode 100644 index 00000000..9ac24ac5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/EmailActivityResponseBaseProps.java @@ -0,0 +1,122 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailactivity.models.Status3; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class EmailActivityResponseBaseProps { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("from_email") + @Getter + @Setter + private String fromEmail; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("msg_id") + @Getter + @Setter + private String msgId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subject") + @Getter + @Setter + private String subject; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("to_email") + @Getter + @Setter + private String toEmail; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private Status3 status; + + public EmailActivityResponseBaseProps() {} + + private EmailActivityResponseBaseProps(Builder builder) { + this.fromEmail = builder.fromEmail; + this.msgId = builder.msgId; + this.subject = builder.subject; + this.toEmail = builder.toEmail; + this.status = builder.status; + } + + // Builder class for constructing object + public static class Builder { + + private String fromEmail; + private String msgId; + private String subject; + private String toEmail; + private Status3 status; + + public Builder() {} + + public Builder fromEmail(String fromEmail) { + this.fromEmail = fromEmail; + return this; + } + + public Builder msgId(String msgId) { + this.msgId = msgId; + return this; + } + + public Builder subject(String subject) { + this.subject = subject; + return this; + } + + public Builder toEmail(String toEmail) { + this.toEmail = toEmail; + return this; + } + + public Builder status(Status3 status) { + this.status = status; + return this; + } + + public EmailActivityResponseBaseProps build() { + return new EmailActivityResponseBaseProps(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + EmailActivityResponseBaseProps.class.getSimpleName() + "(", + ")" + ); + if (fromEmail != null) joiner.add("fromEmail=" + fromEmail); + if (msgId != null) joiner.add("msgId=" + msgId); + if (subject != null) joiner.add("subject=" + subject); + if (toEmail != null) joiner.add("toEmail=" + toEmail); + if (status != null) joiner.add("status=" + status); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Event.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Event.java new file mode 100644 index 00000000..20d65bd2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Event.java @@ -0,0 +1,152 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailactivity.models.BounceType; +import com.sendgrid.rest.api.v3.emailactivity.models.EventName; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Event { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("event_name") + @Getter + @Setter + private EventName eventName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("processed") + @Getter + @Setter + private String processed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reason") + @Getter + @Setter + private String reason; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("attempt_num") + @Getter + @Setter + private Integer attemptNum; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("url") + @Getter + @Setter + private String url; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounce_type") + @Getter + @Setter + private BounceType bounceType; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("http_user_agent") + @Getter + @Setter + private String httpUserAgent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("mx_server") + @Getter + @Setter + private String mxServer; + + public Event() {} + + private Event(Builder builder) { + this.eventName = builder.eventName; + this.processed = builder.processed; + this.reason = builder.reason; + this.attemptNum = builder.attemptNum; + this.url = builder.url; + this.bounceType = builder.bounceType; + this.httpUserAgent = builder.httpUserAgent; + this.mxServer = builder.mxServer; + } + + // Builder class for constructing object + public static class Builder { + + private EventName eventName; + private String processed; + private String reason; + private Integer attemptNum; + private String url; + private BounceType bounceType; + private String httpUserAgent; + private String mxServer; + + public Builder( + EventName eventName, + String processed, + BounceType bounceType, + String httpUserAgent, + String mxServer + ) { + this.eventName = eventName; + this.processed = processed; + this.bounceType = bounceType; + this.httpUserAgent = httpUserAgent; + this.mxServer = mxServer; + } + + public Builder reason(String reason) { + this.reason = reason; + return this; + } + + public Builder attemptNum(Integer attemptNum) { + this.attemptNum = attemptNum; + return this; + } + + public Builder url(String url) { + this.url = url; + return this; + } + + public Event build() { + return new Event(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Event.class.getSimpleName() + "(", + ")" + ); + if (eventName != null) joiner.add("eventName=" + eventName); + if (processed != null) joiner.add("processed=" + processed); + if (reason != null) joiner.add("reason=" + reason); + if (attemptNum != null) joiner.add("attemptNum=" + attemptNum); + if (url != null) joiner.add("url=" + url); + if (bounceType != null) joiner.add("bounceType=" + bounceType); + if (httpUserAgent != null) joiner.add("httpUserAgent=" + httpUserAgent); + if (mxServer != null) joiner.add("mxServer=" + mxServer); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/EventName.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/EventName.java new file mode 100644 index 00000000..12c6e8e2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/EventName.java @@ -0,0 +1,60 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum EventName { + BOUNCED("bounced"), + + OPENED("opened"), + + CLICKED("clicked"), + + PROCESSED("processed"), + + DROPPED("dropped"), + + DELIVERED("delivered"), + + DEFERRED("deferred"), + + SPAM_REPORT("spam_report"), + + UNSUBSCRIBE("unsubscribe"), + + GROUP_UNSUBSCRIBE("group_unsubscribe"), + + GROUP_RESUBSCRIBE("group_resubscribe"); + + private final String value; + + private EventName(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static EventName forValue(final String value) { + return Promoter.enumFromString(value, EventName.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/EventName1.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/EventName1.java new file mode 100644 index 00000000..8c948af2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/EventName1.java @@ -0,0 +1,60 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum EventName1 { + BOUNCED("bounced"), + + OPENED("opened"), + + CLICKED("clicked"), + + PROCESSED("processed"), + + DROPPED("dropped"), + + DELIVERED("delivered"), + + DEFERRED("deferred"), + + SPAM_REPORT("spam_report"), + + UNSUBSCRIBE("unsubscribe"), + + GROUP_UNSUBSCRIBE("group_unsubscribe"), + + GROUP_RESUBSCRIBE("group_resubscribe"); + + private final String value; + + private EventName1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static EventName1 forValue(final String value) { + return Promoter.enumFromString(value, EventName1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/GetMessage404Response.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/GetMessage404Response.java new file mode 100644 index 00000000..262805f9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/GetMessage404Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailactivity.models.GetMessage404ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetMessage404Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public GetMessage404Response() {} + + private GetMessage404Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public GetMessage404Response build() { + return new GetMessage404Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetMessage404Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/GetMessage404ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/GetMessage404ResponseErrorsInner.java new file mode 100644 index 00000000..54260067 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/GetMessage404ResponseErrorsInner.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetMessage404ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + public GetMessage404ResponseErrorsInner() {} + + private GetMessage404ResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public GetMessage404ResponseErrorsInner build() { + return new GetMessage404ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetMessage404ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/ListMessage200Response.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/ListMessage200Response.java new file mode 100644 index 00000000..6cb54cb3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/ListMessage200Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailactivity.models.AbbvMessage; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListMessage200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("messages") + @Getter + @Setter + private List messages; + + public ListMessage200Response() {} + + private ListMessage200Response(Builder builder) { + this.messages = builder.messages; + } + + // Builder class for constructing object + public static class Builder { + + private List messages; + + public Builder() {} + + public Builder messages(List messages) { + this.messages = messages; + return this; + } + + public ListMessage200Response build() { + return new ListMessage200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListMessage200Response.class.getSimpleName() + "(", + ")" + ); + if (messages != null) joiner.add("messages=" + messages); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/ListMessage400Response.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/ListMessage400Response.java new file mode 100644 index 00000000..da6bcc43 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/ListMessage400Response.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailactivity.models.ListMessage400ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListMessage400Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ListMessage400Response() {} + + private ListMessage400Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder(List errors) { + this.errors = errors; + } + + public ListMessage400Response build() { + return new ListMessage400Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListMessage400Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/ListMessage400ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/ListMessage400ResponseErrorsInner.java new file mode 100644 index 00000000..161e0cbc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/ListMessage400ResponseErrorsInner.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListMessage400ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public ListMessage400ResponseErrorsInner() {} + + private ListMessage400ResponseErrorsInner(Builder builder) { + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + + public Builder(String message) { + this.message = message; + } + + public ListMessage400ResponseErrorsInner build() { + return new ListMessage400ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListMessage400ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/ListMessage429Response.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/ListMessage429Response.java new file mode 100644 index 00000000..b3272117 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/ListMessage429Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailactivity.models.ListMessage429ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListMessage429Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ListMessage429Response() {} + + private ListMessage429Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public ListMessage429Response build() { + return new ListMessage429Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListMessage429Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/ListMessage429ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/ListMessage429ResponseErrorsInner.java new file mode 100644 index 00000000..d3f08a1e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/ListMessage429ResponseErrorsInner.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListMessage429ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public ListMessage429ResponseErrorsInner() {} + + private ListMessage429ResponseErrorsInner(Builder builder) { + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public ListMessage429ResponseErrorsInner build() { + return new ListMessage429ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListMessage429ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Message.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Message.java new file mode 100644 index 00000000..b4b2b762 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Message.java @@ -0,0 +1,239 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailactivity.models.Event; +import com.sendgrid.rest.api.v3.emailactivity.models.OutboundIpType; +import com.sendgrid.rest.api.v3.emailactivity.models.Status3; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Message { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("from_email") + @Getter + @Setter + private String fromEmail; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("msg_id") + @Getter + @Setter + private String msgId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subject") + @Getter + @Setter + private String subject; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("to_email") + @Getter + @Setter + private String toEmail; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private Status3 status; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("template_id") + @Getter + @Setter + private String templateId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("asm_group_id") + @Getter + @Setter + private Integer asmGroupId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("teammate") + @Getter + @Setter + private String teammate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("api_key_id") + @Getter + @Setter + private String apiKeyId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("events") + @Getter + @Setter + private List events; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("originating_ip") + @Getter + @Setter + private String originatingIp; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("categories") + @Getter + @Setter + private List categories; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unique_args") + @Getter + @Setter + private String uniqueArgs; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("outbound_ip") + @Getter + @Setter + private String outboundIp; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("outbound_ip_type") + @Getter + @Setter + private OutboundIpType outboundIpType; + + public Message() {} + + private Message(Builder builder) { + this.fromEmail = builder.fromEmail; + this.msgId = builder.msgId; + this.subject = builder.subject; + this.toEmail = builder.toEmail; + this.status = builder.status; + this.templateId = builder.templateId; + this.asmGroupId = builder.asmGroupId; + this.teammate = builder.teammate; + this.apiKeyId = builder.apiKeyId; + this.events = builder.events; + this.originatingIp = builder.originatingIp; + this.categories = builder.categories; + this.uniqueArgs = builder.uniqueArgs; + this.outboundIp = builder.outboundIp; + this.outboundIpType = builder.outboundIpType; + } + + // Builder class for constructing object + public static class Builder { + + private String fromEmail; + private String msgId; + private String subject; + private String toEmail; + private Status3 status; + private String templateId; + private Integer asmGroupId; + private String teammate; + private String apiKeyId; + private List events; + private String originatingIp; + private List categories; + private String uniqueArgs; + private String outboundIp; + private OutboundIpType outboundIpType; + + public Builder( + String templateId, + Integer asmGroupId, + String teammate, + String apiKeyId, + List events, + String originatingIp, + List categories, + String uniqueArgs, + String outboundIp, + OutboundIpType outboundIpType + ) { + this.templateId = templateId; + this.asmGroupId = asmGroupId; + this.teammate = teammate; + this.apiKeyId = apiKeyId; + this.events = events; + this.originatingIp = originatingIp; + this.categories = categories; + this.uniqueArgs = uniqueArgs; + this.outboundIp = outboundIp; + this.outboundIpType = outboundIpType; + } + + public Builder fromEmail(String fromEmail) { + this.fromEmail = fromEmail; + return this; + } + + public Builder msgId(String msgId) { + this.msgId = msgId; + return this; + } + + public Builder subject(String subject) { + this.subject = subject; + return this; + } + + public Builder toEmail(String toEmail) { + this.toEmail = toEmail; + return this; + } + + public Builder status(Status3 status) { + this.status = status; + return this; + } + + public Message build() { + return new Message(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Message.class.getSimpleName() + "(", + ")" + ); + if (fromEmail != null) joiner.add("fromEmail=" + fromEmail); + if (msgId != null) joiner.add("msgId=" + msgId); + if (subject != null) joiner.add("subject=" + subject); + if (toEmail != null) joiner.add("toEmail=" + toEmail); + if (status != null) joiner.add("status=" + status); + if (templateId != null) joiner.add("templateId=" + templateId); + if (asmGroupId != null) joiner.add("asmGroupId=" + asmGroupId); + if (teammate != null) joiner.add("teammate=" + teammate); + if (apiKeyId != null) joiner.add("apiKeyId=" + apiKeyId); + if (events != null) joiner.add("events=" + events); + if (originatingIp != null) joiner.add("originatingIp=" + originatingIp); + if (categories != null) joiner.add("categories=" + categories); + if (uniqueArgs != null) joiner.add("uniqueArgs=" + uniqueArgs); + if (outboundIp != null) joiner.add("outboundIp=" + outboundIp); + if (outboundIpType != null) joiner.add( + "outboundIpType=" + outboundIpType + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/OutboundIpType.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/OutboundIpType.java new file mode 100644 index 00000000..842d505a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/OutboundIpType.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum OutboundIpType { + DEDICATED("dedicated"), + + SHARED("shared"); + + private final String value; + + private OutboundIpType(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static OutboundIpType forValue(final String value) { + return Promoter.enumFromString(value, OutboundIpType.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/OutboundIpType1.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/OutboundIpType1.java new file mode 100644 index 00000000..8699c75c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/OutboundIpType1.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum OutboundIpType1 { + DEDICATED("dedicated"), + + SHARED("shared"); + + private final String value; + + private OutboundIpType1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static OutboundIpType1 forValue(final String value) { + return Promoter.enumFromString(value, OutboundIpType1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/RequestCsv202Response.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/RequestCsv202Response.java new file mode 100644 index 00000000..b0b247f5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/RequestCsv202Response.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailactivity.models.Status2; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class RequestCsv202Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private Status2 status; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public RequestCsv202Response() {} + + private RequestCsv202Response(Builder builder) { + this.status = builder.status; + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private Status2 status; + private String message; + + public Builder() {} + + public Builder status(Status2 status) { + this.status = status; + return this; + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public RequestCsv202Response build() { + return new RequestCsv202Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + RequestCsv202Response.class.getSimpleName() + "(", + ")" + ); + if (status != null) joiner.add("status=" + status); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Status.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Status.java new file mode 100644 index 00000000..6a2300eb --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Status.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Status { + PROCESSED("processed"), + + DELIVERED("delivered"), + + NOT_DELIVERED("not_delivered"); + + private final String value; + + private Status(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Status forValue(final String value) { + return Promoter.enumFromString(value, Status.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Status1.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Status1.java new file mode 100644 index 00000000..244f3b94 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Status1.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Status1 { + PROCESSED("processed"), + + NOT_DELIVERED("not_delivered"), + + DELIVERED("delivered"); + + private final String value; + + private Status1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Status1 forValue(final String value) { + return Promoter.enumFromString(value, Status1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Status2.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Status2.java new file mode 100644 index 00000000..758eb463 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Status2.java @@ -0,0 +1,40 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Status2 { + PENDING("pending"); + + private final String value; + + private Status2(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Status2 forValue(final String value) { + return Promoter.enumFromString(value, Status2.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Status3.java b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Status3.java new file mode 100644 index 00000000..e8b245b9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailactivity/models/Status3.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Activity API + * The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + * + * 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.emailactivity.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Status3 { + PROCESSED("processed"), + + DELIVERED("delivered"), + + NOT_DELIVERED("not_delivered"); + + private final String value; + + private Status3(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Status3 forValue(final String value) { + return Promoter.enumFromString(value, Status3.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/GetEmailJobForVerification.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/GetEmailJobForVerification.java new file mode 100644 index 00000000..960a7a07 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/GetEmailJobForVerification.java @@ -0,0 +1,111 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation; + +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.emailvalidation.models.ErrorResponse; +import com.sendgrid.rest.api.v3.emailvalidation.models.GetValidationsEmailJobsJobId200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class GetEmailJobForVerification extends ApiKeyBase { + + private final String jobId; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/validations/email/jobs/{job_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetEmailJobForVerification creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + GetValidationsEmailJobsJobId200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (jobId != null) { + request.addPathParam("job_id", jobId.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/GetValidationsEmailJobs.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/GetValidationsEmailJobs.java new file mode 100644 index 00000000..b6ca5992 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/GetValidationsEmailJobs.java @@ -0,0 +1,102 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation; + +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.emailvalidation.models.ErrorResponse; +import com.sendgrid.rest.api.v3.emailvalidation.models.GetValidationsEmailJobs200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class GetValidationsEmailJobs extends ApiKeyBase { + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/validations/email/jobs"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetValidationsEmailJobs creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + GetValidationsEmailJobs200Response.class + ), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/ListEmailJobForVerification.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/ListEmailJobForVerification.java new file mode 100644 index 00000000..2f02a6a9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/ListEmailJobForVerification.java @@ -0,0 +1,116 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation; + +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.emailvalidation.models.ErrorResponse; +import com.sendgrid.rest.api.v3.emailvalidation.models.ListEmailJobForVerificationRequest; +import com.sendgrid.rest.api.v3.emailvalidation.models.PutValidationsEmailJobs200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListEmailJobForVerification extends ApiKeyBase { + + @Setter + private ListEmailJobForVerificationRequest listEmailJobForVerificationRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/validations/email/jobs"; + Request request = new Request( + HttpMethod.PUT, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListEmailJobForVerification 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + PutValidationsEmailJobs200Response.class + ), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (listEmailJobForVerificationRequest != null) { + request.addBody( + JsonUtil.toJson(listEmailJobForVerificationRequest) + ); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/ValidateEmail.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/ValidateEmail.java new file mode 100644 index 00000000..0be46047 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/ValidateEmail.java @@ -0,0 +1,86 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation; + +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.emailvalidation.models.ValidateEmail200Response; +import com.sendgrid.rest.api.v3.emailvalidation.models.ValidateEmailRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ValidateEmail extends ApiKeyBase { + + @Setter + private ValidateEmailRequest validateEmailRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/validations/email"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ValidateEmail creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + ValidateEmail200Response.class + ), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (validateEmailRequest != null) { + request.addBody(JsonUtil.toJson(validateEmailRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ErrorResponse.java new file mode 100644 index 00000000..682b36b2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailvalidation.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..b18b90f0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ErrorResponseErrorsInner.java @@ -0,0 +1,90 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder(String message) { + this.message = message; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/FileType.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/FileType.java new file mode 100644 index 00000000..b8d88009 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/FileType.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum FileType { + CSV("csv"), + + ZIP("zip"); + + private final String value; + + private FileType(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static FileType forValue(final String value) { + return Promoter.enumFromString(value, FileType.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/GetValidationsEmailJobs200Response.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/GetValidationsEmailJobs200Response.java new file mode 100644 index 00000000..8c5cdefc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/GetValidationsEmailJobs200Response.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailvalidation.models.GetValidationsEmailJobs200ResponseResultInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetValidationsEmailJobs200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + public GetValidationsEmailJobs200Response() {} + + private GetValidationsEmailJobs200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + + public Builder() {} + + public Builder result( + List result + ) { + this.result = result; + return this; + } + + public GetValidationsEmailJobs200Response build() { + return new GetValidationsEmailJobs200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetValidationsEmailJobs200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/GetValidationsEmailJobs200ResponseResultInner.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/GetValidationsEmailJobs200ResponseResultInner.java new file mode 100644 index 00000000..ab88d35a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/GetValidationsEmailJobs200ResponseResultInner.java @@ -0,0 +1,110 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailvalidation.models.Status; +import java.math.BigDecimal; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetValidationsEmailJobs200ResponseResultInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private Status status; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("started_at") + @Getter + @Setter + private BigDecimal startedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("finished_at") + @Getter + @Setter + private BigDecimal finishedAt; + + public GetValidationsEmailJobs200ResponseResultInner() {} + + private GetValidationsEmailJobs200ResponseResultInner(Builder builder) { + this.id = builder.id; + this.status = builder.status; + this.startedAt = builder.startedAt; + this.finishedAt = builder.finishedAt; + } + + // Builder class for constructing object + public static class Builder { + + private String id; + private Status status; + private BigDecimal startedAt; + private BigDecimal finishedAt; + + public Builder() {} + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder status(Status status) { + this.status = status; + return this; + } + + public Builder startedAt(BigDecimal startedAt) { + this.startedAt = startedAt; + return this; + } + + public Builder finishedAt(BigDecimal finishedAt) { + this.finishedAt = finishedAt; + return this; + } + + public GetValidationsEmailJobs200ResponseResultInner build() { + return new GetValidationsEmailJobs200ResponseResultInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetValidationsEmailJobs200ResponseResultInner.class.getSimpleName() + + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (status != null) joiner.add("status=" + status); + if (startedAt != null) joiner.add("startedAt=" + startedAt); + if (finishedAt != null) joiner.add("finishedAt=" + finishedAt); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/GetValidationsEmailJobsJobId200Response.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/GetValidationsEmailJobsJobId200Response.java new file mode 100644 index 00000000..3887b2f9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/GetValidationsEmailJobsJobId200Response.java @@ -0,0 +1,68 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailvalidation.models.GetValidationsEmailJobsJobId200ResponseResult; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetValidationsEmailJobsJobId200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private GetValidationsEmailJobsJobId200ResponseResult result; + + public GetValidationsEmailJobsJobId200Response() {} + + private GetValidationsEmailJobsJobId200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private GetValidationsEmailJobsJobId200ResponseResult result; + + public Builder() {} + + public Builder result( + GetValidationsEmailJobsJobId200ResponseResult result + ) { + this.result = result; + return this; + } + + public GetValidationsEmailJobsJobId200Response build() { + return new GetValidationsEmailJobsJobId200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetValidationsEmailJobsJobId200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/GetValidationsEmailJobsJobId200ResponseResult.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/GetValidationsEmailJobsJobId200ResponseResult.java new file mode 100644 index 00000000..05c76541 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/GetValidationsEmailJobsJobId200ResponseResult.java @@ -0,0 +1,180 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailvalidation.models.GetValidationsEmailJobsJobId200ResponseResultErrorsInner; +import com.sendgrid.rest.api.v3.emailvalidation.models.Status1; +import java.math.BigDecimal; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetValidationsEmailJobsJobId200ResponseResult { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private Status1 status; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("segments") + @Getter + @Setter + private BigDecimal segments; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("segments_processed") + @Getter + @Setter + private BigDecimal segmentsProcessed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_download_available") + @Getter + @Setter + private Boolean isDownloadAvailable; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("started_at") + @Getter + @Setter + private BigDecimal startedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("finished_at") + @Getter + @Setter + private BigDecimal finishedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List< + GetValidationsEmailJobsJobId200ResponseResultErrorsInner + > errors; + + public GetValidationsEmailJobsJobId200ResponseResult() {} + + private GetValidationsEmailJobsJobId200ResponseResult(Builder builder) { + this.id = builder.id; + this.status = builder.status; + this.segments = builder.segments; + this.segmentsProcessed = builder.segmentsProcessed; + this.isDownloadAvailable = builder.isDownloadAvailable; + this.startedAt = builder.startedAt; + this.finishedAt = builder.finishedAt; + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private String id; + private Status1 status; + private BigDecimal segments; + private BigDecimal segmentsProcessed; + private Boolean isDownloadAvailable; + private BigDecimal startedAt; + private BigDecimal finishedAt; + private List< + GetValidationsEmailJobsJobId200ResponseResultErrorsInner + > errors; + + public Builder() {} + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder status(Status1 status) { + this.status = status; + return this; + } + + public Builder segments(BigDecimal segments) { + this.segments = segments; + return this; + } + + public Builder segmentsProcessed(BigDecimal segmentsProcessed) { + this.segmentsProcessed = segmentsProcessed; + return this; + } + + public Builder isDownloadAvailable(Boolean isDownloadAvailable) { + this.isDownloadAvailable = isDownloadAvailable; + return this; + } + + public Builder startedAt(BigDecimal startedAt) { + this.startedAt = startedAt; + return this; + } + + public Builder finishedAt(BigDecimal finishedAt) { + this.finishedAt = finishedAt; + return this; + } + + public Builder errors( + List< + GetValidationsEmailJobsJobId200ResponseResultErrorsInner + > errors + ) { + this.errors = errors; + return this; + } + + public GetValidationsEmailJobsJobId200ResponseResult build() { + return new GetValidationsEmailJobsJobId200ResponseResult(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetValidationsEmailJobsJobId200ResponseResult.class.getSimpleName() + + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (status != null) joiner.add("status=" + status); + if (segments != null) joiner.add("segments=" + segments); + if (segmentsProcessed != null) joiner.add( + "segmentsProcessed=" + segmentsProcessed + ); + if (isDownloadAvailable != null) joiner.add( + "isDownloadAvailable=" + isDownloadAvailable + ); + if (startedAt != null) joiner.add("startedAt=" + startedAt); + if (finishedAt != null) joiner.add("finishedAt=" + finishedAt); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/GetValidationsEmailJobsJobId200ResponseResultErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/GetValidationsEmailJobsJobId200ResponseResultErrorsInner.java new file mode 100644 index 00000000..f3c75543 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/GetValidationsEmailJobsJobId200ResponseResultErrorsInner.java @@ -0,0 +1,70 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetValidationsEmailJobsJobId200ResponseResultErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public GetValidationsEmailJobsJobId200ResponseResultErrorsInner() {} + + private GetValidationsEmailJobsJobId200ResponseResultErrorsInner( + Builder builder + ) { + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public GetValidationsEmailJobsJobId200ResponseResultErrorsInner build() { + return new GetValidationsEmailJobsJobId200ResponseResultErrorsInner( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetValidationsEmailJobsJobId200ResponseResultErrorsInner.class.getSimpleName() + + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ListEmailJobForVerificationRequest.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ListEmailJobForVerificationRequest.java new file mode 100644 index 00000000..2eae17d5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ListEmailJobForVerificationRequest.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailvalidation.models.FileType; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListEmailJobForVerificationRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("file_type") + @Getter + @Setter + private FileType fileType; + + public ListEmailJobForVerificationRequest() {} + + private ListEmailJobForVerificationRequest(Builder builder) { + this.fileType = builder.fileType; + } + + // Builder class for constructing object + public static class Builder { + + private FileType fileType; + + public Builder(FileType fileType) { + this.fileType = fileType; + } + + public ListEmailJobForVerificationRequest build() { + return new ListEmailJobForVerificationRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListEmailJobForVerificationRequest.class.getSimpleName() + "(", + ")" + ); + if (fileType != null) joiner.add("fileType=" + fileType); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/PutValidationsEmailJobs200Response.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/PutValidationsEmailJobs200Response.java new file mode 100644 index 00000000..caba70c5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/PutValidationsEmailJobs200Response.java @@ -0,0 +1,103 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailvalidation.models.PutValidationsEmailJobs200ResponseUploadHeadersInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class PutValidationsEmailJobs200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("job_id") + @Getter + @Setter + private String jobId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("upload_uri") + @Getter + @Setter + private String uploadUri; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("upload_headers") + @Getter + @Setter + private List< + PutValidationsEmailJobs200ResponseUploadHeadersInner + > uploadHeaders; + + public PutValidationsEmailJobs200Response() {} + + private PutValidationsEmailJobs200Response(Builder builder) { + this.jobId = builder.jobId; + this.uploadUri = builder.uploadUri; + this.uploadHeaders = builder.uploadHeaders; + } + + // Builder class for constructing object + public static class Builder { + + private String jobId; + private String uploadUri; + private List< + PutValidationsEmailJobs200ResponseUploadHeadersInner + > uploadHeaders; + + public Builder() {} + + public Builder jobId(String jobId) { + this.jobId = jobId; + return this; + } + + public Builder uploadUri(String uploadUri) { + this.uploadUri = uploadUri; + return this; + } + + public Builder uploadHeaders( + List< + PutValidationsEmailJobs200ResponseUploadHeadersInner + > uploadHeaders + ) { + this.uploadHeaders = uploadHeaders; + return this; + } + + public PutValidationsEmailJobs200Response build() { + return new PutValidationsEmailJobs200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + PutValidationsEmailJobs200Response.class.getSimpleName() + "(", + ")" + ); + if (jobId != null) joiner.add("jobId=" + jobId); + if (uploadUri != null) joiner.add("uploadUri=" + uploadUri); + if (uploadHeaders != null) joiner.add("uploadHeaders=" + uploadHeaders); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/PutValidationsEmailJobs200ResponseUploadHeadersInner.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/PutValidationsEmailJobs200ResponseUploadHeadersInner.java new file mode 100644 index 00000000..d4240252 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/PutValidationsEmailJobs200ResponseUploadHeadersInner.java @@ -0,0 +1,84 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class PutValidationsEmailJobs200ResponseUploadHeadersInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("header") + @Getter + @Setter + private String header; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("value") + @Getter + @Setter + private String value; + + public PutValidationsEmailJobs200ResponseUploadHeadersInner() {} + + private PutValidationsEmailJobs200ResponseUploadHeadersInner( + Builder builder + ) { + this.header = builder.header; + this.value = builder.value; + } + + // Builder class for constructing object + public static class Builder { + + private String header; + private String value; + + public Builder() {} + + public Builder header(String header) { + this.header = header; + return this; + } + + public Builder value(String value) { + this.value = value; + return this; + } + + public PutValidationsEmailJobs200ResponseUploadHeadersInner build() { + return new PutValidationsEmailJobs200ResponseUploadHeadersInner( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + PutValidationsEmailJobs200ResponseUploadHeadersInner.class.getSimpleName() + + "(", + ")" + ); + if (header != null) joiner.add("header=" + header); + if (value != null) joiner.add("value=" + value); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/Status.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/Status.java new file mode 100644 index 00000000..43ea5e23 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/Status.java @@ -0,0 +1,50 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Status { + INITIATED("Initiated"), + + QUEUED("Queued"), + + READY("Ready"), + + PROCESSING("Processing"), + + DONE("Done"), + + ERROR("Error"); + + private final String value; + + private Status(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Status forValue(final String value) { + return Promoter.enumFromString(value, Status.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/Status1.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/Status1.java new file mode 100644 index 00000000..6a41a1bf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/Status1.java @@ -0,0 +1,50 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Status1 { + INITIATED("Initiated"), + + QUEUED("Queued"), + + READY("Ready"), + + PROCESSING("Processing"), + + DONE("Done"), + + ERROR("Error"); + + private final String value; + + private Status1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Status1 forValue(final String value) { + return Promoter.enumFromString(value, Status1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200Response.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200Response.java new file mode 100644 index 00000000..b491e762 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200Response.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailvalidation.models.ValidateEmail200ResponseResult; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateEmail200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private ValidateEmail200ResponseResult result; + + public ValidateEmail200Response() {} + + private ValidateEmail200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private ValidateEmail200ResponseResult result; + + public Builder(ValidateEmail200ResponseResult result) { + this.result = result; + } + + public ValidateEmail200Response build() { + return new ValidateEmail200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateEmail200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200ResponseResult.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200ResponseResult.java new file mode 100644 index 00000000..cc38fb7c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200ResponseResult.java @@ -0,0 +1,161 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailvalidation.models.ValidateEmail200ResponseResultChecks; +import com.sendgrid.rest.api.v3.emailvalidation.models.Verdict; +import java.math.BigDecimal; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateEmail200ResponseResult { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("verdict") + @Getter + @Setter + private Verdict verdict; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("score") + @Getter + @Setter + private BigDecimal score; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("local") + @Getter + @Setter + private String local; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("host") + @Getter + @Setter + private String host; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("suggestion") + @Getter + @Setter + private String suggestion; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("checks") + @Getter + @Setter + private ValidateEmail200ResponseResultChecks checks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("source") + @Getter + @Setter + private String source; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip_address") + @Getter + @Setter + private String ipAddress; + + public ValidateEmail200ResponseResult() {} + + private ValidateEmail200ResponseResult(Builder builder) { + this.email = builder.email; + this.verdict = builder.verdict; + this.score = builder.score; + this.local = builder.local; + this.host = builder.host; + this.suggestion = builder.suggestion; + this.checks = builder.checks; + this.source = builder.source; + this.ipAddress = builder.ipAddress; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + private Verdict verdict; + private BigDecimal score; + private String local; + private String host; + private String suggestion; + private ValidateEmail200ResponseResultChecks checks; + private String source; + private String ipAddress; + + public Builder( + String email, + Verdict verdict, + BigDecimal score, + String local, + String host, + ValidateEmail200ResponseResultChecks checks, + String ipAddress + ) { + this.email = email; + this.verdict = verdict; + this.score = score; + this.local = local; + this.host = host; + this.checks = checks; + this.ipAddress = ipAddress; + } + + public Builder suggestion(String suggestion) { + this.suggestion = suggestion; + return this; + } + + public Builder source(String source) { + this.source = source; + return this; + } + + public ValidateEmail200ResponseResult build() { + return new ValidateEmail200ResponseResult(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateEmail200ResponseResult.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + if (verdict != null) joiner.add("verdict=" + verdict); + if (score != null) joiner.add("score=" + score); + if (local != null) joiner.add("local=" + local); + if (host != null) joiner.add("host=" + host); + if (suggestion != null) joiner.add("suggestion=" + suggestion); + if (checks != null) joiner.add("checks=" + checks); + if (source != null) joiner.add("source=" + source); + if (ipAddress != null) joiner.add("ipAddress=" + ipAddress); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200ResponseResultChecks.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200ResponseResultChecks.java new file mode 100644 index 00000000..796d8775 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200ResponseResultChecks.java @@ -0,0 +1,89 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.emailvalidation.models.ValidateEmail200ResponseResultChecksAdditional; +import com.sendgrid.rest.api.v3.emailvalidation.models.ValidateEmail200ResponseResultChecksDomain; +import com.sendgrid.rest.api.v3.emailvalidation.models.ValidateEmail200ResponseResultChecksLocalPart; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateEmail200ResponseResultChecks { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("domain") + @Getter + @Setter + private ValidateEmail200ResponseResultChecksDomain domain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("local_part") + @Getter + @Setter + private ValidateEmail200ResponseResultChecksLocalPart localPart; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("additional") + @Getter + @Setter + private ValidateEmail200ResponseResultChecksAdditional additional; + + public ValidateEmail200ResponseResultChecks() {} + + private ValidateEmail200ResponseResultChecks(Builder builder) { + this.domain = builder.domain; + this.localPart = builder.localPart; + this.additional = builder.additional; + } + + // Builder class for constructing object + public static class Builder { + + private ValidateEmail200ResponseResultChecksDomain domain; + private ValidateEmail200ResponseResultChecksLocalPart localPart; + private ValidateEmail200ResponseResultChecksAdditional additional; + + public Builder( + ValidateEmail200ResponseResultChecksDomain domain, + ValidateEmail200ResponseResultChecksLocalPart localPart, + ValidateEmail200ResponseResultChecksAdditional additional + ) { + this.domain = domain; + this.localPart = localPart; + this.additional = additional; + } + + public ValidateEmail200ResponseResultChecks build() { + return new ValidateEmail200ResponseResultChecks(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateEmail200ResponseResultChecks.class.getSimpleName() + "(", + ")" + ); + if (domain != null) joiner.add("domain=" + domain); + if (localPart != null) joiner.add("localPart=" + localPart); + if (additional != null) joiner.add("additional=" + additional); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200ResponseResultChecksAdditional.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200ResponseResultChecksAdditional.java new file mode 100644 index 00000000..b6912348 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200ResponseResultChecksAdditional.java @@ -0,0 +1,77 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateEmail200ResponseResultChecksAdditional { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("has_known_bounces") + @Getter + @Setter + private Boolean hasKnownBounces; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("has_suspected_bounces") + @Getter + @Setter + private Boolean hasSuspectedBounces; + + public ValidateEmail200ResponseResultChecksAdditional() {} + + private ValidateEmail200ResponseResultChecksAdditional(Builder builder) { + this.hasKnownBounces = builder.hasKnownBounces; + this.hasSuspectedBounces = builder.hasSuspectedBounces; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean hasKnownBounces; + private Boolean hasSuspectedBounces; + + public Builder(Boolean hasKnownBounces, Boolean hasSuspectedBounces) { + this.hasKnownBounces = hasKnownBounces; + this.hasSuspectedBounces = hasSuspectedBounces; + } + + public ValidateEmail200ResponseResultChecksAdditional build() { + return new ValidateEmail200ResponseResultChecksAdditional(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateEmail200ResponseResultChecksAdditional.class.getSimpleName() + + "(", + ")" + ); + if (hasKnownBounces != null) joiner.add( + "hasKnownBounces=" + hasKnownBounces + ); + if (hasSuspectedBounces != null) joiner.add( + "hasSuspectedBounces=" + hasSuspectedBounces + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200ResponseResultChecksDomain.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200ResponseResultChecksDomain.java new file mode 100644 index 00000000..499d6b9f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200ResponseResultChecksDomain.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateEmail200ResponseResultChecksDomain { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("has_valid_address_syntax") + @Getter + @Setter + private Boolean hasValidAddressSyntax; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("has_mx_or_a_record") + @Getter + @Setter + private Boolean hasMxOrARecord; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_suspected_disposable_address") + @Getter + @Setter + private Boolean isSuspectedDisposableAddress; + + public ValidateEmail200ResponseResultChecksDomain() {} + + private ValidateEmail200ResponseResultChecksDomain(Builder builder) { + this.hasValidAddressSyntax = builder.hasValidAddressSyntax; + this.hasMxOrARecord = builder.hasMxOrARecord; + this.isSuspectedDisposableAddress = + builder.isSuspectedDisposableAddress; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean hasValidAddressSyntax; + private Boolean hasMxOrARecord; + private Boolean isSuspectedDisposableAddress; + + public Builder( + Boolean hasValidAddressSyntax, + Boolean hasMxOrARecord, + Boolean isSuspectedDisposableAddress + ) { + this.hasValidAddressSyntax = hasValidAddressSyntax; + this.hasMxOrARecord = hasMxOrARecord; + this.isSuspectedDisposableAddress = isSuspectedDisposableAddress; + } + + public ValidateEmail200ResponseResultChecksDomain build() { + return new ValidateEmail200ResponseResultChecksDomain(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateEmail200ResponseResultChecksDomain.class.getSimpleName() + + "(", + ")" + ); + if (hasValidAddressSyntax != null) joiner.add( + "hasValidAddressSyntax=" + hasValidAddressSyntax + ); + if (hasMxOrARecord != null) joiner.add( + "hasMxOrARecord=" + hasMxOrARecord + ); + if (isSuspectedDisposableAddress != null) joiner.add( + "isSuspectedDisposableAddress=" + isSuspectedDisposableAddress + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200ResponseResultChecksLocalPart.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200ResponseResultChecksLocalPart.java new file mode 100644 index 00000000..9cac93ff --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmail200ResponseResultChecksLocalPart.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateEmail200ResponseResultChecksLocalPart { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_suspected_role_address") + @Getter + @Setter + private Boolean isSuspectedRoleAddress; + + public ValidateEmail200ResponseResultChecksLocalPart() {} + + private ValidateEmail200ResponseResultChecksLocalPart(Builder builder) { + this.isSuspectedRoleAddress = builder.isSuspectedRoleAddress; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean isSuspectedRoleAddress; + + public Builder(Boolean isSuspectedRoleAddress) { + this.isSuspectedRoleAddress = isSuspectedRoleAddress; + } + + public ValidateEmail200ResponseResultChecksLocalPart build() { + return new ValidateEmail200ResponseResultChecksLocalPart(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateEmail200ResponseResultChecksLocalPart.class.getSimpleName() + + "(", + ")" + ); + if (isSuspectedRoleAddress != null) joiner.add( + "isSuspectedRoleAddress=" + isSuspectedRoleAddress + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmailRequest.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmailRequest.java new file mode 100644 index 00000000..3889c37c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/ValidateEmailRequest.java @@ -0,0 +1,76 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateEmailRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("source") + @Getter + @Setter + private String source; + + public ValidateEmailRequest() {} + + private ValidateEmailRequest(Builder builder) { + this.email = builder.email; + this.source = builder.source; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + private String source; + + public Builder(String email) { + this.email = email; + } + + public Builder source(String source) { + this.source = source; + return this; + } + + public ValidateEmailRequest build() { + return new ValidateEmailRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateEmailRequest.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + if (source != null) joiner.add("source=" + source); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/Verdict.java b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/Verdict.java new file mode 100644 index 00000000..97eeb504 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/emailvalidation/models/Verdict.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Email Address Validation API + * The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + * + * 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.emailvalidation.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Verdict { + VALID("Valid"), + + RISKY("Risky"), + + INVALID("Invalid"); + + private final String value; + + private Verdict(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Verdict forValue(final String value) { + return Promoter.enumFromString(value, Verdict.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/ListEnforcedTlsSetting.java b/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/ListEnforcedTlsSetting.java new file mode 100644 index 00000000..059b4211 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/ListEnforcedTlsSetting.java @@ -0,0 +1,139 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Enforced TLS API + * The Twilio SendGrid Enforced TLS API allows you to specify whether or not the recipient of your mail send is required to support TLS or have a valid certificate. Twilio SendGrid sends all emails with [Opportunistic TLS](https://sendgrid.com/blog/myth-opportunistic-tls-email-privacy/) by default, meaning email is sent with TLS, and if the recipient's inbox provider does not accept the TLS encryption, we then send the message unencrypted. You can optionally choose to enforce TLS encryption, meaning that if the recipient's inbox provider does not accept the TLS encryption, Twilio SendGrid drops the message and sends a block event with the message, “TLS required but not supported” as the description. + * + * 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.enforcedtls; + +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.enforcedtls.models.EnforcedTlsRequestResponse; +import com.sendgrid.rest.api.v3.enforcedtls.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListEnforcedTlsSetting extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/settings/enforced_tls"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListEnforcedTlsSetting 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + EnforcedTlsRequestResponse.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/UpdateEnforcedTlsSetting.java b/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/UpdateEnforcedTlsSetting.java new file mode 100644 index 00000000..0c6b4fc8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/UpdateEnforcedTlsSetting.java @@ -0,0 +1,149 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Enforced TLS API + * The Twilio SendGrid Enforced TLS API allows you to specify whether or not the recipient of your mail send is required to support TLS or have a valid certificate. Twilio SendGrid sends all emails with [Opportunistic TLS](https://sendgrid.com/blog/myth-opportunistic-tls-email-privacy/) by default, meaning email is sent with TLS, and if the recipient's inbox provider does not accept the TLS encryption, we then send the message unencrypted. You can optionally choose to enforce TLS encryption, meaning that if the recipient's inbox provider does not accept the TLS encryption, Twilio SendGrid drops the message and sends a block event with the message, “TLS required but not supported” as the description. + * + * 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.enforcedtls; + +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.enforcedtls.models.EnforcedTlsRequestResponse; +import com.sendgrid.rest.api.v3.enforcedtls.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateEnforcedTlsSetting extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private EnforcedTlsRequestResponse enforcedTlsRequestResponse; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/settings/enforced_tls"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateEnforcedTlsSetting 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + EnforcedTlsRequestResponse.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (enforcedTlsRequestResponse != null) { + request.addBody(JsonUtil.toJson(enforcedTlsRequestResponse)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/models/EnforcedTlsRequestResponse.java b/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/models/EnforcedTlsRequestResponse.java new file mode 100644 index 00000000..b4e1a92c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/models/EnforcedTlsRequestResponse.java @@ -0,0 +1,96 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Enforced TLS API + * The Twilio SendGrid Enforced TLS API allows you to specify whether or not the recipient of your mail send is required to support TLS or have a valid certificate. Twilio SendGrid sends all emails with [Opportunistic TLS](https://sendgrid.com/blog/myth-opportunistic-tls-email-privacy/) by default, meaning email is sent with TLS, and if the recipient's inbox provider does not accept the TLS encryption, we then send the message unencrypted. You can optionally choose to enforce TLS encryption, meaning that if the recipient's inbox provider does not accept the TLS encryption, Twilio SendGrid drops the message and sends a block event with the message, “TLS required but not supported” as the description. + * + * 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.enforcedtls.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.enforcedtls.models.Version; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class EnforcedTlsRequestResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("require_tls") + @Getter + @Setter + private Boolean requireTls; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("require_valid_cert") + @Getter + @Setter + private Boolean requireValidCert; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("version") + @Getter + @Setter + private Version version; + + public EnforcedTlsRequestResponse() {} + + private EnforcedTlsRequestResponse(Builder builder) { + this.requireTls = builder.requireTls; + this.requireValidCert = builder.requireValidCert; + this.version = builder.version; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean requireTls; + private Boolean requireValidCert; + private Version version; + + public Builder() {} + + public Builder requireTls(Boolean requireTls) { + this.requireTls = requireTls; + return this; + } + + public Builder requireValidCert(Boolean requireValidCert) { + this.requireValidCert = requireValidCert; + return this; + } + + public Builder version(Version version) { + this.version = version; + return this; + } + + public EnforcedTlsRequestResponse build() { + return new EnforcedTlsRequestResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + EnforcedTlsRequestResponse.class.getSimpleName() + "(", + ")" + ); + if (requireTls != null) joiner.add("requireTls=" + requireTls); + if (requireValidCert != null) joiner.add( + "requireValidCert=" + requireValidCert + ); + if (version != null) joiner.add("version=" + version); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/models/ErrorResponse.java new file mode 100644 index 00000000..96dace3b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Enforced TLS API + * The Twilio SendGrid Enforced TLS API allows you to specify whether or not the recipient of your mail send is required to support TLS or have a valid certificate. Twilio SendGrid sends all emails with [Opportunistic TLS](https://sendgrid.com/blog/myth-opportunistic-tls-email-privacy/) by default, meaning email is sent with TLS, and if the recipient's inbox provider does not accept the TLS encryption, we then send the message unencrypted. You can optionally choose to enforce TLS encryption, meaning that if the recipient's inbox provider does not accept the TLS encryption, Twilio SendGrid drops the message and sends a block event with the message, “TLS required but not supported” as the description. + * + * 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.enforcedtls.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.enforcedtls.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..cf373168 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Enforced TLS API + * The Twilio SendGrid Enforced TLS API allows you to specify whether or not the recipient of your mail send is required to support TLS or have a valid certificate. Twilio SendGrid sends all emails with [Opportunistic TLS](https://sendgrid.com/blog/myth-opportunistic-tls-email-privacy/) by default, meaning email is sent with TLS, and if the recipient's inbox provider does not accept the TLS encryption, we then send the message unencrypted. You can optionally choose to enforce TLS encryption, meaning that if the recipient's inbox provider does not accept the TLS encryption, Twilio SendGrid drops the message and sends a block event with the message, “TLS required but not supported” as the description. + * + * 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.enforcedtls.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/models/Version.java b/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/models/Version.java new file mode 100644 index 00000000..e9901aa7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/enforcedtls/models/Version.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Enforced TLS API + * The Twilio SendGrid Enforced TLS API allows you to specify whether or not the recipient of your mail send is required to support TLS or have a valid certificate. Twilio SendGrid sends all emails with [Opportunistic TLS](https://sendgrid.com/blog/myth-opportunistic-tls-email-privacy/) by default, meaning email is sent with TLS, and if the recipient's inbox provider does not accept the TLS encryption, we then send the message unencrypted. You can optionally choose to enforce TLS encryption, meaning that if the recipient's inbox provider does not accept the TLS encryption, Twilio SendGrid drops the message and sends a block event with the message, “TLS required but not supported” as the description. + * + * 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.enforcedtls.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Version { + _1_1("1.1"), + + _1_2("1.2"), + + _1_3("1.3"); + + private final String value; + + private Version(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Version forValue(final String value) { + return Promoter.enumFromString(value, Version.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/AddIntegration.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/AddIntegration.java new file mode 100644 index 00000000..3c293ec4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/AddIntegration.java @@ -0,0 +1,124 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations; + +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.integrations.models.AddIntegration400Response; +import com.sendgrid.rest.api.v3.integrations.models.GetIntegrationsByUser403Response; +import com.sendgrid.rest.api.v3.integrations.models.GetIntegrationsByUser500Response; +import com.sendgrid.rest.api.v3.integrations.models.Integration; +import com.sendgrid.rest.api.v3.integrations.models.IntegrationInput; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class AddIntegration extends ApiKeyBase { + + @Setter + private IntegrationInput integrationInput; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/integrations"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "AddIntegration 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")) { + AddIntegration400Response error = JsonUtil.fromJson( + response.getStream(), + AddIntegration400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + GetIntegrationsByUser403Response error = JsonUtil.fromJson( + response.getStream(), + GetIntegrationsByUser403Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + GetIntegrationsByUser500Response error = JsonUtil.fromJson( + response.getStream(), + GetIntegrationsByUser500Response.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(), Integration.class), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (integrationInput != null) { + request.addBody(JsonUtil.toJson(integrationInput)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/DeleteIntegration.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/DeleteIntegration.java new file mode 100644 index 00000000..195e7c60 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/DeleteIntegration.java @@ -0,0 +1,132 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations; + +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.integrations.models.DeleteIntegration400Response; +import com.sendgrid.rest.api.v3.integrations.models.DeleteIntegration404Response; +import com.sendgrid.rest.api.v3.integrations.models.GetIntegrationsByUser403Response; +import com.sendgrid.rest.api.v3.integrations.models.GetIntegrationsByUser500Response; +import com.sendgrid.rest.api.v3.integrations.models.Id; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DeleteIntegration extends ApiKeyBase { + + private final List ids; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/integrations"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteIntegration 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")) { + DeleteIntegration400Response error = JsonUtil.fromJson( + response.getStream(), + DeleteIntegration400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + GetIntegrationsByUser403Response error = JsonUtil.fromJson( + response.getStream(), + GetIntegrationsByUser403Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + DeleteIntegration404Response error = JsonUtil.fromJson( + response.getStream(), + DeleteIntegration404Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + GetIntegrationsByUser500Response error = JsonUtil.fromJson( + response.getStream(), + GetIntegrationsByUser500Response.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 addQueryParams(Request request) { + if (ids != null) { + request.addQueryParam("ids", ids.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/FindIntegrationById.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/FindIntegrationById.java new file mode 100644 index 00000000..6804872e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/FindIntegrationById.java @@ -0,0 +1,121 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations; + +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.integrations.models.DeleteIntegration404Response; +import com.sendgrid.rest.api.v3.integrations.models.GetIntegrationsByUser403Response; +import com.sendgrid.rest.api.v3.integrations.models.GetIntegrationsByUser500Response; +import com.sendgrid.rest.api.v3.integrations.models.Integration; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class FindIntegrationById extends ApiKeyBase { + + private final String id; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/integrations/{id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "FindIntegrationById creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "403")) { + GetIntegrationsByUser403Response error = JsonUtil.fromJson( + response.getStream(), + GetIntegrationsByUser403Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + DeleteIntegration404Response error = JsonUtil.fromJson( + response.getStream(), + DeleteIntegration404Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + GetIntegrationsByUser500Response error = JsonUtil.fromJson( + response.getStream(), + GetIntegrationsByUser500Response.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(), Integration.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/GetIntegrationsByUser.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/GetIntegrationsByUser.java new file mode 100644 index 00000000..2cc88bd6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/GetIntegrationsByUser.java @@ -0,0 +1,103 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations; + +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.integrations.models.GetIntegrationsByUser200Response; +import com.sendgrid.rest.api.v3.integrations.models.GetIntegrationsByUser403Response; +import com.sendgrid.rest.api.v3.integrations.models.GetIntegrationsByUser500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class GetIntegrationsByUser extends ApiKeyBase { + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/integrations"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetIntegrationsByUser creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "403")) { + GetIntegrationsByUser403Response error = JsonUtil.fromJson( + response.getStream(), + GetIntegrationsByUser403Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + GetIntegrationsByUser500Response error = JsonUtil.fromJson( + response.getStream(), + GetIntegrationsByUser500Response.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(), + GetIntegrationsByUser200Response.class + ), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/UpdateIntegration.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/UpdateIntegration.java new file mode 100644 index 00000000..8eeae7fb --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/UpdateIntegration.java @@ -0,0 +1,147 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations; + +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.integrations.models.AddIntegration400Response; +import com.sendgrid.rest.api.v3.integrations.models.DeleteIntegration404Response; +import com.sendgrid.rest.api.v3.integrations.models.GetIntegrationsByUser403Response; +import com.sendgrid.rest.api.v3.integrations.models.GetIntegrationsByUser500Response; +import com.sendgrid.rest.api.v3.integrations.models.Integration; +import com.sendgrid.rest.api.v3.integrations.models.IntegrationPatch; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateIntegration extends ApiKeyBase { + + private final String id; + + @Setter + private IntegrationPatch integrationPatch; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/integrations/{id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateIntegration 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")) { + AddIntegration400Response error = JsonUtil.fromJson( + response.getStream(), + AddIntegration400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + GetIntegrationsByUser403Response error = JsonUtil.fromJson( + response.getStream(), + GetIntegrationsByUser403Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + DeleteIntegration404Response error = JsonUtil.fromJson( + response.getStream(), + DeleteIntegration404Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + GetIntegrationsByUser500Response error = JsonUtil.fromJson( + response.getStream(), + GetIntegrationsByUser500Response.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(), Integration.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addBody(final Request request) { + if (integrationPatch != null) { + request.addBody(JsonUtil.toJson(integrationPatch)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/AddIntegration400Response.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/AddIntegration400Response.java new file mode 100644 index 00000000..7a4b0b62 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/AddIntegration400Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.integrations.models.InvalidRequest; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddIntegration400Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public AddIntegration400Response() {} + + private AddIntegration400Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public AddIntegration400Response build() { + return new AddIntegration400Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddIntegration400Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/DeleteIntegration400Response.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/DeleteIntegration400Response.java new file mode 100644 index 00000000..edea9996 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/DeleteIntegration400Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.integrations.models.InvalidDeleteRequest; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteIntegration400Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public DeleteIntegration400Response() {} + + private DeleteIntegration400Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public DeleteIntegration400Response build() { + return new DeleteIntegration400Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteIntegration400Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/DeleteIntegration404Response.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/DeleteIntegration404Response.java new file mode 100644 index 00000000..44b6cbcc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/DeleteIntegration404Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.integrations.models.IntegrationNotFound; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteIntegration404Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public DeleteIntegration404Response() {} + + private DeleteIntegration404Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public DeleteIntegration404Response build() { + return new DeleteIntegration404Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteIntegration404Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Destination.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Destination.java new file mode 100644 index 00000000..f8175d1d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Destination.java @@ -0,0 +1,40 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Destination { + SEGMENT("Segment"); + + private final String value; + + private Destination(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Destination forValue(final String value) { + return Promoter.enumFromString(value, Destination.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Destination1.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Destination1.java new file mode 100644 index 00000000..e10920aa --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Destination1.java @@ -0,0 +1,40 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Destination1 { + SEGMENT("Segment"); + + private final String value; + + private Destination1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Destination1 forValue(final String value) { + return Promoter.enumFromString(value, Destination1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Destination2.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Destination2.java new file mode 100644 index 00000000..e02b6c05 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Destination2.java @@ -0,0 +1,40 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Destination2 { + SEGMENT("Segment"); + + private final String value; + + private Destination2(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Destination2 forValue(final String value) { + return Promoter.enumFromString(value, Destination2.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Destination3.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Destination3.java new file mode 100644 index 00000000..c493986f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Destination3.java @@ -0,0 +1,40 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Destination3 { + SEGMENT("Segment"); + + private final String value; + + private Destination3(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Destination3 forValue(final String value) { + return Promoter.enumFromString(value, Destination3.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/DestinationRegion.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/DestinationRegion.java new file mode 100644 index 00000000..7aba93a6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/DestinationRegion.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum DestinationRegion { + EU("EU"), + + US("US"); + + private final String value; + + private DestinationRegion(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static DestinationRegion forValue(final String value) { + return Promoter.enumFromString(value, DestinationRegion.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/DestinationRegion1.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/DestinationRegion1.java new file mode 100644 index 00000000..0f94b8ae --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/DestinationRegion1.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum DestinationRegion1 { + EU("EU"), + + US("US"); + + private final String value; + + private DestinationRegion1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static DestinationRegion1 forValue(final String value) { + return Promoter.enumFromString(value, DestinationRegion1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/DestinationRegion2.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/DestinationRegion2.java new file mode 100644 index 00000000..0d228e17 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/DestinationRegion2.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum DestinationRegion2 { + EU("EU"), + + US("US"); + + private final String value; + + private DestinationRegion2(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static DestinationRegion2 forValue(final String value) { + return Promoter.enumFromString(value, DestinationRegion2.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Forbidden.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Forbidden.java new file mode 100644 index 00000000..3dc5da53 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Forbidden.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Forbidden { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public Forbidden() {} + + private Forbidden(Builder builder) { + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Forbidden build() { + return new Forbidden(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Forbidden.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/GetIntegrationsByUser200Response.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/GetIntegrationsByUser200Response.java new file mode 100644 index 00000000..aa859c5f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/GetIntegrationsByUser200Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.integrations.models.Integration; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetIntegrationsByUser200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + public GetIntegrationsByUser200Response() {} + + private GetIntegrationsByUser200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + + public Builder() {} + + public Builder result(List result) { + this.result = result; + return this; + } + + public GetIntegrationsByUser200Response build() { + return new GetIntegrationsByUser200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetIntegrationsByUser200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/GetIntegrationsByUser403Response.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/GetIntegrationsByUser403Response.java new file mode 100644 index 00000000..5af0a822 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/GetIntegrationsByUser403Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.integrations.models.Forbidden; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetIntegrationsByUser403Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public GetIntegrationsByUser403Response() {} + + private GetIntegrationsByUser403Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public GetIntegrationsByUser403Response build() { + return new GetIntegrationsByUser403Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetIntegrationsByUser403Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/GetIntegrationsByUser500Response.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/GetIntegrationsByUser500Response.java new file mode 100644 index 00000000..8305cdff --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/GetIntegrationsByUser500Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.integrations.models.InternalError; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetIntegrationsByUser500Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public GetIntegrationsByUser500Response() {} + + private GetIntegrationsByUser500Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public GetIntegrationsByUser500Response build() { + return new GetIntegrationsByUser500Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetIntegrationsByUser500Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Id.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Id.java new file mode 100644 index 00000000..725975ae --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Id.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Id { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("integration_id") + @Getter + @Setter + private String integrationId; + + public Id() {} + + private Id(Builder builder) { + this.integrationId = builder.integrationId; + } + + // Builder class for constructing object + public static class Builder { + + private String integrationId; + + public Builder() {} + + public Builder integrationId(String integrationId) { + this.integrationId = integrationId; + return this; + } + + public Id build() { + return new Id(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Id.class.getSimpleName() + "(", + ")" + ); + if (integrationId != null) joiner.add("integrationId=" + integrationId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Integration.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Integration.java new file mode 100644 index 00000000..7c8b491f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Integration.java @@ -0,0 +1,138 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.integrations.models.Destination3; +import com.sendgrid.rest.api.v3.integrations.models.IntegrationFilters; +import com.sendgrid.rest.api.v3.integrations.models.IntegrationProperties; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Integration { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("integration_id") + @Getter + @Setter + private String integrationId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("user_id") + @Getter + @Setter + private String userId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("filters") + @Getter + @Setter + private IntegrationFilters filters; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("properties") + @Getter + @Setter + private IntegrationProperties properties; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("label") + @Getter + @Setter + private String label; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("destination") + @Getter + @Setter + private Destination3 destination; + + public Integration() {} + + private Integration(Builder builder) { + this.integrationId = builder.integrationId; + this.userId = builder.userId; + this.filters = builder.filters; + this.properties = builder.properties; + this.label = builder.label; + this.destination = builder.destination; + } + + // Builder class for constructing object + public static class Builder { + + private String integrationId; + private String userId; + private IntegrationFilters filters; + private IntegrationProperties properties; + private String label; + private Destination3 destination; + + public Builder() {} + + public Builder integrationId(String integrationId) { + this.integrationId = integrationId; + return this; + } + + public Builder userId(String userId) { + this.userId = userId; + return this; + } + + public Builder filters(IntegrationFilters filters) { + this.filters = filters; + return this; + } + + public Builder properties(IntegrationProperties properties) { + this.properties = properties; + return this; + } + + public Builder label(String label) { + this.label = label; + return this; + } + + public Builder destination(Destination3 destination) { + this.destination = destination; + return this; + } + + public Integration build() { + return new Integration(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Integration.class.getSimpleName() + "(", + ")" + ); + if (integrationId != null) joiner.add("integrationId=" + integrationId); + if (userId != null) joiner.add("userId=" + userId); + if (filters != null) joiner.add("filters=" + filters); + if (properties != null) joiner.add("properties=" + properties); + if (label != null) joiner.add("label=" + label); + if (destination != null) joiner.add("destination=" + destination); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationFilters.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationFilters.java new file mode 100644 index 00000000..249b0ca7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationFilters.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.integrations.models.Items2; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class IntegrationFilters { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email_events") + @Getter + @Setter + private List emailEvents; + + public IntegrationFilters() {} + + private IntegrationFilters(Builder builder) { + this.emailEvents = builder.emailEvents; + } + + // Builder class for constructing object + public static class Builder { + + private List emailEvents; + + public Builder() {} + + public Builder emailEvents(List emailEvents) { + this.emailEvents = emailEvents; + return this; + } + + public IntegrationFilters build() { + return new IntegrationFilters(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + IntegrationFilters.class.getSimpleName() + "(", + ")" + ); + if (emailEvents != null) joiner.add("emailEvents=" + emailEvents); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationInput.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationInput.java new file mode 100644 index 00000000..57e503e9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationInput.java @@ -0,0 +1,103 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.integrations.models.Destination2; +import com.sendgrid.rest.api.v3.integrations.models.IntegrationInputFilters; +import com.sendgrid.rest.api.v3.integrations.models.IntegrationInputProperties; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class IntegrationInput { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("destination") + @Getter + @Setter + private Destination2 destination; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("filters") + @Getter + @Setter + private IntegrationInputFilters filters; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("properties") + @Getter + @Setter + private IntegrationInputProperties properties; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("label") + @Getter + @Setter + private String label; + + public IntegrationInput() {} + + private IntegrationInput(Builder builder) { + this.destination = builder.destination; + this.filters = builder.filters; + this.properties = builder.properties; + this.label = builder.label; + } + + // Builder class for constructing object + public static class Builder { + + private Destination2 destination; + private IntegrationInputFilters filters; + private IntegrationInputProperties properties; + private String label; + + public Builder( + Destination2 destination, + IntegrationInputFilters filters, + IntegrationInputProperties properties + ) { + this.destination = destination; + this.filters = filters; + this.properties = properties; + } + + public Builder label(String label) { + this.label = label; + return this; + } + + public IntegrationInput build() { + return new IntegrationInput(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + IntegrationInput.class.getSimpleName() + "(", + ")" + ); + if (destination != null) joiner.add("destination=" + destination); + if (filters != null) joiner.add("filters=" + filters); + if (properties != null) joiner.add("properties=" + properties); + if (label != null) joiner.add("label=" + label); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationInputFilters.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationInputFilters.java new file mode 100644 index 00000000..cba72842 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationInputFilters.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.integrations.models.Items1; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class IntegrationInputFilters { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email_events") + @Getter + @Setter + private List emailEvents; + + public IntegrationInputFilters() {} + + private IntegrationInputFilters(Builder builder) { + this.emailEvents = builder.emailEvents; + } + + // Builder class for constructing object + public static class Builder { + + private List emailEvents; + + public Builder(List emailEvents) { + this.emailEvents = emailEvents; + } + + public IntegrationInputFilters build() { + return new IntegrationInputFilters(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + IntegrationInputFilters.class.getSimpleName() + "(", + ")" + ); + if (emailEvents != null) joiner.add("emailEvents=" + emailEvents); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationInputProperties.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationInputProperties.java new file mode 100644 index 00000000..a20c0403 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationInputProperties.java @@ -0,0 +1,75 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.integrations.models.DestinationRegion1; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class IntegrationInputProperties { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("write_key") + @Getter + @Setter + private String writeKey; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("destination_region") + @Getter + @Setter + private DestinationRegion1 destinationRegion; + + public IntegrationInputProperties() {} + + private IntegrationInputProperties(Builder builder) { + this.writeKey = builder.writeKey; + this.destinationRegion = builder.destinationRegion; + } + + // Builder class for constructing object + public static class Builder { + + private String writeKey; + private DestinationRegion1 destinationRegion; + + public Builder(String writeKey, DestinationRegion1 destinationRegion) { + this.writeKey = writeKey; + this.destinationRegion = destinationRegion; + } + + public IntegrationInputProperties build() { + return new IntegrationInputProperties(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + IntegrationInputProperties.class.getSimpleName() + "(", + ")" + ); + if (writeKey != null) joiner.add("writeKey=" + writeKey); + if (destinationRegion != null) joiner.add( + "destinationRegion=" + destinationRegion + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationNotFound.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationNotFound.java new file mode 100644 index 00000000..4c72a2a5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationNotFound.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class IntegrationNotFound { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public IntegrationNotFound() {} + + private IntegrationNotFound(Builder builder) { + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public IntegrationNotFound build() { + return new IntegrationNotFound(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + IntegrationNotFound.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationPatch.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationPatch.java new file mode 100644 index 00000000..4fa3603c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationPatch.java @@ -0,0 +1,110 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.integrations.models.Destination1; +import com.sendgrid.rest.api.v3.integrations.models.IntegrationPatchFilters; +import com.sendgrid.rest.api.v3.integrations.models.IntegrationPatchProperties; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class IntegrationPatch { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("destination") + @Getter + @Setter + private Destination1 destination; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("filters") + @Getter + @Setter + private IntegrationPatchFilters filters; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("properties") + @Getter + @Setter + private IntegrationPatchProperties properties; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("label") + @Getter + @Setter + private String label; + + public IntegrationPatch() {} + + private IntegrationPatch(Builder builder) { + this.destination = builder.destination; + this.filters = builder.filters; + this.properties = builder.properties; + this.label = builder.label; + } + + // Builder class for constructing object + public static class Builder { + + private Destination1 destination; + private IntegrationPatchFilters filters; + private IntegrationPatchProperties properties; + private String label; + + public Builder() {} + + public Builder destination(Destination1 destination) { + this.destination = destination; + return this; + } + + public Builder filters(IntegrationPatchFilters filters) { + this.filters = filters; + return this; + } + + public Builder properties(IntegrationPatchProperties properties) { + this.properties = properties; + return this; + } + + public Builder label(String label) { + this.label = label; + return this; + } + + public IntegrationPatch build() { + return new IntegrationPatch(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + IntegrationPatch.class.getSimpleName() + "(", + ")" + ); + if (destination != null) joiner.add("destination=" + destination); + if (filters != null) joiner.add("filters=" + filters); + if (properties != null) joiner.add("properties=" + properties); + if (label != null) joiner.add("label=" + label); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationPatchFilters.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationPatchFilters.java new file mode 100644 index 00000000..4a3072c4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationPatchFilters.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.integrations.models.Items; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class IntegrationPatchFilters { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email_events") + @Getter + @Setter + private List emailEvents; + + public IntegrationPatchFilters() {} + + private IntegrationPatchFilters(Builder builder) { + this.emailEvents = builder.emailEvents; + } + + // Builder class for constructing object + public static class Builder { + + private List emailEvents; + + public Builder() {} + + public Builder emailEvents(List emailEvents) { + this.emailEvents = emailEvents; + return this; + } + + public IntegrationPatchFilters build() { + return new IntegrationPatchFilters(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + IntegrationPatchFilters.class.getSimpleName() + "(", + ")" + ); + if (emailEvents != null) joiner.add("emailEvents=" + emailEvents); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationPatchProperties.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationPatchProperties.java new file mode 100644 index 00000000..d422e5f6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationPatchProperties.java @@ -0,0 +1,82 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.integrations.models.DestinationRegion; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class IntegrationPatchProperties { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("write_key") + @Getter + @Setter + private String writeKey; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("destination_region") + @Getter + @Setter + private DestinationRegion destinationRegion; + + public IntegrationPatchProperties() {} + + private IntegrationPatchProperties(Builder builder) { + this.writeKey = builder.writeKey; + this.destinationRegion = builder.destinationRegion; + } + + // Builder class for constructing object + public static class Builder { + + private String writeKey; + private DestinationRegion destinationRegion; + + public Builder() {} + + public Builder writeKey(String writeKey) { + this.writeKey = writeKey; + return this; + } + + public Builder destinationRegion(DestinationRegion destinationRegion) { + this.destinationRegion = destinationRegion; + return this; + } + + public IntegrationPatchProperties build() { + return new IntegrationPatchProperties(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + IntegrationPatchProperties.class.getSimpleName() + "(", + ")" + ); + if (writeKey != null) joiner.add("writeKey=" + writeKey); + if (destinationRegion != null) joiner.add( + "destinationRegion=" + destinationRegion + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationProperties.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationProperties.java new file mode 100644 index 00000000..d695e978 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/IntegrationProperties.java @@ -0,0 +1,82 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.integrations.models.DestinationRegion2; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class IntegrationProperties { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("write_key") + @Getter + @Setter + private String writeKey; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("destination_region") + @Getter + @Setter + private DestinationRegion2 destinationRegion; + + public IntegrationProperties() {} + + private IntegrationProperties(Builder builder) { + this.writeKey = builder.writeKey; + this.destinationRegion = builder.destinationRegion; + } + + // Builder class for constructing object + public static class Builder { + + private String writeKey; + private DestinationRegion2 destinationRegion; + + public Builder() {} + + public Builder writeKey(String writeKey) { + this.writeKey = writeKey; + return this; + } + + public Builder destinationRegion(DestinationRegion2 destinationRegion) { + this.destinationRegion = destinationRegion; + return this; + } + + public IntegrationProperties build() { + return new IntegrationProperties(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + IntegrationProperties.class.getSimpleName() + "(", + ")" + ); + if (writeKey != null) joiner.add("writeKey=" + writeKey); + if (destinationRegion != null) joiner.add( + "destinationRegion=" + destinationRegion + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/InternalError.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/InternalError.java new file mode 100644 index 00000000..90720ae5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/InternalError.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class InternalError { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public InternalError() {} + + private InternalError(Builder builder) { + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public InternalError build() { + return new InternalError(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + InternalError.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/InvalidDeleteRequest.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/InvalidDeleteRequest.java new file mode 100644 index 00000000..039ea5ea --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/InvalidDeleteRequest.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class InvalidDeleteRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("parameter") + @Getter + @Setter + private String parameter; + + public InvalidDeleteRequest() {} + + private InvalidDeleteRequest(Builder builder) { + this.message = builder.message; + this.parameter = builder.parameter; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String parameter; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder parameter(String parameter) { + this.parameter = parameter; + return this; + } + + public InvalidDeleteRequest build() { + return new InvalidDeleteRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + InvalidDeleteRequest.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (parameter != null) joiner.add("parameter=" + parameter); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/InvalidRequest.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/InvalidRequest.java new file mode 100644 index 00000000..1c790493 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/InvalidRequest.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class InvalidRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + public InvalidRequest() {} + + private InvalidRequest(Builder builder) { + this.message = builder.message; + this.field = builder.field; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public InvalidRequest build() { + return new InvalidRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + InvalidRequest.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Items.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Items.java new file mode 100644 index 00000000..87b805a2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Items.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Items { + DROP("drop"), + + PROCESSED("processed"), + + DEFERRED("deferred"), + + GROUP_UNSUBSCRIBE("group_unsubscribe"), + + BOUNCE("bounce"), + + DELIVERED("delivered"), + + CLICK("click"), + + UNSUBSCRIBE("unsubscribe"), + + OPEN("open"), + + GROUP_RESUBSCRIBE("group_resubscribe"), + + SPAMREPORT("spamreport"), + + MACHINE_OPENED("machine_opened"); + + private final String value; + + private Items(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Items forValue(final String value) { + return Promoter.enumFromString(value, Items.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Items1.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Items1.java new file mode 100644 index 00000000..fe44c35f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Items1.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Items1 { + DROP("drop"), + + PROCESSED("processed"), + + DEFERRED("deferred"), + + GROUP_UNSUBSCRIBE("group_unsubscribe"), + + BOUNCE("bounce"), + + DELIVERED("delivered"), + + CLICK("click"), + + UNSUBSCRIBE("unsubscribe"), + + OPEN("open"), + + GROUP_RESUBSCRIBE("group_resubscribe"), + + SPAMREPORT("spamreport"), + + MACHINE_OPENED("machine_opened"); + + private final String value; + + private Items1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Items1 forValue(final String value) { + return Promoter.enumFromString(value, Items1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Items2.java b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Items2.java new file mode 100644 index 00000000..a09ef253 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/integrations/models/Items2.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Integrations API + * Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + * + * 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.integrations.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Items2 { + DROP("drop"), + + PROCESSED("processed"), + + DEFERRED("deferred"), + + GROUP_UNSUBSCRIBE("group_unsubscribe"), + + BOUNCE("bounce"), + + DELIVERED("delivered"), + + CLICK("click"), + + UNSUBSCRIBE("unsubscribe"), + + OPEN("open"), + + GROUP_RESUBSCRIBE("group_resubscribe"), + + SPAMREPORT("spamreport"), + + MACHINE_OPENED("machine_opened"); + + private final String value; + + private Items2(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Items2 forValue(final String value) { + return Promoter.enumFromString(value, Items2.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/AddIpToAllowList.java b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/AddIpToAllowList.java new file mode 100644 index 00000000..3ad78ee7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/AddIpToAllowList.java @@ -0,0 +1,150 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Access Management API + * IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + * + * 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.ipaccessmanagement; + +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.ipaccessmanagement.models.AddIpToAllowListRequest; +import com.sendgrid.rest.api.v3.ipaccessmanagement.models.ErrorResponse; +import com.sendgrid.rest.api.v3.ipaccessmanagement.models.IpAccessManagement2xx; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class AddIpToAllowList extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private AddIpToAllowListRequest addIpToAllowListRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/access_settings/whitelist"; + 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( + "AddIpToAllowList 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + IpAccessManagement2xx.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (addIpToAllowListRequest != null) { + request.addBody(JsonUtil.toJson(addIpToAllowListRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/DeleteAllowedIp.java b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/DeleteAllowedIp.java new file mode 100644 index 00000000..76a572fb --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/DeleteAllowedIp.java @@ -0,0 +1,88 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Access Management API + * IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + * + * 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.ipaccessmanagement; + +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 lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteAllowedIp extends ApiKeyBase { + + private final String ruleId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/access_settings/whitelist/{rule_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteAllowedIp creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (ruleId != null) { + request.addPathParam("rule_id", ruleId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/DeleteAllowedIps.java b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/DeleteAllowedIps.java new file mode 100644 index 00000000..4f581901 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/DeleteAllowedIps.java @@ -0,0 +1,144 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Access Management API + * IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + * + * 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.ipaccessmanagement; + +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.ipaccessmanagement.models.DeleteAllowedIpsRequest; +import com.sendgrid.rest.api.v3.ipaccessmanagement.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteAllowedIps extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private DeleteAllowedIpsRequest deleteAllowedIpsRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/access_settings/whitelist"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteAllowedIps 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), Object.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (deleteAllowedIpsRequest != null) { + request.addBody(JsonUtil.toJson(deleteAllowedIpsRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/GetAllowedIp.java b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/GetAllowedIp.java new file mode 100644 index 00000000..1d04db0b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/GetAllowedIp.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Access Management API + * IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + * + * 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.ipaccessmanagement; + +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.ipaccessmanagement.models.IpAccessManagement2xx; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetAllowedIp extends ApiKeyBase { + + private final String ruleId; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/access_settings/whitelist/{rule_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetAllowedIp creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + IpAccessManagement2xx.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (ruleId != null) { + request.addPathParam("rule_id", ruleId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/ListAccessActivity.java b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/ListAccessActivity.java new file mode 100644 index 00000000..057d03f1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/ListAccessActivity.java @@ -0,0 +1,149 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Access Management API + * IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + * + * 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.ipaccessmanagement; + +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.ipaccessmanagement.models.ErrorResponse; +import com.sendgrid.rest.api.v3.ipaccessmanagement.models.ListAccessActivity200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListAccessActivity extends ApiKeyBase { + + @Setter + private Integer limit; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/access_settings/activity"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListAccessActivity 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + ListAccessActivity200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/ListAllowedIp.java b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/ListAllowedIp.java new file mode 100644 index 00000000..ffaec267 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/ListAllowedIp.java @@ -0,0 +1,139 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Access Management API + * IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + * + * 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.ipaccessmanagement; + +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.ipaccessmanagement.models.ErrorResponse; +import com.sendgrid.rest.api.v3.ipaccessmanagement.models.IpAccessManagement2xx; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListAllowedIp extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/access_settings/whitelist"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListAllowedIp 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + IpAccessManagement2xx.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/AddIpToAllowListRequest.java b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/AddIpToAllowListRequest.java new file mode 100644 index 00000000..b3b69a50 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/AddIpToAllowListRequest.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Access Management API + * IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + * + * 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.ipaccessmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaccessmanagement.models.AddIpToAllowListRequestIpsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddIpToAllowListRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ips") + @Getter + @Setter + private List ips; + + public AddIpToAllowListRequest() {} + + private AddIpToAllowListRequest(Builder builder) { + this.ips = builder.ips; + } + + // Builder class for constructing object + public static class Builder { + + private List ips; + + public Builder(List ips) { + this.ips = ips; + } + + public AddIpToAllowListRequest build() { + return new AddIpToAllowListRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddIpToAllowListRequest.class.getSimpleName() + "(", + ")" + ); + if (ips != null) joiner.add("ips=" + ips); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/AddIpToAllowListRequestIpsInner.java b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/AddIpToAllowListRequestIpsInner.java new file mode 100644 index 00000000..d5035a5b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/AddIpToAllowListRequestIpsInner.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Access Management API + * IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + * + * 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.ipaccessmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddIpToAllowListRequestIpsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + public AddIpToAllowListRequestIpsInner() {} + + private AddIpToAllowListRequestIpsInner(Builder builder) { + this.ip = builder.ip; + } + + // Builder class for constructing object + public static class Builder { + + private String ip; + + public Builder(String ip) { + this.ip = ip; + } + + public AddIpToAllowListRequestIpsInner build() { + return new AddIpToAllowListRequestIpsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddIpToAllowListRequestIpsInner.class.getSimpleName() + "(", + ")" + ); + if (ip != null) joiner.add("ip=" + ip); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/DeleteAllowedIpsRequest.java b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/DeleteAllowedIpsRequest.java new file mode 100644 index 00000000..b99658de --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/DeleteAllowedIpsRequest.java @@ -0,0 +1,66 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Access Management API + * IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + * + * 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.ipaccessmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteAllowedIpsRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ids") + @Getter + @Setter + private List ids; + + public DeleteAllowedIpsRequest() {} + + private DeleteAllowedIpsRequest(Builder builder) { + this.ids = builder.ids; + } + + // Builder class for constructing object + public static class Builder { + + private List ids; + + public Builder() {} + + public Builder ids(List ids) { + this.ids = ids; + return this; + } + + public DeleteAllowedIpsRequest build() { + return new DeleteAllowedIpsRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteAllowedIpsRequest.class.getSimpleName() + "(", + ")" + ); + if (ids != null) joiner.add("ids=" + ids); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/ErrorResponse.java new file mode 100644 index 00000000..c4ec9426 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Access Management API + * IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + * + * 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.ipaccessmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaccessmanagement.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..b93088f8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Access Management API + * IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + * + * 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.ipaccessmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/IpAccessManagement2xx.java b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/IpAccessManagement2xx.java new file mode 100644 index 00000000..a9ced45c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/IpAccessManagement2xx.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Access Management API + * IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + * + * 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.ipaccessmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaccessmanagement.models.IpAccessManagement2xxResultInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class IpAccessManagement2xx { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + public IpAccessManagement2xx() {} + + private IpAccessManagement2xx(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + + public Builder() {} + + public Builder result(List result) { + this.result = result; + return this; + } + + public IpAccessManagement2xx build() { + return new IpAccessManagement2xx(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + IpAccessManagement2xx.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/IpAccessManagement2xxResultInner.java b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/IpAccessManagement2xxResultInner.java new file mode 100644 index 00000000..848de9b1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/IpAccessManagement2xxResultInner.java @@ -0,0 +1,107 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Access Management API + * IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + * + * 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.ipaccessmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class IpAccessManagement2xxResultInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private Integer createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private Integer updatedAt; + + public IpAccessManagement2xxResultInner() {} + + private IpAccessManagement2xxResultInner(Builder builder) { + this.id = builder.id; + this.ip = builder.ip; + this.createdAt = builder.createdAt; + this.updatedAt = builder.updatedAt; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private String ip; + private Integer createdAt; + private Integer updatedAt; + + public Builder() {} + + public Builder id(Integer id) { + this.id = id; + return this; + } + + public Builder ip(String ip) { + this.ip = ip; + return this; + } + + public Builder createdAt(Integer createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder updatedAt(Integer updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public IpAccessManagement2xxResultInner build() { + return new IpAccessManagement2xxResultInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + IpAccessManagement2xxResultInner.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (ip != null) joiner.add("ip=" + ip); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/ListAccessActivity200Response.java b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/ListAccessActivity200Response.java new file mode 100644 index 00000000..7a01d5c8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/ListAccessActivity200Response.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Access Management API + * IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + * + * 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.ipaccessmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaccessmanagement.models.ListAccessActivity200ResponseResultInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListAccessActivity200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + public ListAccessActivity200Response() {} + + private ListAccessActivity200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + + public Builder(List result) { + this.result = result; + } + + public ListAccessActivity200Response build() { + return new ListAccessActivity200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListAccessActivity200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/ListAccessActivity200ResponseResultInner.java b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/ListAccessActivity200ResponseResultInner.java new file mode 100644 index 00000000..f8397391 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaccessmanagement/models/ListAccessActivity200ResponseResultInner.java @@ -0,0 +1,120 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Access Management API + * IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + * + * 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.ipaccessmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListAccessActivity200ResponseResultInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("allowed") + @Getter + @Setter + private Boolean allowed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("auth_method") + @Getter + @Setter + private String authMethod; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_at") + @Getter + @Setter + private Integer firstAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_at") + @Getter + @Setter + private Integer lastAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("location") + @Getter + @Setter + private String location; + + public ListAccessActivity200ResponseResultInner() {} + + private ListAccessActivity200ResponseResultInner(Builder builder) { + this.allowed = builder.allowed; + this.authMethod = builder.authMethod; + this.firstAt = builder.firstAt; + this.ip = builder.ip; + this.lastAt = builder.lastAt; + this.location = builder.location; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean allowed; + private String authMethod; + private Integer firstAt; + private String ip; + private Integer lastAt; + private String location; + + public Builder( + Boolean allowed, + String authMethod, + Integer firstAt, + String ip, + Integer lastAt, + String location + ) { + this.allowed = allowed; + this.authMethod = authMethod; + this.firstAt = firstAt; + this.ip = ip; + this.lastAt = lastAt; + this.location = location; + } + + public ListAccessActivity200ResponseResultInner build() { + return new ListAccessActivity200ResponseResultInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListAccessActivity200ResponseResultInner.class.getSimpleName() + + "(", + ")" + ); + if (allowed != null) joiner.add("allowed=" + allowed); + if (authMethod != null) joiner.add("authMethod=" + authMethod); + if (firstAt != null) joiner.add("firstAt=" + firstAt); + if (ip != null) joiner.add("ip=" + ip); + if (lastAt != null) joiner.add("lastAt=" + lastAt); + if (location != null) joiner.add("location=" + location); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/AddIp.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/AddIp.java new file mode 100644 index 00000000..838908ee --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/AddIp.java @@ -0,0 +1,122 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement; + +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.ipaddressmanagement.models.AddIp201Response; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.AddIpRequest; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.IpAddressManagementErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class AddIp extends ApiKeyBase { + + @Setter + private AddIpRequest addIpRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/send_ips/ips"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "AddIp 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")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.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(), AddIp201Response.class), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (addIpRequest != null) { + request.addBody(JsonUtil.toJson(addIpRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/AddIpsToIpPool.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/AddIpsToIpPool.java new file mode 100644 index 00000000..a62fe29d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/AddIpsToIpPool.java @@ -0,0 +1,136 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement; + +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.ipaddressmanagement.models.AddIpsToIpPool200Response; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.AddIpsToIpPoolRequest; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.IpAddressManagementErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class AddIpsToIpPool extends ApiKeyBase { + + private final String poolid; + + @Setter + private AddIpsToIpPoolRequest addIpsToIpPoolRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/send_ips/pools/{poolid}/ips:batchAdd"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "AddIpsToIpPool 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")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.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(), + AddIpsToIpPool200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (poolid != null) { + request.addPathParam("poolid", poolid.toString()); + } + } + + private void addBody(final Request request) { + if (addIpsToIpPoolRequest != null) { + request.addBody(JsonUtil.toJson(addIpsToIpPoolRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/AddSubUsersToIp.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/AddSubUsersToIp.java new file mode 100644 index 00000000..81a976fe --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/AddSubUsersToIp.java @@ -0,0 +1,136 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement; + +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.ipaddressmanagement.models.AddSubUsersToIp200Response; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.AddSubUsersToIpRequest; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.IpAddressManagementErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class AddSubUsersToIp extends ApiKeyBase { + + private final String ip; + + @Setter + private AddSubUsersToIpRequest addSubUsersToIpRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/send_ips/ips/{ip}/subusers:batchAdd"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "AddSubUsersToIp 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")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.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(), + AddSubUsersToIp200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (ip != null) { + request.addPathParam("ip", ip.toString()); + } + } + + private void addBody(final Request request) { + if (addSubUsersToIpRequest != null) { + request.addBody(JsonUtil.toJson(addSubUsersToIpRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/CreateIpPool.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/CreateIpPool.java new file mode 100644 index 00000000..99c758f5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/CreateIpPool.java @@ -0,0 +1,127 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement; + +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.ipaddressmanagement.models.CreateIpPool201Response; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.CreateIpPoolRequest; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.IpAddressManagementErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateIpPool extends ApiKeyBase { + + @Setter + private CreateIpPoolRequest createIpPoolRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/send_ips/pools"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "CreateIpPool 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")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.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(), + CreateIpPool201Response.class + ), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (createIpPoolRequest != null) { + request.addBody(JsonUtil.toJson(createIpPoolRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/DeleteIpPool.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/DeleteIpPool.java new file mode 100644 index 00000000..7218483f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/DeleteIpPool.java @@ -0,0 +1,114 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement; + +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.ipaddressmanagement.models.IpAddressManagementErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DeleteIpPool extends ApiKeyBase { + + private final String poolid; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/send_ips/pools/{poolid}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteIpPool 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")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.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 (poolid != null) { + request.addPathParam("poolid", poolid.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/DeleteIpsFromIpPool.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/DeleteIpsFromIpPool.java new file mode 100644 index 00000000..c7ac6d59 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/DeleteIpsFromIpPool.java @@ -0,0 +1,126 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement; + +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.ipaddressmanagement.models.DeleteIpsFromIpPoolRequest; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.IpAddressManagementErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteIpsFromIpPool extends ApiKeyBase { + + private final String poolid; + + @Setter + private DeleteIpsFromIpPoolRequest deleteIpsFromIpPoolRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/send_ips/pools/{poolid}/ips:batchDelete"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteIpsFromIpPool 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")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.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 (poolid != null) { + request.addPathParam("poolid", poolid.toString()); + } + } + + private void addBody(final Request request) { + if (deleteIpsFromIpPoolRequest != null) { + request.addBody(JsonUtil.toJson(deleteIpsFromIpPoolRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/DeleteSubUsersFromIp.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/DeleteSubUsersFromIp.java new file mode 100644 index 00000000..553082aa --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/DeleteSubUsersFromIp.java @@ -0,0 +1,126 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement; + +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.ipaddressmanagement.models.DeleteSubUsersFromIpRequest; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.IpAddressManagementErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteSubUsersFromIp extends ApiKeyBase { + + private final String ip; + + @Setter + private DeleteSubUsersFromIpRequest deleteSubUsersFromIpRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/send_ips/ips/{ip}/subusers:batchDelete"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSubUsersFromIp 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")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.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 (ip != null) { + request.addPathParam("ip", ip.toString()); + } + } + + private void addBody(final Request request) { + if (deleteSubUsersFromIpRequest != null) { + request.addBody(JsonUtil.toJson(deleteSubUsersFromIpRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/GetIp.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/GetIp.java new file mode 100644 index 00000000..e7d9e4c1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/GetIp.java @@ -0,0 +1,121 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement; + +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.ipaddressmanagement.models.GetIp200Response; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.IpAddressManagementErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetIp extends ApiKeyBase { + + @Setter + private Boolean includeRegion; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/send_ips/ips/{ip}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetIp 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")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.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(), GetIp200Response.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (includeRegion != null) { + request.addQueryParam("include_region", includeRegion.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/GetIpPool.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/GetIpPool.java new file mode 100644 index 00000000..2c702179 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/GetIpPool.java @@ -0,0 +1,123 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement; + +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.ipaddressmanagement.models.GetIpPool200Response; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.IpAddressManagementErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetIpPool extends ApiKeyBase { + + @Setter + private Boolean includeRegion; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/send_ips/pools/{poolid}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetIpPool 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")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.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(), GetIpPool200Response.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (includeRegion != null) { + request.addQueryParam("include_region", includeRegion.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/ListIp.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/ListIp.java new file mode 100644 index 00000000..fec102dd --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/ListIp.java @@ -0,0 +1,191 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement; + +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.ipaddressmanagement.models.IpAddressManagementErrorResponse; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.ListIp200Response; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.Region7; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListIp extends ApiKeyBase { + + @Setter + private String ip; + + @Setter + private Integer limit; + + @Setter + private Integer afterKey; + + @Setter + private String beforeKey; + + @Setter + private Boolean isLeased; + + @Setter + private Boolean isEnabled; + + @Setter + private Boolean isParentAssigned; + + @Setter + private String pool; + + @Setter + private Integer startAddedAt; + + @Setter + private Integer endAddedAt; + + @Setter + private Region7 region; + + @Setter + private Boolean includeRegion; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/send_ips/ips"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListIp 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")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.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(), ListIp200Response.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (ip != null) { + request.addQueryParam("ip", ip.toString()); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (afterKey != null) { + request.addQueryParam("after_key", afterKey.toString()); + } + if (beforeKey != null) { + request.addQueryParam("before_key", beforeKey.toString()); + } + if (isLeased != null) { + request.addQueryParam("is_leased", isLeased.toString()); + } + if (isEnabled != null) { + request.addQueryParam("is_enabled", isEnabled.toString()); + } + if (isParentAssigned != null) { + request.addQueryParam( + "is_parent_assigned", + isParentAssigned.toString() + ); + } + if (pool != null) { + request.addQueryParam("pool", pool.toString()); + } + if (startAddedAt != null) { + request.addQueryParam("start_added_at", startAddedAt.toString()); + } + if (endAddedAt != null) { + request.addQueryParam("end_added_at", endAddedAt.toString()); + } + if (region != null) { + request.addQueryParam("region", region.toString()); + } + if (includeRegion != null) { + request.addQueryParam("include_region", includeRegion.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/ListIpAssignedToIpPool.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/ListIpAssignedToIpPool.java new file mode 100644 index 00000000..1a24579a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/ListIpAssignedToIpPool.java @@ -0,0 +1,138 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement; + +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.ipaddressmanagement.models.IpAddressManagementErrorResponse; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.ListIpAssignedToIpPool200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListIpAssignedToIpPool extends ApiKeyBase { + + @Setter + private Integer limit; + + @Setter + private Integer afterKey; + + @Setter + private Boolean includeRegion; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/send_ips/pools/{poolid}/ips"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListIpAssignedToIpPool 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")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.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(), + ListIpAssignedToIpPool200Response.class + ), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (afterKey != null) { + request.addQueryParam("after_key", afterKey.toString()); + } + if (includeRegion != null) { + request.addQueryParam("include_region", includeRegion.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/ListIpPool.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/ListIpPool.java new file mode 100644 index 00000000..1765dde4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/ListIpPool.java @@ -0,0 +1,151 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement; + +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.ipaddressmanagement.models.IpAddressManagementErrorResponse; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.ListIpPool200Response; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.Region7; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListIpPool extends ApiKeyBase { + + @Setter + private Integer limit; + + @Setter + private Integer afterKey; + + @Setter + private String ip; + + @Setter + private Region7 region; + + @Setter + private Boolean includeRegion; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/send_ips/pools"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListIpPool 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")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.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(), + ListIpPool200Response.class + ), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (afterKey != null) { + request.addQueryParam("after_key", afterKey.toString()); + } + if (ip != null) { + request.addQueryParam("ip", ip.toString()); + } + if (region != null) { + request.addQueryParam("region", region.toString()); + } + if (includeRegion != null) { + request.addQueryParam("include_region", includeRegion.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/ListSubUserAssignedToIp.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/ListSubUserAssignedToIp.java new file mode 100644 index 00000000..dd7359e1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/ListSubUserAssignedToIp.java @@ -0,0 +1,132 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement; + +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.ipaddressmanagement.models.IpAddressManagementErrorResponse; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.ListSubUserAssignedToIp200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSubUserAssignedToIp extends ApiKeyBase { + + @Setter + private Integer afterKey; + + @Setter + private Integer limit; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/send_ips/ips/{ip}/subusers"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSubUserAssignedToIp 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")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.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(), + ListSubUserAssignedToIp200Response.class + ), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (afterKey != null) { + request.addQueryParam("after_key", afterKey.toString()); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/UpdateIp.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/UpdateIp.java new file mode 100644 index 00000000..98d054eb --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/UpdateIp.java @@ -0,0 +1,133 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement; + +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.ipaddressmanagement.models.IpAddressManagementErrorResponse; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.UpdateIp200Response; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.UpdateIpRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateIp extends ApiKeyBase { + + private final String ip; + + @Setter + private UpdateIpRequest updateIpRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/send_ips/ips/{ip}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateIp 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")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.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(), UpdateIp200Response.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (ip != null) { + request.addPathParam("ip", ip.toString()); + } + } + + private void addBody(final Request request) { + if (updateIpRequest != null) { + request.addBody(JsonUtil.toJson(updateIpRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/UpdateIpPool.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/UpdateIpPool.java new file mode 100644 index 00000000..462fc08a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/UpdateIpPool.java @@ -0,0 +1,136 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement; + +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.ipaddressmanagement.models.IpAddressManagementErrorResponse; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.UpdateIpPool200Response; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.UpdateIpPoolRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateIpPool extends ApiKeyBase { + + private final String poolid; + + @Setter + private UpdateIpPoolRequest updateIpPoolRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/send_ips/pools/{poolid}"; + Request request = new Request( + HttpMethod.PUT, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateIpPool 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")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + IpAddressManagementErrorResponse error = JsonUtil.fromJson( + response.getStream(), + IpAddressManagementErrorResponse.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(), + UpdateIpPool200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (poolid != null) { + request.addPathParam("poolid", poolid.toString()); + } + } + + private void addBody(final Request request) { + if (updateIpPoolRequest != null) { + request.addBody(JsonUtil.toJson(updateIpPoolRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddIp201Response.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddIp201Response.java new file mode 100644 index 00000000..7d13df0f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddIp201Response.java @@ -0,0 +1,125 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.Region2; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddIp201Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_auto_warmup") + @Getter + @Setter + private Boolean isAutoWarmup; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_parent_assigned") + @Getter + @Setter + private Boolean isParentAssigned; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subusers") + @Getter + @Setter + private List subusers; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("region") + @Getter + @Setter + private Region2 region; + + public AddIp201Response() {} + + private AddIp201Response(Builder builder) { + this.ip = builder.ip; + this.isAutoWarmup = builder.isAutoWarmup; + this.isParentAssigned = builder.isParentAssigned; + this.subusers = builder.subusers; + this.region = builder.region; + } + + // Builder class for constructing object + public static class Builder { + + private String ip; + private Boolean isAutoWarmup; + private Boolean isParentAssigned; + private List subusers; + private Region2 region; + + public Builder() {} + + public Builder ip(String ip) { + this.ip = ip; + return this; + } + + public Builder isAutoWarmup(Boolean isAutoWarmup) { + this.isAutoWarmup = isAutoWarmup; + return this; + } + + public Builder isParentAssigned(Boolean isParentAssigned) { + this.isParentAssigned = isParentAssigned; + return this; + } + + public Builder subusers(List subusers) { + this.subusers = subusers; + return this; + } + + public Builder region(Region2 region) { + this.region = region; + return this; + } + + public AddIp201Response build() { + return new AddIp201Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddIp201Response.class.getSimpleName() + "(", + ")" + ); + if (ip != null) joiner.add("ip=" + ip); + if (isAutoWarmup != null) joiner.add("isAutoWarmup=" + isAutoWarmup); + if (isParentAssigned != null) joiner.add( + "isParentAssigned=" + isParentAssigned + ); + if (subusers != null) joiner.add("subusers=" + subusers); + if (region != null) joiner.add("region=" + region); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddIpRequest.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddIpRequest.java new file mode 100644 index 00000000..1a2e6c1d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddIpRequest.java @@ -0,0 +1,118 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.Region3; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddIpRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_auto_warmup") + @Getter + @Setter + private Boolean isAutoWarmup; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_parent_assigned") + @Getter + @Setter + private Boolean isParentAssigned; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subusers") + @Getter + @Setter + private List subusers; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("region") + @Getter + @Setter + private Region3 region; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("include_region") + @Getter + @Setter + private Boolean includeRegion; + + public AddIpRequest() {} + + private AddIpRequest(Builder builder) { + this.isAutoWarmup = builder.isAutoWarmup; + this.isParentAssigned = builder.isParentAssigned; + this.subusers = builder.subusers; + this.region = builder.region; + this.includeRegion = builder.includeRegion; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean isAutoWarmup; + private Boolean isParentAssigned; + private List subusers; + private Region3 region; + private Boolean includeRegion; + + public Builder(Boolean isAutoWarmup, Boolean isParentAssigned) { + this.isAutoWarmup = isAutoWarmup; + this.isParentAssigned = isParentAssigned; + } + + public Builder subusers(List subusers) { + this.subusers = subusers; + return this; + } + + public Builder region(Region3 region) { + this.region = region; + return this; + } + + public Builder includeRegion(Boolean includeRegion) { + this.includeRegion = includeRegion; + return this; + } + + public AddIpRequest build() { + return new AddIpRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddIpRequest.class.getSimpleName() + "(", + ")" + ); + if (isAutoWarmup != null) joiner.add("isAutoWarmup=" + isAutoWarmup); + if (isParentAssigned != null) joiner.add( + "isParentAssigned=" + isParentAssigned + ); + if (subusers != null) joiner.add("subusers=" + subusers); + if (region != null) joiner.add("region=" + region); + if (includeRegion != null) joiner.add("includeRegion=" + includeRegion); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddIpsToIpPool200Response.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddIpsToIpPool200Response.java new file mode 100644 index 00000000..b8c38291 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddIpsToIpPool200Response.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddIpsToIpPool200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ips") + @Getter + @Setter + private List ips; + + public AddIpsToIpPool200Response() {} + + private AddIpsToIpPool200Response(Builder builder) { + this.name = builder.name; + this.id = builder.id; + this.ips = builder.ips; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private String id; + private List ips; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder ips(List ips) { + this.ips = ips; + return this; + } + + public AddIpsToIpPool200Response build() { + return new AddIpsToIpPool200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddIpsToIpPool200Response.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (id != null) joiner.add("id=" + id); + if (ips != null) joiner.add("ips=" + ips); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddIpsToIpPoolRequest.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddIpsToIpPoolRequest.java new file mode 100644 index 00000000..f92c56e4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddIpsToIpPoolRequest.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddIpsToIpPoolRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ips") + @Getter + @Setter + private List ips; + + public AddIpsToIpPoolRequest() {} + + private AddIpsToIpPoolRequest(Builder builder) { + this.ips = builder.ips; + } + + // Builder class for constructing object + public static class Builder { + + private List ips; + + public Builder(List ips) { + this.ips = ips; + } + + public AddIpsToIpPoolRequest build() { + return new AddIpsToIpPoolRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddIpsToIpPoolRequest.class.getSimpleName() + "(", + ")" + ); + if (ips != null) joiner.add("ips=" + ips); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddSubUsersToIp200Response.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddSubUsersToIp200Response.java new file mode 100644 index 00000000..55fd9796 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddSubUsersToIp200Response.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddSubUsersToIp200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subusers") + @Getter + @Setter + private List subusers; + + public AddSubUsersToIp200Response() {} + + private AddSubUsersToIp200Response(Builder builder) { + this.ip = builder.ip; + this.subusers = builder.subusers; + } + + // Builder class for constructing object + public static class Builder { + + private String ip; + private List subusers; + + public Builder() {} + + public Builder ip(String ip) { + this.ip = ip; + return this; + } + + public Builder subusers(List subusers) { + this.subusers = subusers; + return this; + } + + public AddSubUsersToIp200Response build() { + return new AddSubUsersToIp200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddSubUsersToIp200Response.class.getSimpleName() + "(", + ")" + ); + if (ip != null) joiner.add("ip=" + ip); + if (subusers != null) joiner.add("subusers=" + subusers); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddSubUsersToIpRequest.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddSubUsersToIpRequest.java new file mode 100644 index 00000000..a9c788ee --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/AddSubUsersToIpRequest.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddSubUsersToIpRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subusers") + @Getter + @Setter + private List subusers; + + public AddSubUsersToIpRequest() {} + + private AddSubUsersToIpRequest(Builder builder) { + this.subusers = builder.subusers; + } + + // Builder class for constructing object + public static class Builder { + + private List subusers; + + public Builder(List subusers) { + this.subusers = subusers; + } + + public AddSubUsersToIpRequest build() { + return new AddSubUsersToIpRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddSubUsersToIpRequest.class.getSimpleName() + "(", + ")" + ); + if (subusers != null) joiner.add("subusers=" + subusers); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/CreateIpPool201Response.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/CreateIpPool201Response.java new file mode 100644 index 00000000..57638372 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/CreateIpPool201Response.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateIpPool201Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ips") + @Getter + @Setter + private List ips; + + public CreateIpPool201Response() {} + + private CreateIpPool201Response(Builder builder) { + this.name = builder.name; + this.id = builder.id; + this.ips = builder.ips; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private String id; + private List ips; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder ips(List ips) { + this.ips = ips; + return this; + } + + public CreateIpPool201Response build() { + return new CreateIpPool201Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateIpPool201Response.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (id != null) joiner.add("id=" + id); + if (ips != null) joiner.add("ips=" + ips); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/CreateIpPoolRequest.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/CreateIpPoolRequest.java new file mode 100644 index 00000000..2707a72b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/CreateIpPoolRequest.java @@ -0,0 +1,77 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateIpPoolRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ips") + @Getter + @Setter + private List ips; + + public CreateIpPoolRequest() {} + + private CreateIpPoolRequest(Builder builder) { + this.name = builder.name; + this.ips = builder.ips; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private List ips; + + public Builder(String name) { + this.name = name; + } + + public Builder ips(List ips) { + this.ips = ips; + return this; + } + + public CreateIpPoolRequest build() { + return new CreateIpPoolRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateIpPoolRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (ips != null) joiner.add("ips=" + ips); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/DeleteIpsFromIpPoolRequest.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/DeleteIpsFromIpPoolRequest.java new file mode 100644 index 00000000..9283229f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/DeleteIpsFromIpPoolRequest.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteIpsFromIpPoolRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ips") + @Getter + @Setter + private List ips; + + public DeleteIpsFromIpPoolRequest() {} + + private DeleteIpsFromIpPoolRequest(Builder builder) { + this.ips = builder.ips; + } + + // Builder class for constructing object + public static class Builder { + + private List ips; + + public Builder(List ips) { + this.ips = ips; + } + + public DeleteIpsFromIpPoolRequest build() { + return new DeleteIpsFromIpPoolRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteIpsFromIpPoolRequest.class.getSimpleName() + "(", + ")" + ); + if (ips != null) joiner.add("ips=" + ips); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/DeleteSubUsersFromIpRequest.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/DeleteSubUsersFromIpRequest.java new file mode 100644 index 00000000..ac6808fb --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/DeleteSubUsersFromIpRequest.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteSubUsersFromIpRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subusers") + @Getter + @Setter + private List subusers; + + public DeleteSubUsersFromIpRequest() {} + + private DeleteSubUsersFromIpRequest(Builder builder) { + this.subusers = builder.subusers; + } + + // Builder class for constructing object + public static class Builder { + + private List subusers; + + public Builder(List subusers) { + this.subusers = subusers; + } + + public DeleteSubUsersFromIpRequest build() { + return new DeleteSubUsersFromIpRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteSubUsersFromIpRequest.class.getSimpleName() + "(", + ")" + ); + if (subusers != null) joiner.add("subusers=" + subusers); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/GetIp200Response.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/GetIp200Response.java new file mode 100644 index 00000000..36709585 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/GetIp200Response.java @@ -0,0 +1,181 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.GetIp200ResponsePoolsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetIp200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_parent_assigned") + @Getter + @Setter + private Boolean isParentAssigned; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_auto_warmup") + @Getter + @Setter + private Boolean isAutoWarmup; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("pools") + @Getter + @Setter + private List pools; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("added_at") + @Getter + @Setter + private Integer addedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private Integer updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_enabled") + @Getter + @Setter + private Boolean isEnabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_leased") + @Getter + @Setter + private Boolean isLeased; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("region") + @Getter + @Setter + private String region; + + public GetIp200Response() {} + + private GetIp200Response(Builder builder) { + this.ip = builder.ip; + this.isParentAssigned = builder.isParentAssigned; + this.isAutoWarmup = builder.isAutoWarmup; + this.pools = builder.pools; + this.addedAt = builder.addedAt; + this.updatedAt = builder.updatedAt; + this.isEnabled = builder.isEnabled; + this.isLeased = builder.isLeased; + this.region = builder.region; + } + + // Builder class for constructing object + public static class Builder { + + private String ip; + private Boolean isParentAssigned; + private Boolean isAutoWarmup; + private List pools; + private Integer addedAt; + private Integer updatedAt; + private Boolean isEnabled; + private Boolean isLeased; + private String region; + + public Builder() {} + + public Builder ip(String ip) { + this.ip = ip; + return this; + } + + public Builder isParentAssigned(Boolean isParentAssigned) { + this.isParentAssigned = isParentAssigned; + return this; + } + + public Builder isAutoWarmup(Boolean isAutoWarmup) { + this.isAutoWarmup = isAutoWarmup; + return this; + } + + public Builder pools(List pools) { + this.pools = pools; + return this; + } + + public Builder addedAt(Integer addedAt) { + this.addedAt = addedAt; + return this; + } + + public Builder updatedAt(Integer updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder isEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + public Builder isLeased(Boolean isLeased) { + this.isLeased = isLeased; + return this; + } + + public Builder region(String region) { + this.region = region; + return this; + } + + public GetIp200Response build() { + return new GetIp200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetIp200Response.class.getSimpleName() + "(", + ")" + ); + if (ip != null) joiner.add("ip=" + ip); + if (isParentAssigned != null) joiner.add( + "isParentAssigned=" + isParentAssigned + ); + if (isAutoWarmup != null) joiner.add("isAutoWarmup=" + isAutoWarmup); + if (pools != null) joiner.add("pools=" + pools); + if (addedAt != null) joiner.add("addedAt=" + addedAt); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (isEnabled != null) joiner.add("isEnabled=" + isEnabled); + if (isLeased != null) joiner.add("isLeased=" + isLeased); + if (region != null) joiner.add("region=" + region); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/GetIp200ResponsePoolsInner.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/GetIp200ResponsePoolsInner.java new file mode 100644 index 00000000..a8a324d7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/GetIp200ResponsePoolsInner.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetIp200ResponsePoolsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public GetIp200ResponsePoolsInner() {} + + private GetIp200ResponsePoolsInner(Builder builder) { + this.id = builder.id; + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String id; + private String name; + + public Builder() {} + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public GetIp200ResponsePoolsInner build() { + return new GetIp200ResponsePoolsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetIp200ResponsePoolsInner.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/GetIpPool200Response.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/GetIpPool200Response.java new file mode 100644 index 00000000..772ec5aa --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/GetIpPool200Response.java @@ -0,0 +1,127 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.GetIpPool200ResponseIpCountByRegionInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetIpPool200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ips_preview") + @Getter + @Setter + private List ipsPreview; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("total_ip_count") + @Getter + @Setter + private Integer totalIpCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip_count_by_region") + @Getter + @Setter + private List ipCountByRegion; + + public GetIpPool200Response() {} + + private GetIpPool200Response(Builder builder) { + this.name = builder.name; + this.id = builder.id; + this.ipsPreview = builder.ipsPreview; + this.totalIpCount = builder.totalIpCount; + this.ipCountByRegion = builder.ipCountByRegion; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private String id; + private List ipsPreview; + private Integer totalIpCount; + private List ipCountByRegion; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder ipsPreview(List ipsPreview) { + this.ipsPreview = ipsPreview; + return this; + } + + public Builder totalIpCount(Integer totalIpCount) { + this.totalIpCount = totalIpCount; + return this; + } + + public Builder ipCountByRegion( + List ipCountByRegion + ) { + this.ipCountByRegion = ipCountByRegion; + return this; + } + + public GetIpPool200Response build() { + return new GetIpPool200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetIpPool200Response.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (id != null) joiner.add("id=" + id); + if (ipsPreview != null) joiner.add("ipsPreview=" + ipsPreview); + if (totalIpCount != null) joiner.add("totalIpCount=" + totalIpCount); + if (ipCountByRegion != null) joiner.add( + "ipCountByRegion=" + ipCountByRegion + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/GetIpPool200ResponseIpCountByRegionInner.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/GetIpPool200ResponseIpCountByRegionInner.java new file mode 100644 index 00000000..ed520220 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/GetIpPool200ResponseIpCountByRegionInner.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.Region5; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetIpPool200ResponseIpCountByRegionInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("region") + @Getter + @Setter + private Region5 region; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("count") + @Getter + @Setter + private Integer count; + + public GetIpPool200ResponseIpCountByRegionInner() {} + + private GetIpPool200ResponseIpCountByRegionInner(Builder builder) { + this.region = builder.region; + this.count = builder.count; + } + + // Builder class for constructing object + public static class Builder { + + private Region5 region; + private Integer count; + + public Builder() {} + + public Builder region(Region5 region) { + this.region = region; + return this; + } + + public Builder count(Integer count) { + this.count = count; + return this; + } + + public GetIpPool200ResponseIpCountByRegionInner build() { + return new GetIpPool200ResponseIpCountByRegionInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetIpPool200ResponseIpCountByRegionInner.class.getSimpleName() + + "(", + ")" + ); + if (region != null) joiner.add("region=" + region); + if (count != null) joiner.add("count=" + count); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/IpAddressManagementErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/IpAddressManagementErrorResponse.java new file mode 100644 index 00000000..c2d02903 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/IpAddressManagementErrorResponse.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.IpAddressManagementErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class IpAddressManagementErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public IpAddressManagementErrorResponse() {} + + private IpAddressManagementErrorResponse(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors( + List errors + ) { + this.errors = errors; + return this; + } + + public IpAddressManagementErrorResponse build() { + return new IpAddressManagementErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + IpAddressManagementErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/IpAddressManagementErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/IpAddressManagementErrorResponseErrorsInner.java new file mode 100644 index 00000000..42748337 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/IpAddressManagementErrorResponseErrorsInner.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class IpAddressManagementErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public IpAddressManagementErrorResponseErrorsInner() {} + + private IpAddressManagementErrorResponseErrorsInner(Builder builder) { + this.field = builder.field; + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String field; + private String message; + + public Builder() {} + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public IpAddressManagementErrorResponseErrorsInner build() { + return new IpAddressManagementErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + IpAddressManagementErrorResponseErrorsInner.class.getSimpleName() + + "(", + ")" + ); + if (field != null) joiner.add("field=" + field); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Items.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Items.java new file mode 100644 index 00000000..a70adf5f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Items.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Items { + EU("eu"), + + US("us"); + + private final String value; + + private Items(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Items forValue(final String value) { + return Promoter.enumFromString(value, Items.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIp200Response.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIp200Response.java new file mode 100644 index 00000000..10145199 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIp200Response.java @@ -0,0 +1,82 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.ListIp200ResponseMetadata; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.ListIp200ResponseResultInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListIp200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private ListIp200ResponseMetadata metadata; + + public ListIp200Response() {} + + private ListIp200Response(Builder builder) { + this.result = builder.result; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + private ListIp200ResponseMetadata metadata; + + public Builder() {} + + public Builder result(List result) { + this.result = result; + return this; + } + + public Builder metadata(ListIp200ResponseMetadata metadata) { + this.metadata = metadata; + return this; + } + + public ListIp200Response build() { + return new ListIp200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListIp200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIp200ResponseMetadata.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIp200ResponseMetadata.java new file mode 100644 index 00000000..7552d9f5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIp200ResponseMetadata.java @@ -0,0 +1,68 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.ListIp200ResponseMetadataNextParams; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListIp200ResponseMetadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next_params") + @Getter + @Setter + private ListIp200ResponseMetadataNextParams nextParams; + + public ListIp200ResponseMetadata() {} + + private ListIp200ResponseMetadata(Builder builder) { + this.nextParams = builder.nextParams; + } + + // Builder class for constructing object + public static class Builder { + + private ListIp200ResponseMetadataNextParams nextParams; + + public Builder() {} + + public Builder nextParams( + ListIp200ResponseMetadataNextParams nextParams + ) { + this.nextParams = nextParams; + return this; + } + + public ListIp200ResponseMetadata build() { + return new ListIp200ResponseMetadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListIp200ResponseMetadata.class.getSimpleName() + "(", + ")" + ); + if (nextParams != null) joiner.add("nextParams=" + nextParams); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIp200ResponseMetadataNextParams.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIp200ResponseMetadataNextParams.java new file mode 100644 index 00000000..0b0a2dd5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIp200ResponseMetadataNextParams.java @@ -0,0 +1,222 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.Region1; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListIp200ResponseMetadataNextParams { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("after_key") + @Getter + @Setter + private String afterKey; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("before_key") + @Getter + @Setter + private String beforeKey; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_leased") + @Getter + @Setter + private Boolean isLeased; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_enabled") + @Getter + @Setter + private Boolean isEnabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_parent_assigned") + @Getter + @Setter + private Boolean isParentAssigned; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("pool") + @Getter + @Setter + private String pool; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("start_added_at") + @Getter + @Setter + private String startAddedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("end_added_at") + @Getter + @Setter + private String endAddedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("limit") + @Getter + @Setter + private String limit; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("region") + @Getter + @Setter + private Region1 region; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("include_region") + @Getter + @Setter + private String includeRegion; + + public ListIp200ResponseMetadataNextParams() {} + + private ListIp200ResponseMetadataNextParams(Builder builder) { + this.afterKey = builder.afterKey; + this.beforeKey = builder.beforeKey; + this.ip = builder.ip; + this.isLeased = builder.isLeased; + this.isEnabled = builder.isEnabled; + this.isParentAssigned = builder.isParentAssigned; + this.pool = builder.pool; + this.startAddedAt = builder.startAddedAt; + this.endAddedAt = builder.endAddedAt; + this.limit = builder.limit; + this.region = builder.region; + this.includeRegion = builder.includeRegion; + } + + // Builder class for constructing object + public static class Builder { + + private String afterKey; + private String beforeKey; + private String ip; + private Boolean isLeased; + private Boolean isEnabled; + private Boolean isParentAssigned; + private String pool; + private String startAddedAt; + private String endAddedAt; + private String limit; + private Region1 region; + private String includeRegion; + + public Builder() {} + + public Builder afterKey(String afterKey) { + this.afterKey = afterKey; + return this; + } + + public Builder beforeKey(String beforeKey) { + this.beforeKey = beforeKey; + return this; + } + + public Builder ip(String ip) { + this.ip = ip; + return this; + } + + public Builder isLeased(Boolean isLeased) { + this.isLeased = isLeased; + return this; + } + + public Builder isEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + public Builder isParentAssigned(Boolean isParentAssigned) { + this.isParentAssigned = isParentAssigned; + return this; + } + + public Builder pool(String pool) { + this.pool = pool; + return this; + } + + public Builder startAddedAt(String startAddedAt) { + this.startAddedAt = startAddedAt; + return this; + } + + public Builder endAddedAt(String endAddedAt) { + this.endAddedAt = endAddedAt; + return this; + } + + public Builder limit(String limit) { + this.limit = limit; + return this; + } + + public Builder region(Region1 region) { + this.region = region; + return this; + } + + public Builder includeRegion(String includeRegion) { + this.includeRegion = includeRegion; + return this; + } + + public ListIp200ResponseMetadataNextParams build() { + return new ListIp200ResponseMetadataNextParams(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListIp200ResponseMetadataNextParams.class.getSimpleName() + "(", + ")" + ); + if (afterKey != null) joiner.add("afterKey=" + afterKey); + if (beforeKey != null) joiner.add("beforeKey=" + beforeKey); + if (ip != null) joiner.add("ip=" + ip); + if (isLeased != null) joiner.add("isLeased=" + isLeased); + if (isEnabled != null) joiner.add("isEnabled=" + isEnabled); + if (isParentAssigned != null) joiner.add( + "isParentAssigned=" + isParentAssigned + ); + if (pool != null) joiner.add("pool=" + pool); + if (startAddedAt != null) joiner.add("startAddedAt=" + startAddedAt); + if (endAddedAt != null) joiner.add("endAddedAt=" + endAddedAt); + if (limit != null) joiner.add("limit=" + limit); + if (region != null) joiner.add("region=" + region); + if (includeRegion != null) joiner.add("includeRegion=" + includeRegion); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIp200ResponseResultInner.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIp200ResponseResultInner.java new file mode 100644 index 00000000..7c638e16 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIp200ResponseResultInner.java @@ -0,0 +1,184 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.ListIp200ResponseResultInnerPoolsInner; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.Region; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListIp200ResponseResultInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("pools") + @Getter + @Setter + private List pools; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_auto_warmup") + @Getter + @Setter + private Boolean isAutoWarmup; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_parent_assigned") + @Getter + @Setter + private Boolean isParentAssigned; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private Integer updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_enabled") + @Getter + @Setter + private Boolean isEnabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_leased") + @Getter + @Setter + private Boolean isLeased; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("added_at") + @Getter + @Setter + private Integer addedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("region") + @Getter + @Setter + private Region region; + + public ListIp200ResponseResultInner() {} + + private ListIp200ResponseResultInner(Builder builder) { + this.ip = builder.ip; + this.pools = builder.pools; + this.isAutoWarmup = builder.isAutoWarmup; + this.isParentAssigned = builder.isParentAssigned; + this.updatedAt = builder.updatedAt; + this.isEnabled = builder.isEnabled; + this.isLeased = builder.isLeased; + this.addedAt = builder.addedAt; + this.region = builder.region; + } + + // Builder class for constructing object + public static class Builder { + + private String ip; + private List pools; + private Boolean isAutoWarmup; + private Boolean isParentAssigned; + private Integer updatedAt; + private Boolean isEnabled; + private Boolean isLeased; + private Integer addedAt; + private Region region; + + public Builder() {} + + public Builder ip(String ip) { + this.ip = ip; + return this; + } + + public Builder pools( + List pools + ) { + this.pools = pools; + return this; + } + + public Builder isAutoWarmup(Boolean isAutoWarmup) { + this.isAutoWarmup = isAutoWarmup; + return this; + } + + public Builder isParentAssigned(Boolean isParentAssigned) { + this.isParentAssigned = isParentAssigned; + return this; + } + + public Builder updatedAt(Integer updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder isEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + public Builder isLeased(Boolean isLeased) { + this.isLeased = isLeased; + return this; + } + + public Builder addedAt(Integer addedAt) { + this.addedAt = addedAt; + return this; + } + + public Builder region(Region region) { + this.region = region; + return this; + } + + public ListIp200ResponseResultInner build() { + return new ListIp200ResponseResultInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListIp200ResponseResultInner.class.getSimpleName() + "(", + ")" + ); + if (ip != null) joiner.add("ip=" + ip); + if (pools != null) joiner.add("pools=" + pools); + if (isAutoWarmup != null) joiner.add("isAutoWarmup=" + isAutoWarmup); + if (isParentAssigned != null) joiner.add( + "isParentAssigned=" + isParentAssigned + ); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (isEnabled != null) joiner.add("isEnabled=" + isEnabled); + if (isLeased != null) joiner.add("isLeased=" + isLeased); + if (addedAt != null) joiner.add("addedAt=" + addedAt); + if (region != null) joiner.add("region=" + region); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIp200ResponseResultInnerPoolsInner.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIp200ResponseResultInnerPoolsInner.java new file mode 100644 index 00000000..1510eed0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIp200ResponseResultInnerPoolsInner.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListIp200ResponseResultInnerPoolsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ListIp200ResponseResultInnerPoolsInner() {} + + private ListIp200ResponseResultInnerPoolsInner(Builder builder) { + this.name = builder.name; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private String id; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ListIp200ResponseResultInnerPoolsInner build() { + return new ListIp200ResponseResultInnerPoolsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListIp200ResponseResultInnerPoolsInner.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpAssignedToIpPool200Response.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpAssignedToIpPool200Response.java new file mode 100644 index 00000000..070e9d34 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpAssignedToIpPool200Response.java @@ -0,0 +1,86 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.ListIpAssignedToIpPool200ResponseMetadata; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.ListIpAssignedToIpPool200ResponseResultInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListIpAssignedToIpPool200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private ListIpAssignedToIpPool200ResponseMetadata metadata; + + public ListIpAssignedToIpPool200Response() {} + + private ListIpAssignedToIpPool200Response(Builder builder) { + this.result = builder.result; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + private ListIpAssignedToIpPool200ResponseMetadata metadata; + + public Builder() {} + + public Builder result( + List result + ) { + this.result = result; + return this; + } + + public Builder metadata( + ListIpAssignedToIpPool200ResponseMetadata metadata + ) { + this.metadata = metadata; + return this; + } + + public ListIpAssignedToIpPool200Response build() { + return new ListIpAssignedToIpPool200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListIpAssignedToIpPool200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpAssignedToIpPool200ResponseMetadata.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpAssignedToIpPool200ResponseMetadata.java new file mode 100644 index 00000000..60f802f8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpAssignedToIpPool200ResponseMetadata.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.ListIpAssignedToIpPool200ResponseMetadataNextParams; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListIpAssignedToIpPool200ResponseMetadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next_params") + @Getter + @Setter + private ListIpAssignedToIpPool200ResponseMetadataNextParams nextParams; + + public ListIpAssignedToIpPool200ResponseMetadata() {} + + private ListIpAssignedToIpPool200ResponseMetadata(Builder builder) { + this.nextParams = builder.nextParams; + } + + // Builder class for constructing object + public static class Builder { + + private ListIpAssignedToIpPool200ResponseMetadataNextParams nextParams; + + public Builder() {} + + public Builder nextParams( + ListIpAssignedToIpPool200ResponseMetadataNextParams nextParams + ) { + this.nextParams = nextParams; + return this; + } + + public ListIpAssignedToIpPool200ResponseMetadata build() { + return new ListIpAssignedToIpPool200ResponseMetadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListIpAssignedToIpPool200ResponseMetadata.class.getSimpleName() + + "(", + ")" + ); + if (nextParams != null) joiner.add("nextParams=" + nextParams); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpAssignedToIpPool200ResponseMetadataNextParams.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpAssignedToIpPool200ResponseMetadataNextParams.java new file mode 100644 index 00000000..e399e873 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpAssignedToIpPool200ResponseMetadataNextParams.java @@ -0,0 +1,98 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListIpAssignedToIpPool200ResponseMetadataNextParams { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("after_key") + @Getter + @Setter + private String afterKey; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("limit") + @Getter + @Setter + private String limit; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("include_region") + @Getter + @Setter + private String includeRegion; + + public ListIpAssignedToIpPool200ResponseMetadataNextParams() {} + + private ListIpAssignedToIpPool200ResponseMetadataNextParams( + Builder builder + ) { + this.afterKey = builder.afterKey; + this.limit = builder.limit; + this.includeRegion = builder.includeRegion; + } + + // Builder class for constructing object + public static class Builder { + + private String afterKey; + private String limit; + private String includeRegion; + + public Builder() {} + + public Builder afterKey(String afterKey) { + this.afterKey = afterKey; + return this; + } + + public Builder limit(String limit) { + this.limit = limit; + return this; + } + + public Builder includeRegion(String includeRegion) { + this.includeRegion = includeRegion; + return this; + } + + public ListIpAssignedToIpPool200ResponseMetadataNextParams build() { + return new ListIpAssignedToIpPool200ResponseMetadataNextParams( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListIpAssignedToIpPool200ResponseMetadataNextParams.class.getSimpleName() + + "(", + ")" + ); + if (afterKey != null) joiner.add("afterKey=" + afterKey); + if (limit != null) joiner.add("limit=" + limit); + if (includeRegion != null) joiner.add("includeRegion=" + includeRegion); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpAssignedToIpPool200ResponseResultInner.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpAssignedToIpPool200ResponseResultInner.java new file mode 100644 index 00000000..a6b17875 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpAssignedToIpPool200ResponseResultInner.java @@ -0,0 +1,99 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.ListIp200ResponseResultInnerPoolsInner; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.Region6; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListIpAssignedToIpPool200ResponseResultInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("region") + @Getter + @Setter + private Region6 region; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("pools") + @Getter + @Setter + private List pools; + + public ListIpAssignedToIpPool200ResponseResultInner() {} + + private ListIpAssignedToIpPool200ResponseResultInner(Builder builder) { + this.ip = builder.ip; + this.region = builder.region; + this.pools = builder.pools; + } + + // Builder class for constructing object + public static class Builder { + + private String ip; + private Region6 region; + private List pools; + + public Builder() {} + + public Builder ip(String ip) { + this.ip = ip; + return this; + } + + public Builder region(Region6 region) { + this.region = region; + return this; + } + + public Builder pools( + List pools + ) { + this.pools = pools; + return this; + } + + public ListIpAssignedToIpPool200ResponseResultInner build() { + return new ListIpAssignedToIpPool200ResponseResultInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListIpAssignedToIpPool200ResponseResultInner.class.getSimpleName() + + "(", + ")" + ); + if (ip != null) joiner.add("ip=" + ip); + if (region != null) joiner.add("region=" + region); + if (pools != null) joiner.add("pools=" + pools); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpPool200Response.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpPool200Response.java new file mode 100644 index 00000000..7e489c3e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpPool200Response.java @@ -0,0 +1,82 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.ListIpPool200ResponseMetadata; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.ListIpPool200ResponseResultInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListIpPool200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private ListIpPool200ResponseMetadata metadata; + + public ListIpPool200Response() {} + + private ListIpPool200Response(Builder builder) { + this.result = builder.result; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + private ListIpPool200ResponseMetadata metadata; + + public Builder() {} + + public Builder result(List result) { + this.result = result; + return this; + } + + public Builder metadata(ListIpPool200ResponseMetadata metadata) { + this.metadata = metadata; + return this; + } + + public ListIpPool200Response build() { + return new ListIpPool200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListIpPool200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpPool200ResponseMetadata.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpPool200ResponseMetadata.java new file mode 100644 index 00000000..c247b147 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpPool200ResponseMetadata.java @@ -0,0 +1,68 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.ListIpPool200ResponseMetadataNextParams; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListIpPool200ResponseMetadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next_params") + @Getter + @Setter + private ListIpPool200ResponseMetadataNextParams nextParams; + + public ListIpPool200ResponseMetadata() {} + + private ListIpPool200ResponseMetadata(Builder builder) { + this.nextParams = builder.nextParams; + } + + // Builder class for constructing object + public static class Builder { + + private ListIpPool200ResponseMetadataNextParams nextParams; + + public Builder() {} + + public Builder nextParams( + ListIpPool200ResponseMetadataNextParams nextParams + ) { + this.nextParams = nextParams; + return this; + } + + public ListIpPool200ResponseMetadata build() { + return new ListIpPool200ResponseMetadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListIpPool200ResponseMetadata.class.getSimpleName() + "(", + ")" + ); + if (nextParams != null) joiner.add("nextParams=" + nextParams); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpPool200ResponseMetadataNextParams.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpPool200ResponseMetadataNextParams.java new file mode 100644 index 00000000..6855b071 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpPool200ResponseMetadataNextParams.java @@ -0,0 +1,122 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.Region4; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListIpPool200ResponseMetadataNextParams { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("after_key") + @Getter + @Setter + private String afterKey; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("limit") + @Getter + @Setter + private String limit; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("region") + @Getter + @Setter + private Region4 region; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("include_region") + @Getter + @Setter + private String includeRegion; + + public ListIpPool200ResponseMetadataNextParams() {} + + private ListIpPool200ResponseMetadataNextParams(Builder builder) { + this.afterKey = builder.afterKey; + this.ip = builder.ip; + this.limit = builder.limit; + this.region = builder.region; + this.includeRegion = builder.includeRegion; + } + + // Builder class for constructing object + public static class Builder { + + private String afterKey; + private String ip; + private String limit; + private Region4 region; + private String includeRegion; + + public Builder() {} + + public Builder afterKey(String afterKey) { + this.afterKey = afterKey; + return this; + } + + public Builder ip(String ip) { + this.ip = ip; + return this; + } + + public Builder limit(String limit) { + this.limit = limit; + return this; + } + + public Builder region(Region4 region) { + this.region = region; + return this; + } + + public Builder includeRegion(String includeRegion) { + this.includeRegion = includeRegion; + return this; + } + + public ListIpPool200ResponseMetadataNextParams build() { + return new ListIpPool200ResponseMetadataNextParams(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListIpPool200ResponseMetadataNextParams.class.getSimpleName() + "(", + ")" + ); + if (afterKey != null) joiner.add("afterKey=" + afterKey); + if (ip != null) joiner.add("ip=" + ip); + if (limit != null) joiner.add("limit=" + limit); + if (region != null) joiner.add("region=" + region); + if (includeRegion != null) joiner.add("includeRegion=" + includeRegion); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpPool200ResponseResultInner.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpPool200ResponseResultInner.java new file mode 100644 index 00000000..5dd2d8c3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListIpPool200ResponseResultInner.java @@ -0,0 +1,123 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.Items; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListIpPool200ResponseResultInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("regions") + @Getter + @Setter + private List regions; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ips_preview") + @Getter + @Setter + private List ipsPreview; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("total_ip_count") + @Getter + @Setter + private Integer totalIpCount; + + public ListIpPool200ResponseResultInner() {} + + private ListIpPool200ResponseResultInner(Builder builder) { + this.name = builder.name; + this.id = builder.id; + this.regions = builder.regions; + this.ipsPreview = builder.ipsPreview; + this.totalIpCount = builder.totalIpCount; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private String id; + private List regions; + private List ipsPreview; + private Integer totalIpCount; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder regions(List regions) { + this.regions = regions; + return this; + } + + public Builder ipsPreview(List ipsPreview) { + this.ipsPreview = ipsPreview; + return this; + } + + public Builder totalIpCount(Integer totalIpCount) { + this.totalIpCount = totalIpCount; + return this; + } + + public ListIpPool200ResponseResultInner build() { + return new ListIpPool200ResponseResultInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListIpPool200ResponseResultInner.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (id != null) joiner.add("id=" + id); + if (regions != null) joiner.add("regions=" + regions); + if (ipsPreview != null) joiner.add("ipsPreview=" + ipsPreview); + if (totalIpCount != null) joiner.add("totalIpCount=" + totalIpCount); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListSubUserAssignedToIp200Response.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListSubUserAssignedToIp200Response.java new file mode 100644 index 00000000..ab95f357 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListSubUserAssignedToIp200Response.java @@ -0,0 +1,83 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.ListSubUserAssignedToIp200ResponseMetadata; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListSubUserAssignedToIp200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private ListSubUserAssignedToIp200ResponseMetadata metadata; + + public ListSubUserAssignedToIp200Response() {} + + private ListSubUserAssignedToIp200Response(Builder builder) { + this.result = builder.result; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + private ListSubUserAssignedToIp200ResponseMetadata metadata; + + public Builder() {} + + public Builder result(List result) { + this.result = result; + return this; + } + + public Builder metadata( + ListSubUserAssignedToIp200ResponseMetadata metadata + ) { + this.metadata = metadata; + return this; + } + + public ListSubUserAssignedToIp200Response build() { + return new ListSubUserAssignedToIp200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListSubUserAssignedToIp200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListSubUserAssignedToIp200ResponseMetadata.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListSubUserAssignedToIp200ResponseMetadata.java new file mode 100644 index 00000000..384210a5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListSubUserAssignedToIp200ResponseMetadata.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipaddressmanagement.models.ListSubUserAssignedToIp200ResponseMetadataNextParams; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListSubUserAssignedToIp200ResponseMetadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next_params") + @Getter + @Setter + private ListSubUserAssignedToIp200ResponseMetadataNextParams nextParams; + + public ListSubUserAssignedToIp200ResponseMetadata() {} + + private ListSubUserAssignedToIp200ResponseMetadata(Builder builder) { + this.nextParams = builder.nextParams; + } + + // Builder class for constructing object + public static class Builder { + + private ListSubUserAssignedToIp200ResponseMetadataNextParams nextParams; + + public Builder() {} + + public Builder nextParams( + ListSubUserAssignedToIp200ResponseMetadataNextParams nextParams + ) { + this.nextParams = nextParams; + return this; + } + + public ListSubUserAssignedToIp200ResponseMetadata build() { + return new ListSubUserAssignedToIp200ResponseMetadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListSubUserAssignedToIp200ResponseMetadata.class.getSimpleName() + + "(", + ")" + ); + if (nextParams != null) joiner.add("nextParams=" + nextParams); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListSubUserAssignedToIp200ResponseMetadataNextParams.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListSubUserAssignedToIp200ResponseMetadataNextParams.java new file mode 100644 index 00000000..b83e4e46 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/ListSubUserAssignedToIp200ResponseMetadataNextParams.java @@ -0,0 +1,84 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListSubUserAssignedToIp200ResponseMetadataNextParams { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("after_key") + @Getter + @Setter + private String afterKey; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("limit") + @Getter + @Setter + private String limit; + + public ListSubUserAssignedToIp200ResponseMetadataNextParams() {} + + private ListSubUserAssignedToIp200ResponseMetadataNextParams( + Builder builder + ) { + this.afterKey = builder.afterKey; + this.limit = builder.limit; + } + + // Builder class for constructing object + public static class Builder { + + private String afterKey; + private String limit; + + public Builder() {} + + public Builder afterKey(String afterKey) { + this.afterKey = afterKey; + return this; + } + + public Builder limit(String limit) { + this.limit = limit; + return this; + } + + public ListSubUserAssignedToIp200ResponseMetadataNextParams build() { + return new ListSubUserAssignedToIp200ResponseMetadataNextParams( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListSubUserAssignedToIp200ResponseMetadataNextParams.class.getSimpleName() + + "(", + ")" + ); + if (afterKey != null) joiner.add("afterKey=" + afterKey); + if (limit != null) joiner.add("limit=" + limit); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region.java new file mode 100644 index 00000000..434a15a1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Region { + EU("eu"), + + US("us"); + + private final String value; + + private Region(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Region forValue(final String value) { + return Promoter.enumFromString(value, Region.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region1.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region1.java new file mode 100644 index 00000000..691b873c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region1.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Region1 { + ALL("all"), + + US("us"), + + EU("eu"); + + private final String value; + + private Region1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Region1 forValue(final String value) { + return Promoter.enumFromString(value, Region1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region2.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region2.java new file mode 100644 index 00000000..a7296420 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region2.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Region2 { + EU("eu"), + + US("us"); + + private final String value; + + private Region2(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Region2 forValue(final String value) { + return Promoter.enumFromString(value, Region2.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region3.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region3.java new file mode 100644 index 00000000..fd366d9c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region3.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Region3 { + EU("eu"), + + US("us"); + + private final String value; + + private Region3(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Region3 forValue(final String value) { + return Promoter.enumFromString(value, Region3.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region4.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region4.java new file mode 100644 index 00000000..a829176c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region4.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Region4 { + ALL("all"), + + US("us"), + + EU("eu"); + + private final String value; + + private Region4(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Region4 forValue(final String value) { + return Promoter.enumFromString(value, Region4.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region5.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region5.java new file mode 100644 index 00000000..88b6a8d1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region5.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Region5 { + US("us"), + + EU("eu"); + + private final String value; + + private Region5(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Region5 forValue(final String value) { + return Promoter.enumFromString(value, Region5.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region6.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region6.java new file mode 100644 index 00000000..2bd59f5a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region6.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Region6 { + EU("eu"), + + US("us"); + + private final String value; + + private Region6(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Region6 forValue(final String value) { + return Promoter.enumFromString(value, Region6.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region7.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region7.java new file mode 100644 index 00000000..f88bc9e8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/Region7.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Region7 { + ALL("all"), + + EU("eu"), + + US("us"); + + private final String value; + + private Region7(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Region7 forValue(final String value) { + return Promoter.enumFromString(value, Region7.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/UpdateIp200Response.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/UpdateIp200Response.java new file mode 100644 index 00000000..da77032e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/UpdateIp200Response.java @@ -0,0 +1,109 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateIp200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_auto_warmup") + @Getter + @Setter + private Boolean isAutoWarmup; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_parent_assigned") + @Getter + @Setter + private Boolean isParentAssigned; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_enabled") + @Getter + @Setter + private Boolean isEnabled; + + public UpdateIp200Response() {} + + private UpdateIp200Response(Builder builder) { + this.ip = builder.ip; + this.isAutoWarmup = builder.isAutoWarmup; + this.isParentAssigned = builder.isParentAssigned; + this.isEnabled = builder.isEnabled; + } + + // Builder class for constructing object + public static class Builder { + + private String ip; + private Boolean isAutoWarmup; + private Boolean isParentAssigned; + private Boolean isEnabled; + + public Builder() {} + + public Builder ip(String ip) { + this.ip = ip; + return this; + } + + public Builder isAutoWarmup(Boolean isAutoWarmup) { + this.isAutoWarmup = isAutoWarmup; + return this; + } + + public Builder isParentAssigned(Boolean isParentAssigned) { + this.isParentAssigned = isParentAssigned; + return this; + } + + public Builder isEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + public UpdateIp200Response build() { + return new UpdateIp200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateIp200Response.class.getSimpleName() + "(", + ")" + ); + if (ip != null) joiner.add("ip=" + ip); + if (isAutoWarmup != null) joiner.add("isAutoWarmup=" + isAutoWarmup); + if (isParentAssigned != null) joiner.add( + "isParentAssigned=" + isParentAssigned + ); + if (isEnabled != null) joiner.add("isEnabled=" + isEnabled); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/UpdateIpPool200Response.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/UpdateIpPool200Response.java new file mode 100644 index 00000000..38d1fe5f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/UpdateIpPool200Response.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateIpPool200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public UpdateIpPool200Response() {} + + private UpdateIpPool200Response(Builder builder) { + this.name = builder.name; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private String id; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public UpdateIpPool200Response build() { + return new UpdateIpPool200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateIpPool200Response.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/UpdateIpPoolRequest.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/UpdateIpPoolRequest.java new file mode 100644 index 00000000..e15a43a7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/UpdateIpPoolRequest.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateIpPoolRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public UpdateIpPoolRequest() {} + + private UpdateIpPoolRequest(Builder builder) { + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + + public Builder(String name) { + this.name = name; + } + + public UpdateIpPoolRequest build() { + return new UpdateIpPoolRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateIpPoolRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/UpdateIpRequest.java b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/UpdateIpRequest.java new file mode 100644 index 00000000..a9dfb1bb --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipaddressmanagement/models/UpdateIpRequest.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address Management API + * The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + * + * 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.ipaddressmanagement.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateIpRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_auto_warmup") + @Getter + @Setter + private Boolean isAutoWarmup; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_parent_assigned") + @Getter + @Setter + private Boolean isParentAssigned; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_enabled") + @Getter + @Setter + private Boolean isEnabled; + + public UpdateIpRequest() {} + + private UpdateIpRequest(Builder builder) { + this.isAutoWarmup = builder.isAutoWarmup; + this.isParentAssigned = builder.isParentAssigned; + this.isEnabled = builder.isEnabled; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean isAutoWarmup; + private Boolean isParentAssigned; + private Boolean isEnabled; + + public Builder() {} + + public Builder isAutoWarmup(Boolean isAutoWarmup) { + this.isAutoWarmup = isAutoWarmup; + return this; + } + + public Builder isParentAssigned(Boolean isParentAssigned) { + this.isParentAssigned = isParentAssigned; + return this; + } + + public Builder isEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + public UpdateIpRequest build() { + return new UpdateIpRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateIpRequest.class.getSimpleName() + "(", + ")" + ); + if (isAutoWarmup != null) joiner.add("isAutoWarmup=" + isAutoWarmup); + if (isParentAssigned != null) joiner.add( + "isParentAssigned=" + isParentAssigned + ); + if (isEnabled != null) joiner.add("isEnabled=" + isEnabled); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/AddIp.java b/src/main/java/com/sendgrid/rest/api/v3/ips/AddIp.java new file mode 100644 index 00000000..01bb8212 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/AddIp.java @@ -0,0 +1,96 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips; + +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.ips.models.AddIp201Response; +import com.sendgrid.rest.api.v3.ips.models.AddIpRequest; +import com.sendgrid.rest.api.v3.ips.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class AddIp extends ApiKeyBase { + + @Setter + private AddIpRequest addIpRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/ips"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "AddIp 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), AddIp201Response.class), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (addIpRequest != null) { + request.addBody(JsonUtil.toJson(addIpRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/AddIpToIpPool.java b/src/main/java/com/sendgrid/rest/api/v3/ips/AddIpToIpPool.java new file mode 100644 index 00000000..9f51653b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/AddIpToIpPool.java @@ -0,0 +1,110 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips; + +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.ips.models.AddIpToIpPool201Response; +import com.sendgrid.rest.api.v3.ips.models.AddIpToIpPool404Response; +import com.sendgrid.rest.api.v3.ips.models.AddIpToIpPoolRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class AddIpToIpPool extends ApiKeyBase { + + private final String poolName; + + @Setter + private AddIpToIpPoolRequest addIpToIpPoolRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/ips/pools/{pool_name}/ips"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "AddIpToIpPool creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + AddIpToIpPool404Response error = JsonUtil.fromJson( + response.getStream(), + AddIpToIpPool404Response.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(), + AddIpToIpPool201Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (poolName != null) { + request.addPathParam("pool_name", poolName.toString()); + } + } + + private void addBody(final Request request) { + if (addIpToIpPoolRequest != null) { + request.addBody(JsonUtil.toJson(addIpToIpPoolRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/CreateIpPool.java b/src/main/java/com/sendgrid/rest/api/v3/ips/CreateIpPool.java new file mode 100644 index 00000000..5f333975 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/CreateIpPool.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips; + +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.ips.models.CreateIpPoolRequest; +import com.sendgrid.rest.api.v3.ips.models.IpPools200; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateIpPool extends ApiKeyBase { + + @Setter + private CreateIpPoolRequest createIpPoolRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/ips/pools"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "CreateIpPool creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), IpPools200.class), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (createIpPoolRequest != null) { + request.addBody(JsonUtil.toJson(createIpPoolRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/DeleteIpFromIpPool.java b/src/main/java/com/sendgrid/rest/api/v3/ips/DeleteIpFromIpPool.java new file mode 100644 index 00000000..74adb818 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/DeleteIpFromIpPool.java @@ -0,0 +1,96 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips; + +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.ips.models.DeleteIpFromIpPool404Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DeleteIpFromIpPool extends ApiKeyBase { + + private final String poolName; + private final String ip; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/ips/pools/{pool_name}/ips/{ip}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteIpFromIpPool creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + DeleteIpFromIpPool404Response error = JsonUtil.fromJson( + response.getStream(), + DeleteIpFromIpPool404Response.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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (poolName != null) { + request.addPathParam("pool_name", poolName.toString()); + } + if (ip != null) { + request.addPathParam("ip", ip.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/DeleteIpPool.java b/src/main/java/com/sendgrid/rest/api/v3/ips/DeleteIpPool.java new file mode 100644 index 00000000..f688f3b2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/DeleteIpPool.java @@ -0,0 +1,92 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips; + +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.ips.models.DeleteIpPool404Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DeleteIpPool extends ApiKeyBase { + + private final String poolName; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/ips/pools/{pool_name}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteIpPool creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + DeleteIpPool404Response error = JsonUtil.fromJson( + response.getStream(), + DeleteIpPool404Response.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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (poolName != null) { + request.addPathParam("pool_name", poolName.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/GetIp.java b/src/main/java/com/sendgrid/rest/api/v3/ips/GetIp.java new file mode 100644 index 00000000..0f34eca8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/GetIp.java @@ -0,0 +1,78 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips; + +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.ips.models.GetIp200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class GetIp extends ApiKeyBase { + + private final String ipAddress; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/ips/{ip_address}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetIp creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), GetIp200Response.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (ipAddress != null) { + request.addPathParam("ip_address", ipAddress.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/GetIpPool.java b/src/main/java/com/sendgrid/rest/api/v3/ips/GetIpPool.java new file mode 100644 index 00000000..1ff27c96 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/GetIpPool.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips; + +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.ips.models.GetIpPool200Response; +import com.sendgrid.rest.api.v3.ips.models.GetIpPool404Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class GetIpPool extends ApiKeyBase { + + private final String poolName; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/ips/pools/{pool_name}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetIpPool creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + GetIpPool404Response error = JsonUtil.fromJson( + response.getStream(), + GetIpPool404Response.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(), GetIpPool200Response.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (poolName != null) { + request.addPathParam("pool_name", poolName.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/ListAssignedIp.java b/src/main/java/com/sendgrid/rest/api/v3/ips/ListAssignedIp.java new file mode 100644 index 00000000..cf4801bc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/ListAssignedIp.java @@ -0,0 +1,72 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips; + +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.ips.models.ListAssignedIp200ResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListAssignedIp extends ApiKeyBase { + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/ips/assigned"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListAssignedIp creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/ListIp.java b/src/main/java/com/sendgrid/rest/api/v3/ips/ListIp.java new file mode 100644 index 00000000..e5b335e5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/ListIp.java @@ -0,0 +1,120 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips; + +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.ips.models.ListIp200ResponseInner; +import com.sendgrid.rest.api.v3.ips.models.SortByDirection; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListIp extends ApiKeyBase { + + @Setter + private String ip; + + @Setter + private Boolean excludeWhitelabels; + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private String subuser; + + @Setter + private SortByDirection sortByDirection; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/ips"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListIp creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (ip != null) { + request.addQueryParam("ip", ip.toString()); + } + if (excludeWhitelabels != null) { + request.addQueryParam( + "exclude_whitelabels", + excludeWhitelabels.toString() + ); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (subuser != null) { + request.addQueryParam("subuser", subuser.toString()); + } + if (sortByDirection != null) { + request.addQueryParam( + "sort_by_direction", + sortByDirection.toString() + ); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/ListIpPool.java b/src/main/java/com/sendgrid/rest/api/v3/ips/ListIpPool.java new file mode 100644 index 00000000..03692ba1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/ListIpPool.java @@ -0,0 +1,70 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips; + +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.ips.models.IpPools200; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListIpPool extends ApiKeyBase { + + public ApiResponse> send(final ApiKeyRestClient client) { + String path = "/v3/ips/pools"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListIpPool creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/ListRemainingIpCount.java b/src/main/java/com/sendgrid/rest/api/v3/ips/ListRemainingIpCount.java new file mode 100644 index 00000000..baa18a40 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/ListRemainingIpCount.java @@ -0,0 +1,74 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips; + +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.ips.models.ListRemainingIpCount200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListRemainingIpCount extends ApiKeyBase { + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/ips/remaining"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListRemainingIpCount creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + ListRemainingIpCount200Response.class + ), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/UpdateIpPool.java b/src/main/java/com/sendgrid/rest/api/v3/ips/UpdateIpPool.java new file mode 100644 index 00000000..093c588f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/UpdateIpPool.java @@ -0,0 +1,105 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips; + +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.ips.models.IpPools200; +import com.sendgrid.rest.api.v3.ips.models.UpdateIpPool404Response; +import com.sendgrid.rest.api.v3.ips.models.UpdateIpPoolRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateIpPool extends ApiKeyBase { + + private final String poolName; + + @Setter + private UpdateIpPoolRequest updateIpPoolRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/ips/pools/{pool_name}"; + Request request = new Request( + HttpMethod.PUT, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateIpPool creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + UpdateIpPool404Response error = JsonUtil.fromJson( + response.getStream(), + UpdateIpPool404Response.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(), IpPools200.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (poolName != null) { + request.addPathParam("pool_name", poolName.toString()); + } + } + + private void addBody(final Request request) { + if (updateIpPoolRequest != null) { + request.addBody(JsonUtil.toJson(updateIpPoolRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIp201Response.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIp201Response.java new file mode 100644 index 00000000..aa9fac5e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIp201Response.java @@ -0,0 +1,88 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ips.models.AddIp201ResponseIpsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddIp201Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ips") + @Getter + @Setter + private List ips; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("remaining_ips") + @Getter + @Setter + private Integer remainingIps; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("warmup") + @Getter + @Setter + private Boolean warmup; + + public AddIp201Response() {} + + private AddIp201Response(Builder builder) { + this.ips = builder.ips; + this.remainingIps = builder.remainingIps; + this.warmup = builder.warmup; + } + + // Builder class for constructing object + public static class Builder { + + private List ips; + private Integer remainingIps; + private Boolean warmup; + + public Builder( + List ips, + Integer remainingIps, + Boolean warmup + ) { + this.ips = ips; + this.remainingIps = remainingIps; + this.warmup = warmup; + } + + public AddIp201Response build() { + return new AddIp201Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddIp201Response.class.getSimpleName() + "(", + ")" + ); + if (ips != null) joiner.add("ips=" + ips); + if (remainingIps != null) joiner.add("remainingIps=" + remainingIps); + if (warmup != null) joiner.add("warmup=" + warmup); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIp201ResponseIpsInner.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIp201ResponseIpsInner.java new file mode 100644 index 00000000..ca968ece --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIp201ResponseIpsInner.java @@ -0,0 +1,73 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddIp201ResponseIpsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subusers") + @Getter + @Setter + private List subusers; + + public AddIp201ResponseIpsInner() {} + + private AddIp201ResponseIpsInner(Builder builder) { + this.ip = builder.ip; + this.subusers = builder.subusers; + } + + // Builder class for constructing object + public static class Builder { + + private String ip; + private List subusers; + + public Builder(String ip, List subusers) { + this.ip = ip; + this.subusers = subusers; + } + + public AddIp201ResponseIpsInner build() { + return new AddIp201ResponseIpsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddIp201ResponseIpsInner.class.getSimpleName() + "(", + ")" + ); + if (ip != null) joiner.add("ip=" + ip); + if (subusers != null) joiner.add("subusers=" + subusers); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIpRequest.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIpRequest.java new file mode 100644 index 00000000..425b9fab --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIpRequest.java @@ -0,0 +1,91 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddIpRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("count") + @Getter + @Setter + private Integer count; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subusers") + @Getter + @Setter + private List subusers; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("warmup") + @Getter + @Setter + private Boolean warmup; + + public AddIpRequest() {} + + private AddIpRequest(Builder builder) { + this.count = builder.count; + this.subusers = builder.subusers; + this.warmup = builder.warmup; + } + + // Builder class for constructing object + public static class Builder { + + private Integer count; + private List subusers; + private Boolean warmup; + + public Builder(Integer count) { + this.count = count; + } + + public Builder subusers(List subusers) { + this.subusers = subusers; + return this; + } + + public Builder warmup(Boolean warmup) { + this.warmup = warmup; + return this; + } + + public AddIpRequest build() { + return new AddIpRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddIpRequest.class.getSimpleName() + "(", + ")" + ); + if (count != null) joiner.add("count=" + count); + if (subusers != null) joiner.add("subusers=" + subusers); + if (warmup != null) joiner.add("warmup=" + warmup); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIpToIpPool201Response.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIpToIpPool201Response.java new file mode 100644 index 00000000..4fa88039 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIpToIpPool201Response.java @@ -0,0 +1,98 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddIpToIpPool201Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("pools") + @Getter + @Setter + private List pools; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("start_date") + @Getter + @Setter + private Integer startDate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("warmup") + @Getter + @Setter + private Boolean warmup; + + public AddIpToIpPool201Response() {} + + private AddIpToIpPool201Response(Builder builder) { + this.ip = builder.ip; + this.pools = builder.pools; + this.startDate = builder.startDate; + this.warmup = builder.warmup; + } + + // Builder class for constructing object + public static class Builder { + + private String ip; + private List pools; + private Integer startDate; + private Boolean warmup; + + public Builder( + String ip, + List pools, + Integer startDate, + Boolean warmup + ) { + this.ip = ip; + this.pools = pools; + this.startDate = startDate; + this.warmup = warmup; + } + + public AddIpToIpPool201Response build() { + return new AddIpToIpPool201Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddIpToIpPool201Response.class.getSimpleName() + "(", + ")" + ); + if (ip != null) joiner.add("ip=" + ip); + if (pools != null) joiner.add("pools=" + pools); + if (startDate != null) joiner.add("startDate=" + startDate); + if (warmup != null) joiner.add("warmup=" + warmup); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIpToIpPool404Response.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIpToIpPool404Response.java new file mode 100644 index 00000000..4d5fa9fd --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIpToIpPool404Response.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ips.models.AddIpToIpPool404ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddIpToIpPool404Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public AddIpToIpPool404Response() {} + + private AddIpToIpPool404Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors( + List errors + ) { + this.errors = errors; + return this; + } + + public AddIpToIpPool404Response build() { + return new AddIpToIpPool404Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddIpToIpPool404Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIpToIpPool404ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIpToIpPool404ResponseErrorsInner.java new file mode 100644 index 00000000..bd3aa509 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIpToIpPool404ResponseErrorsInner.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddIpToIpPool404ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public AddIpToIpPool404ResponseErrorsInner() {} + + private AddIpToIpPool404ResponseErrorsInner(Builder builder) { + this.field = builder.field; + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String field; + private String message; + + public Builder() {} + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public AddIpToIpPool404ResponseErrorsInner build() { + return new AddIpToIpPool404ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddIpToIpPool404ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (field != null) joiner.add("field=" + field); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIpToIpPoolRequest.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIpToIpPoolRequest.java new file mode 100644 index 00000000..3c857b72 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/AddIpToIpPoolRequest.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddIpToIpPoolRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + public AddIpToIpPoolRequest() {} + + private AddIpToIpPoolRequest(Builder builder) { + this.ip = builder.ip; + } + + // Builder class for constructing object + public static class Builder { + + private String ip; + + public Builder() {} + + public Builder ip(String ip) { + this.ip = ip; + return this; + } + + public AddIpToIpPoolRequest build() { + return new AddIpToIpPoolRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddIpToIpPoolRequest.class.getSimpleName() + "(", + ")" + ); + if (ip != null) joiner.add("ip=" + ip); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/CreateIpPoolRequest.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/CreateIpPoolRequest.java new file mode 100644 index 00000000..3d0c97ae --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/CreateIpPoolRequest.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateIpPoolRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public CreateIpPoolRequest() {} + + private CreateIpPoolRequest(Builder builder) { + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + + public Builder(String name) { + this.name = name; + } + + public CreateIpPoolRequest build() { + return new CreateIpPoolRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateIpPoolRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/DeleteIpFromIpPool404Response.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/DeleteIpFromIpPool404Response.java new file mode 100644 index 00000000..6def0ff0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/DeleteIpFromIpPool404Response.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteIpFromIpPool404Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error") + @Getter + @Setter + private String error; + + public DeleteIpFromIpPool404Response() {} + + private DeleteIpFromIpPool404Response(Builder builder) { + this.error = builder.error; + } + + // Builder class for constructing object + public static class Builder { + + private String error; + + public Builder() {} + + public Builder error(String error) { + this.error = error; + return this; + } + + public DeleteIpFromIpPool404Response build() { + return new DeleteIpFromIpPool404Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteIpFromIpPool404Response.class.getSimpleName() + "(", + ")" + ); + if (error != null) joiner.add("error=" + error); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/DeleteIpPool404Response.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/DeleteIpPool404Response.java new file mode 100644 index 00000000..3b277c8d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/DeleteIpPool404Response.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteIpPool404Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error") + @Getter + @Setter + private String error; + + public DeleteIpPool404Response() {} + + private DeleteIpPool404Response(Builder builder) { + this.error = builder.error; + } + + // Builder class for constructing object + public static class Builder { + + private String error; + + public Builder() {} + + public Builder error(String error) { + this.error = error; + return this; + } + + public DeleteIpPool404Response build() { + return new DeleteIpPool404Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteIpPool404Response.class.getSimpleName() + "(", + ")" + ); + if (error != null) joiner.add("error=" + error); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/ErrorResponse.java new file mode 100644 index 00000000..6488d903 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ips.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..f0d011c3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/GetIp200Response.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/GetIp200Response.java new file mode 100644 index 00000000..c0224751 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/GetIp200Response.java @@ -0,0 +1,131 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetIp200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subusers") + @Getter + @Setter + private List subusers; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("rdns") + @Getter + @Setter + private String rdns; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("pools") + @Getter + @Setter + private List pools; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("warmup") + @Getter + @Setter + private Boolean warmup; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("start_date") + @Getter + @Setter + private Integer startDate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("whitelabeled") + @Getter + @Setter + private Boolean whitelabeled; + + public GetIp200Response() {} + + private GetIp200Response(Builder builder) { + this.ip = builder.ip; + this.subusers = builder.subusers; + this.rdns = builder.rdns; + this.pools = builder.pools; + this.warmup = builder.warmup; + this.startDate = builder.startDate; + this.whitelabeled = builder.whitelabeled; + } + + // Builder class for constructing object + public static class Builder { + + private String ip; + private List subusers; + private String rdns; + private List pools; + private Boolean warmup; + private Integer startDate; + private Boolean whitelabeled; + + public Builder( + String ip, + List subusers, + String rdns, + List pools, + Boolean warmup, + Integer startDate, + Boolean whitelabeled + ) { + this.ip = ip; + this.subusers = subusers; + this.rdns = rdns; + this.pools = pools; + this.warmup = warmup; + this.startDate = startDate; + this.whitelabeled = whitelabeled; + } + + public GetIp200Response build() { + return new GetIp200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetIp200Response.class.getSimpleName() + "(", + ")" + ); + if (ip != null) joiner.add("ip=" + ip); + if (subusers != null) joiner.add("subusers=" + subusers); + if (rdns != null) joiner.add("rdns=" + rdns); + if (pools != null) joiner.add("pools=" + pools); + if (warmup != null) joiner.add("warmup=" + warmup); + if (startDate != null) joiner.add("startDate=" + startDate); + if (whitelabeled != null) joiner.add("whitelabeled=" + whitelabeled); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/GetIpPool200Response.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/GetIpPool200Response.java new file mode 100644 index 00000000..887a4033 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/GetIpPool200Response.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetIpPool200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("pool_name") + @Getter + @Setter + private String poolName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ips") + @Getter + @Setter + private List ips; + + public GetIpPool200Response() {} + + private GetIpPool200Response(Builder builder) { + this.poolName = builder.poolName; + this.ips = builder.ips; + } + + // Builder class for constructing object + public static class Builder { + + private String poolName; + private List ips; + + public Builder() {} + + public Builder poolName(String poolName) { + this.poolName = poolName; + return this; + } + + public Builder ips(List ips) { + this.ips = ips; + return this; + } + + public GetIpPool200Response build() { + return new GetIpPool200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetIpPool200Response.class.getSimpleName() + "(", + ")" + ); + if (poolName != null) joiner.add("poolName=" + poolName); + if (ips != null) joiner.add("ips=" + ips); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/GetIpPool404Response.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/GetIpPool404Response.java new file mode 100644 index 00000000..aafdbea6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/GetIpPool404Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ips.models.GetIpPool404ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetIpPool404Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public GetIpPool404Response() {} + + private GetIpPool404Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public GetIpPool404Response build() { + return new GetIpPool404Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetIpPool404Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/GetIpPool404ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/GetIpPool404ResponseErrorsInner.java new file mode 100644 index 00000000..462e2f90 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/GetIpPool404ResponseErrorsInner.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetIpPool404ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public GetIpPool404ResponseErrorsInner() {} + + private GetIpPool404ResponseErrorsInner(Builder builder) { + this.field = builder.field; + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String field; + private String message; + + public Builder() {} + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public GetIpPool404ResponseErrorsInner build() { + return new GetIpPool404ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetIpPool404ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (field != null) joiner.add("field=" + field); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/IpPools200.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/IpPools200.java new file mode 100644 index 00000000..2f16c4d1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/IpPools200.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class IpPools200 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public IpPools200() {} + + private IpPools200(Builder builder) { + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public IpPools200 build() { + return new IpPools200(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + IpPools200.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/ListAssignedIp200ResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/ListAssignedIp200ResponseInner.java new file mode 100644 index 00000000..86b3d644 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/ListAssignedIp200ResponseInner.java @@ -0,0 +1,98 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListAssignedIp200ResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("pools") + @Getter + @Setter + private List pools; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("warmup") + @Getter + @Setter + private Boolean warmup; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("start_date") + @Getter + @Setter + private Integer startDate; + + public ListAssignedIp200ResponseInner() {} + + private ListAssignedIp200ResponseInner(Builder builder) { + this.ip = builder.ip; + this.pools = builder.pools; + this.warmup = builder.warmup; + this.startDate = builder.startDate; + } + + // Builder class for constructing object + public static class Builder { + + private String ip; + private List pools; + private Boolean warmup; + private Integer startDate; + + public Builder( + String ip, + List pools, + Boolean warmup, + Integer startDate + ) { + this.ip = ip; + this.pools = pools; + this.warmup = warmup; + this.startDate = startDate; + } + + public ListAssignedIp200ResponseInner build() { + return new ListAssignedIp200ResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListAssignedIp200ResponseInner.class.getSimpleName() + "(", + ")" + ); + if (ip != null) joiner.add("ip=" + ip); + if (pools != null) joiner.add("pools=" + pools); + if (warmup != null) joiner.add("warmup=" + warmup); + if (startDate != null) joiner.add("startDate=" + startDate); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/ListIp200ResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/ListIp200ResponseInner.java new file mode 100644 index 00000000..b8e53bb5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/ListIp200ResponseInner.java @@ -0,0 +1,146 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListIp200ResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subusers") + @Getter + @Setter + private List subusers; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("rdns") + @Getter + @Setter + private String rdns; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("pools") + @Getter + @Setter + private List pools; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("warmup") + @Getter + @Setter + private Boolean warmup; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("start_date") + @Getter + @Setter + private BigDecimal startDate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("whitelabeled") + @Getter + @Setter + private Boolean whitelabeled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("assigned_at") + @Getter + @Setter + private Integer assignedAt; + + public ListIp200ResponseInner() {} + + private ListIp200ResponseInner(Builder builder) { + this.ip = builder.ip; + this.subusers = builder.subusers; + this.rdns = builder.rdns; + this.pools = builder.pools; + this.warmup = builder.warmup; + this.startDate = builder.startDate; + this.whitelabeled = builder.whitelabeled; + this.assignedAt = builder.assignedAt; + } + + // Builder class for constructing object + public static class Builder { + + private String ip; + private List subusers; + private String rdns; + private List pools; + private Boolean warmup; + private BigDecimal startDate; + private Boolean whitelabeled; + private Integer assignedAt; + + public Builder( + String ip, + List subusers, + List pools, + Boolean warmup, + BigDecimal startDate, + Boolean whitelabeled, + Integer assignedAt + ) { + this.ip = ip; + this.subusers = subusers; + this.pools = pools; + this.warmup = warmup; + this.startDate = startDate; + this.whitelabeled = whitelabeled; + this.assignedAt = assignedAt; + } + + public Builder rdns(String rdns) { + this.rdns = rdns; + return this; + } + + public ListIp200ResponseInner build() { + return new ListIp200ResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListIp200ResponseInner.class.getSimpleName() + "(", + ")" + ); + if (ip != null) joiner.add("ip=" + ip); + if (subusers != null) joiner.add("subusers=" + subusers); + if (rdns != null) joiner.add("rdns=" + rdns); + if (pools != null) joiner.add("pools=" + pools); + if (warmup != null) joiner.add("warmup=" + warmup); + if (startDate != null) joiner.add("startDate=" + startDate); + if (whitelabeled != null) joiner.add("whitelabeled=" + whitelabeled); + if (assignedAt != null) joiner.add("assignedAt=" + assignedAt); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/ListRemainingIpCount200Response.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/ListRemainingIpCount200Response.java new file mode 100644 index 00000000..4c2d1187 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/ListRemainingIpCount200Response.java @@ -0,0 +1,66 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ips.models.ListRemainingIpCount200ResponseResultsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListRemainingIpCount200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("results") + @Getter + @Setter + private List results; + + public ListRemainingIpCount200Response() {} + + private ListRemainingIpCount200Response(Builder builder) { + this.results = builder.results; + } + + // Builder class for constructing object + public static class Builder { + + private List results; + + public Builder( + List results + ) { + this.results = results; + } + + public ListRemainingIpCount200Response build() { + return new ListRemainingIpCount200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListRemainingIpCount200Response.class.getSimpleName() + "(", + ")" + ); + if (results != null) joiner.add("results=" + results); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/ListRemainingIpCount200ResponseResultsInner.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/ListRemainingIpCount200ResponseResultsInner.java new file mode 100644 index 00000000..7dfcb0b7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/ListRemainingIpCount200ResponseResultsInner.java @@ -0,0 +1,88 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListRemainingIpCount200ResponseResultsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("remaining") + @Getter + @Setter + private Integer remaining; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("period") + @Getter + @Setter + private String period; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("price_per_ip") + @Getter + @Setter + private BigDecimal pricePerIp; + + public ListRemainingIpCount200ResponseResultsInner() {} + + private ListRemainingIpCount200ResponseResultsInner(Builder builder) { + this.remaining = builder.remaining; + this.period = builder.period; + this.pricePerIp = builder.pricePerIp; + } + + // Builder class for constructing object + public static class Builder { + + private Integer remaining; + private String period; + private BigDecimal pricePerIp; + + public Builder( + Integer remaining, + String period, + BigDecimal pricePerIp + ) { + this.remaining = remaining; + this.period = period; + this.pricePerIp = pricePerIp; + } + + public ListRemainingIpCount200ResponseResultsInner build() { + return new ListRemainingIpCount200ResponseResultsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListRemainingIpCount200ResponseResultsInner.class.getSimpleName() + + "(", + ")" + ); + if (remaining != null) joiner.add("remaining=" + remaining); + if (period != null) joiner.add("period=" + period); + if (pricePerIp != null) joiner.add("pricePerIp=" + pricePerIp); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/SortByDirection.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/SortByDirection.java new file mode 100644 index 00000000..ce31357f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/SortByDirection.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum SortByDirection { + DESC("desc"), + + ASC("asc"); + + private final String value; + + private SortByDirection(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static SortByDirection forValue(final String value) { + return Promoter.enumFromString(value, SortByDirection.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/UpdateIpPool404Response.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/UpdateIpPool404Response.java new file mode 100644 index 00000000..65401057 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/UpdateIpPool404Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ips.models.UpdateIpPool404ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateIpPool404Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public UpdateIpPool404Response() {} + + private UpdateIpPool404Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public UpdateIpPool404Response build() { + return new UpdateIpPool404Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateIpPool404Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/UpdateIpPool404ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/UpdateIpPool404ResponseErrorsInner.java new file mode 100644 index 00000000..8a84d92b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/UpdateIpPool404ResponseErrorsInner.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateIpPool404ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public UpdateIpPool404ResponseErrorsInner() {} + + private UpdateIpPool404ResponseErrorsInner(Builder builder) { + this.field = builder.field; + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String field; + private String message; + + public Builder() {} + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public UpdateIpPool404ResponseErrorsInner build() { + return new UpdateIpPool404ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateIpPool404ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (field != null) joiner.add("field=" + field); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ips/models/UpdateIpPoolRequest.java b/src/main/java/com/sendgrid/rest/api/v3/ips/models/UpdateIpPoolRequest.java new file mode 100644 index 00000000..9cbb0f01 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ips/models/UpdateIpPoolRequest.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Address API + * The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + * + * 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.ips.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateIpPoolRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public UpdateIpPoolRequest() {} + + private UpdateIpPoolRequest(Builder builder) { + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public UpdateIpPoolRequest build() { + return new UpdateIpPoolRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateIpPoolRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/GetWarmUpIp.java b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/GetWarmUpIp.java new file mode 100644 index 00000000..a1c885cc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/GetWarmUpIp.java @@ -0,0 +1,96 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Warmup API + * The Twilio SendGrid IP Warm Up API allows you to gradually increasing the volume of mail sent with a dedicated IP address according to a predetermined schedule. This gradual process helps to establish a reputation with ISPs (Internet Service Providers) as a legitimate email sender. SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour. The limit is determined by how long the IP address has been warming up. See the [warmup schedule](https://sendgrid.com/docs/ui/sending-email/warming-up-an-ip-address/#automated-ip-warmup-hourly-send-schedule) to learn how SendGrid limits your email traffic for IPs in warmup. You can also choose to use Twilio SendGrid's automated IP warmup for any of your IPs from the **IP Addresses** settings menu in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/ip_addresses). + * + * 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.ipwarmup; + +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.ipwarmup.models.GetWarmUpIp404Response; +import com.sendgrid.rest.api.v3.ipwarmup.models.IpWarmup200Inner; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class GetWarmUpIp extends ApiKeyBase { + + private final String ipAddress; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/ips/warmup/{ip_address}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetWarmUpIp creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + GetWarmUpIp404Response error = JsonUtil.fromJson( + response.getStream(), + GetWarmUpIp404Response.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(), List.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (ipAddress != null) { + request.addPathParam("ip_address", ipAddress.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/ListWarmUpIp.java b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/ListWarmUpIp.java new file mode 100644 index 00000000..0b6b18f8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/ListWarmUpIp.java @@ -0,0 +1,72 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Warmup API + * The Twilio SendGrid IP Warm Up API allows you to gradually increasing the volume of mail sent with a dedicated IP address according to a predetermined schedule. This gradual process helps to establish a reputation with ISPs (Internet Service Providers) as a legitimate email sender. SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour. The limit is determined by how long the IP address has been warming up. See the [warmup schedule](https://sendgrid.com/docs/ui/sending-email/warming-up-an-ip-address/#automated-ip-warmup-hourly-send-schedule) to learn how SendGrid limits your email traffic for IPs in warmup. You can also choose to use Twilio SendGrid's automated IP warmup for any of your IPs from the **IP Addresses** settings menu in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/ip_addresses). + * + * 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.ipwarmup; + +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.ipwarmup.models.IpWarmup200Inner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListWarmUpIp extends ApiKeyBase { + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/ips/warmup"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListWarmUpIp creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/StopIpWarmUp.java b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/StopIpWarmUp.java new file mode 100644 index 00000000..82e3e5cf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/StopIpWarmUp.java @@ -0,0 +1,92 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Warmup API + * The Twilio SendGrid IP Warm Up API allows you to gradually increasing the volume of mail sent with a dedicated IP address according to a predetermined schedule. This gradual process helps to establish a reputation with ISPs (Internet Service Providers) as a legitimate email sender. SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour. The limit is determined by how long the IP address has been warming up. See the [warmup schedule](https://sendgrid.com/docs/ui/sending-email/warming-up-an-ip-address/#automated-ip-warmup-hourly-send-schedule) to learn how SendGrid limits your email traffic for IPs in warmup. You can also choose to use Twilio SendGrid's automated IP warmup for any of your IPs from the **IP Addresses** settings menu in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/ip_addresses). + * + * 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.ipwarmup; + +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.ipwarmup.models.StopIpWarmUp404Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class StopIpWarmUp extends ApiKeyBase { + + private final String ipAddress; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/ips/warmup/{ip_address}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "StopIpWarmUp creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + StopIpWarmUp404Response error = JsonUtil.fromJson( + response.getStream(), + StopIpWarmUp404Response.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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (ipAddress != null) { + request.addPathParam("ip_address", ipAddress.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/WarmUpIp.java b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/WarmUpIp.java new file mode 100644 index 00000000..905b4e81 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/WarmUpIp.java @@ -0,0 +1,99 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Warmup API + * The Twilio SendGrid IP Warm Up API allows you to gradually increasing the volume of mail sent with a dedicated IP address according to a predetermined schedule. This gradual process helps to establish a reputation with ISPs (Internet Service Providers) as a legitimate email sender. SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour. The limit is determined by how long the IP address has been warming up. See the [warmup schedule](https://sendgrid.com/docs/ui/sending-email/warming-up-an-ip-address/#automated-ip-warmup-hourly-send-schedule) to learn how SendGrid limits your email traffic for IPs in warmup. You can also choose to use Twilio SendGrid's automated IP warmup for any of your IPs from the **IP Addresses** settings menu in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/ip_addresses). + * + * 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.ipwarmup; + +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.ipwarmup.models.IpWarmup200Inner; +import com.sendgrid.rest.api.v3.ipwarmup.models.WarmUpIp404Response; +import com.sendgrid.rest.api.v3.ipwarmup.models.WarmUpIpRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class WarmUpIp extends ApiKeyBase { + + @Setter + private WarmUpIpRequest warmUpIpRequest; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/ips/warmup"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "WarmUpIp creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + WarmUpIp404Response error = JsonUtil.fromJson( + response.getStream(), + WarmUpIp404Response.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(), List.class), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (warmUpIpRequest != null) { + request.addBody(JsonUtil.toJson(warmUpIpRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/GetWarmUpIp404Response.java b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/GetWarmUpIp404Response.java new file mode 100644 index 00000000..1aa493f9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/GetWarmUpIp404Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Warmup API + * The Twilio SendGrid IP Warm Up API allows you to gradually increasing the volume of mail sent with a dedicated IP address according to a predetermined schedule. This gradual process helps to establish a reputation with ISPs (Internet Service Providers) as a legitimate email sender. SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour. The limit is determined by how long the IP address has been warming up. See the [warmup schedule](https://sendgrid.com/docs/ui/sending-email/warming-up-an-ip-address/#automated-ip-warmup-hourly-send-schedule) to learn how SendGrid limits your email traffic for IPs in warmup. You can also choose to use Twilio SendGrid's automated IP warmup for any of your IPs from the **IP Addresses** settings menu in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/ip_addresses). + * + * 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.ipwarmup.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipwarmup.models.GetWarmUpIp404ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetWarmUpIp404Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public GetWarmUpIp404Response() {} + + private GetWarmUpIp404Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public GetWarmUpIp404Response build() { + return new GetWarmUpIp404Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetWarmUpIp404Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/GetWarmUpIp404ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/GetWarmUpIp404ResponseErrorsInner.java new file mode 100644 index 00000000..caf95206 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/GetWarmUpIp404ResponseErrorsInner.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Warmup API + * The Twilio SendGrid IP Warm Up API allows you to gradually increasing the volume of mail sent with a dedicated IP address according to a predetermined schedule. This gradual process helps to establish a reputation with ISPs (Internet Service Providers) as a legitimate email sender. SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour. The limit is determined by how long the IP address has been warming up. See the [warmup schedule](https://sendgrid.com/docs/ui/sending-email/warming-up-an-ip-address/#automated-ip-warmup-hourly-send-schedule) to learn how SendGrid limits your email traffic for IPs in warmup. You can also choose to use Twilio SendGrid's automated IP warmup for any of your IPs from the **IP Addresses** settings menu in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/ip_addresses). + * + * 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.ipwarmup.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetWarmUpIp404ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public GetWarmUpIp404ResponseErrorsInner() {} + + private GetWarmUpIp404ResponseErrorsInner(Builder builder) { + this.field = builder.field; + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String field; + private String message; + + public Builder() {} + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public GetWarmUpIp404ResponseErrorsInner build() { + return new GetWarmUpIp404ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetWarmUpIp404ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (field != null) joiner.add("field=" + field); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/IpWarmup200Inner.java b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/IpWarmup200Inner.java new file mode 100644 index 00000000..b93a2429 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/IpWarmup200Inner.java @@ -0,0 +1,72 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Warmup API + * The Twilio SendGrid IP Warm Up API allows you to gradually increasing the volume of mail sent with a dedicated IP address according to a predetermined schedule. This gradual process helps to establish a reputation with ISPs (Internet Service Providers) as a legitimate email sender. SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour. The limit is determined by how long the IP address has been warming up. See the [warmup schedule](https://sendgrid.com/docs/ui/sending-email/warming-up-an-ip-address/#automated-ip-warmup-hourly-send-schedule) to learn how SendGrid limits your email traffic for IPs in warmup. You can also choose to use Twilio SendGrid's automated IP warmup for any of your IPs from the **IP Addresses** settings menu in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/ip_addresses). + * + * 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.ipwarmup.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class IpWarmup200Inner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("start_date") + @Getter + @Setter + private Integer startDate; + + public IpWarmup200Inner() {} + + private IpWarmup200Inner(Builder builder) { + this.ip = builder.ip; + this.startDate = builder.startDate; + } + + // Builder class for constructing object + public static class Builder { + + private String ip; + private Integer startDate; + + public Builder(String ip, Integer startDate) { + this.ip = ip; + this.startDate = startDate; + } + + public IpWarmup200Inner build() { + return new IpWarmup200Inner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + IpWarmup200Inner.class.getSimpleName() + "(", + ")" + ); + if (ip != null) joiner.add("ip=" + ip); + if (startDate != null) joiner.add("startDate=" + startDate); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/StopIpWarmUp404Response.java b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/StopIpWarmUp404Response.java new file mode 100644 index 00000000..5761b847 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/StopIpWarmUp404Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Warmup API + * The Twilio SendGrid IP Warm Up API allows you to gradually increasing the volume of mail sent with a dedicated IP address according to a predetermined schedule. This gradual process helps to establish a reputation with ISPs (Internet Service Providers) as a legitimate email sender. SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour. The limit is determined by how long the IP address has been warming up. See the [warmup schedule](https://sendgrid.com/docs/ui/sending-email/warming-up-an-ip-address/#automated-ip-warmup-hourly-send-schedule) to learn how SendGrid limits your email traffic for IPs in warmup. You can also choose to use Twilio SendGrid's automated IP warmup for any of your IPs from the **IP Addresses** settings menu in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/ip_addresses). + * + * 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.ipwarmup.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipwarmup.models.StopIpWarmUp404ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class StopIpWarmUp404Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public StopIpWarmUp404Response() {} + + private StopIpWarmUp404Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public StopIpWarmUp404Response build() { + return new StopIpWarmUp404Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + StopIpWarmUp404Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/StopIpWarmUp404ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/StopIpWarmUp404ResponseErrorsInner.java new file mode 100644 index 00000000..962f286d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/StopIpWarmUp404ResponseErrorsInner.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Warmup API + * The Twilio SendGrid IP Warm Up API allows you to gradually increasing the volume of mail sent with a dedicated IP address according to a predetermined schedule. This gradual process helps to establish a reputation with ISPs (Internet Service Providers) as a legitimate email sender. SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour. The limit is determined by how long the IP address has been warming up. See the [warmup schedule](https://sendgrid.com/docs/ui/sending-email/warming-up-an-ip-address/#automated-ip-warmup-hourly-send-schedule) to learn how SendGrid limits your email traffic for IPs in warmup. You can also choose to use Twilio SendGrid's automated IP warmup for any of your IPs from the **IP Addresses** settings menu in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/ip_addresses). + * + * 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.ipwarmup.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class StopIpWarmUp404ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public StopIpWarmUp404ResponseErrorsInner() {} + + private StopIpWarmUp404ResponseErrorsInner(Builder builder) { + this.field = builder.field; + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String field; + private String message; + + public Builder() {} + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public StopIpWarmUp404ResponseErrorsInner build() { + return new StopIpWarmUp404ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + StopIpWarmUp404ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (field != null) joiner.add("field=" + field); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/WarmUpIp404Response.java b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/WarmUpIp404Response.java new file mode 100644 index 00000000..5d60162d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/WarmUpIp404Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Warmup API + * The Twilio SendGrid IP Warm Up API allows you to gradually increasing the volume of mail sent with a dedicated IP address according to a predetermined schedule. This gradual process helps to establish a reputation with ISPs (Internet Service Providers) as a legitimate email sender. SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour. The limit is determined by how long the IP address has been warming up. See the [warmup schedule](https://sendgrid.com/docs/ui/sending-email/warming-up-an-ip-address/#automated-ip-warmup-hourly-send-schedule) to learn how SendGrid limits your email traffic for IPs in warmup. You can also choose to use Twilio SendGrid's automated IP warmup for any of your IPs from the **IP Addresses** settings menu in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/ip_addresses). + * + * 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.ipwarmup.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.ipwarmup.models.WarmUpIp404ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class WarmUpIp404Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public WarmUpIp404Response() {} + + private WarmUpIp404Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public WarmUpIp404Response build() { + return new WarmUpIp404Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + WarmUpIp404Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/WarmUpIp404ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/WarmUpIp404ResponseErrorsInner.java new file mode 100644 index 00000000..e30f4cd2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/WarmUpIp404ResponseErrorsInner.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Warmup API + * The Twilio SendGrid IP Warm Up API allows you to gradually increasing the volume of mail sent with a dedicated IP address according to a predetermined schedule. This gradual process helps to establish a reputation with ISPs (Internet Service Providers) as a legitimate email sender. SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour. The limit is determined by how long the IP address has been warming up. See the [warmup schedule](https://sendgrid.com/docs/ui/sending-email/warming-up-an-ip-address/#automated-ip-warmup-hourly-send-schedule) to learn how SendGrid limits your email traffic for IPs in warmup. You can also choose to use Twilio SendGrid's automated IP warmup for any of your IPs from the **IP Addresses** settings menu in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/ip_addresses). + * + * 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.ipwarmup.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class WarmUpIp404ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public WarmUpIp404ResponseErrorsInner() {} + + private WarmUpIp404ResponseErrorsInner(Builder builder) { + this.field = builder.field; + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String field; + private String message; + + public Builder() {} + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public WarmUpIp404ResponseErrorsInner build() { + return new WarmUpIp404ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + WarmUpIp404ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (field != null) joiner.add("field=" + field); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/WarmUpIpRequest.java b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/WarmUpIpRequest.java new file mode 100644 index 00000000..b4bbec16 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/ipwarmup/models/WarmUpIpRequest.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid IP Warmup API + * The Twilio SendGrid IP Warm Up API allows you to gradually increasing the volume of mail sent with a dedicated IP address according to a predetermined schedule. This gradual process helps to establish a reputation with ISPs (Internet Service Providers) as a legitimate email sender. SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour. The limit is determined by how long the IP address has been warming up. See the [warmup schedule](https://sendgrid.com/docs/ui/sending-email/warming-up-an-ip-address/#automated-ip-warmup-hourly-send-schedule) to learn how SendGrid limits your email traffic for IPs in warmup. You can also choose to use Twilio SendGrid's automated IP warmup for any of your IPs from the **IP Addresses** settings menu in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/ip_addresses). + * + * 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.ipwarmup.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class WarmUpIpRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + public WarmUpIpRequest() {} + + private WarmUpIpRequest(Builder builder) { + this.ip = builder.ip; + } + + // Builder class for constructing object + public static class Builder { + + private String ip; + + public Builder() {} + + public Builder ip(String ip) { + this.ip = ip; + return this; + } + + public WarmUpIpRequest build() { + return new WarmUpIpRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + WarmUpIpRequest.class.getSimpleName() + "(", + ")" + ); + if (ip != null) joiner.add("ip=" + ip); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/AssociateBrandedLinkWithSubuser.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/AssociateBrandedLinkWithSubuser.java new file mode 100644 index 00000000..21e406d9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/AssociateBrandedLinkWithSubuser.java @@ -0,0 +1,92 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding; + +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.linkbranding.models.AssociateBrandedLinkWithSubuserRequest; +import com.sendgrid.rest.api.v3.linkbranding.models.LinkBranding200; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class AssociateBrandedLinkWithSubuser extends ApiKeyBase { + + private final Integer linkId; + + @Setter + private AssociateBrandedLinkWithSubuserRequest associateBrandedLinkWithSubuserRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/links/{link_id}/subuser"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "AssociateBrandedLinkWithSubuser creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), LinkBranding200.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (linkId != null) { + request.addPathParam("link_id", linkId.toString()); + } + } + + private void addBody(final Request request) { + if (associateBrandedLinkWithSubuserRequest != null) { + request.addBody( + JsonUtil.toJson(associateBrandedLinkWithSubuserRequest) + ); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/CreateBrandedLink.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/CreateBrandedLink.java new file mode 100644 index 00000000..08debe7c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/CreateBrandedLink.java @@ -0,0 +1,91 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding; + +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.linkbranding.models.CreateBrandedLinkRequest; +import com.sendgrid.rest.api.v3.linkbranding.models.LinkBranding200; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateBrandedLink extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private CreateBrandedLinkRequest createBrandedLinkRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/links"; + 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( + "CreateBrandedLink creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), LinkBranding200.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (createBrandedLinkRequest != null) { + request.addBody(JsonUtil.toJson(createBrandedLinkRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/DeleteBrandedLink.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/DeleteBrandedLink.java new file mode 100644 index 00000000..0f11f0fe --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/DeleteBrandedLink.java @@ -0,0 +1,88 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding; + +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 lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteBrandedLink extends ApiKeyBase { + + private final Integer id; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/links/{id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteBrandedLink creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/DisassociateBrandedLinkFromSubuser.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/DisassociateBrandedLinkFromSubuser.java new file mode 100644 index 00000000..7ebe1287 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/DisassociateBrandedLinkFromSubuser.java @@ -0,0 +1,77 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding; + +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 lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DisassociateBrandedLinkFromSubuser extends ApiKeyBase { + + private final String username; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/links/subuser"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DisassociateBrandedLinkFromSubuser creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (username != null) { + request.addQueryParam("username", username.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/GetBrandedLink.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/GetBrandedLink.java new file mode 100644 index 00000000..63d04053 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/GetBrandedLink.java @@ -0,0 +1,89 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding; + +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.linkbranding.models.LinkBranding200; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetBrandedLink extends ApiKeyBase { + + private final Integer id; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/links/{id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetBrandedLink creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), LinkBranding200.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/ListBrandedLink.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/ListBrandedLink.java new file mode 100644 index 00000000..2dad7f83 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/ListBrandedLink.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding; + +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.linkbranding.models.LinkBranding200; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListBrandedLink extends ApiKeyBase { + + @Setter + private Integer limit; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/whitelabel/links"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListBrandedLink creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/ListDefaultBrandedLink.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/ListDefaultBrandedLink.java new file mode 100644 index 00000000..48ef9f5f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/ListDefaultBrandedLink.java @@ -0,0 +1,90 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding; + +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.linkbranding.models.LinkBranding200; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListDefaultBrandedLink extends ApiKeyBase { + + @Setter + private String domain; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/links/default"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListDefaultBrandedLink creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), LinkBranding200.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (domain != null) { + request.addQueryParam("domain", domain.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/ListSubuserBrandedLink.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/ListSubuserBrandedLink.java new file mode 100644 index 00000000..a7b609f1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/ListSubuserBrandedLink.java @@ -0,0 +1,78 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding; + +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.linkbranding.models.LinkBranding200; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListSubuserBrandedLink extends ApiKeyBase { + + private final String username; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/links/subuser"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSubuserBrandedLink creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), LinkBranding200.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (username != null) { + request.addQueryParam("username", username.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/UpdateBrandedLink.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/UpdateBrandedLink.java new file mode 100644 index 00000000..fd313ee4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/UpdateBrandedLink.java @@ -0,0 +1,100 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding; + +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.linkbranding.models.LinkBranding200; +import com.sendgrid.rest.api.v3.linkbranding.models.UpdateBrandedLinkRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateBrandedLink extends ApiKeyBase { + + private final Integer id; + + @Setter + private String onBehalfOf; + + @Setter + private UpdateBrandedLinkRequest updateBrandedLinkRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/links/{id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateBrandedLink creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), LinkBranding200.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateBrandedLinkRequest != null) { + request.addBody(JsonUtil.toJson(updateBrandedLinkRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/ValidateBrandedLink.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/ValidateBrandedLink.java new file mode 100644 index 00000000..c0e5072e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/ValidateBrandedLink.java @@ -0,0 +1,109 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding; + +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.linkbranding.models.ValidateBrandedLink200Response; +import com.sendgrid.rest.api.v3.linkbranding.models.ValidateBrandedLink500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ValidateBrandedLink extends ApiKeyBase { + + private final Integer id; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/whitelabel/links/{id}/validate"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ValidateBrandedLink creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ValidateBrandedLink500Response error = JsonUtil.fromJson( + response.getStream(), + ValidateBrandedLink500Response.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(), + ValidateBrandedLink200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/AssociateBrandedLinkWithSubuserRequest.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/AssociateBrandedLinkWithSubuserRequest.java new file mode 100644 index 00000000..06af477d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/AssociateBrandedLinkWithSubuserRequest.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AssociateBrandedLinkWithSubuserRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + public AssociateBrandedLinkWithSubuserRequest() {} + + private AssociateBrandedLinkWithSubuserRequest(Builder builder) { + this.username = builder.username; + } + + // Builder class for constructing object + public static class Builder { + + private String username; + + public Builder() {} + + public Builder username(String username) { + this.username = username; + return this; + } + + public AssociateBrandedLinkWithSubuserRequest build() { + return new AssociateBrandedLinkWithSubuserRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AssociateBrandedLinkWithSubuserRequest.class.getSimpleName() + "(", + ")" + ); + if (username != null) joiner.add("username=" + username); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/CreateBrandedLinkRequest.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/CreateBrandedLinkRequest.java new file mode 100644 index 00000000..20784e37 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/CreateBrandedLinkRequest.java @@ -0,0 +1,106 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.linkbranding.models.ModelDefault; +import com.sendgrid.rest.api.v3.linkbranding.models.Region; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateBrandedLinkRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("domain") + @Getter + @Setter + private String domain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subdomain") + @Getter + @Setter + private String subdomain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("default") + @Getter + @Setter + private ModelDefault _default; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("region") + @Getter + @Setter + private Region region; + + public CreateBrandedLinkRequest() {} + + private CreateBrandedLinkRequest(Builder builder) { + this.domain = builder.domain; + this.subdomain = builder.subdomain; + this._default = builder._default; + this.region = builder.region; + } + + // Builder class for constructing object + public static class Builder { + + private String domain; + private String subdomain; + private ModelDefault _default; + private Region region; + + public Builder(String domain) { + this.domain = domain; + } + + public Builder subdomain(String subdomain) { + this.subdomain = subdomain; + return this; + } + + public Builder _default(ModelDefault _default) { + this._default = _default; + return this; + } + + public Builder region(Region region) { + this.region = region; + return this; + } + + public CreateBrandedLinkRequest build() { + return new CreateBrandedLinkRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateBrandedLinkRequest.class.getSimpleName() + "(", + ")" + ); + if (domain != null) joiner.add("domain=" + domain); + if (subdomain != null) joiner.add("subdomain=" + subdomain); + if (_default != null) joiner.add("_default=" + _default); + if (region != null) joiner.add("region=" + region); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Default1.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Default1.java new file mode 100644 index 00000000..9e05b9b5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Default1.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Default1 { + TRUE("true"), + + FALSE("false"); + + private final String value; + + private Default1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Default1 forValue(final String value) { + return Promoter.enumFromString(value, Default1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Default2.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Default2.java new file mode 100644 index 00000000..16ac8f9e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Default2.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Default2 { + TRUE("true"), + + FALSE("false"); + + private final String value; + + private Default2(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Default2 forValue(final String value) { + return Promoter.enumFromString(value, Default2.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Legacy.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Legacy.java new file mode 100644 index 00000000..7111980e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Legacy.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Legacy { + TRUE("true"), + + FALSE("false"); + + private final String value; + + private Legacy(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Legacy forValue(final String value) { + return Promoter.enumFromString(value, Legacy.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/LinkBranding200.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/LinkBranding200.java new file mode 100644 index 00000000..91349a98 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/LinkBranding200.java @@ -0,0 +1,159 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.linkbranding.models.Default2; +import com.sendgrid.rest.api.v3.linkbranding.models.Legacy; +import com.sendgrid.rest.api.v3.linkbranding.models.LinkBranding200Dns; +import com.sendgrid.rest.api.v3.linkbranding.models.Valid3; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class LinkBranding200 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("domain") + @Getter + @Setter + private String domain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subdomain") + @Getter + @Setter + private String subdomain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("user_id") + @Getter + @Setter + private Integer userId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("default") + @Getter + @Setter + private Default2 _default; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Valid3 valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("legacy") + @Getter + @Setter + private Legacy legacy; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("dns") + @Getter + @Setter + private LinkBranding200Dns dns; + + public LinkBranding200() {} + + private LinkBranding200(Builder builder) { + this.id = builder.id; + this.domain = builder.domain; + this.subdomain = builder.subdomain; + this.username = builder.username; + this.userId = builder.userId; + this._default = builder._default; + this.valid = builder.valid; + this.legacy = builder.legacy; + this.dns = builder.dns; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private String domain; + private String subdomain; + private String username; + private Integer userId; + private Default2 _default; + private Valid3 valid; + private Legacy legacy; + private LinkBranding200Dns dns; + + public Builder( + Integer id, + String domain, + String username, + Integer userId, + Default2 _default, + Valid3 valid, + Legacy legacy, + LinkBranding200Dns dns + ) { + this.id = id; + this.domain = domain; + this.username = username; + this.userId = userId; + this._default = _default; + this.valid = valid; + this.legacy = legacy; + this.dns = dns; + } + + public Builder subdomain(String subdomain) { + this.subdomain = subdomain; + return this; + } + + public LinkBranding200 build() { + return new LinkBranding200(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + LinkBranding200.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (domain != null) joiner.add("domain=" + domain); + if (subdomain != null) joiner.add("subdomain=" + subdomain); + if (username != null) joiner.add("username=" + username); + if (userId != null) joiner.add("userId=" + userId); + if (_default != null) joiner.add("_default=" + _default); + if (valid != null) joiner.add("valid=" + valid); + if (legacy != null) joiner.add("legacy=" + legacy); + if (dns != null) joiner.add("dns=" + dns); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/LinkBranding200Dns.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/LinkBranding200Dns.java new file mode 100644 index 00000000..d2187ebd --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/LinkBranding200Dns.java @@ -0,0 +1,78 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.linkbranding.models.LinkBranding200DnsDomainCname; +import com.sendgrid.rest.api.v3.linkbranding.models.LinkBranding200DnsOwnerCname; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class LinkBranding200Dns { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("domain_cname") + @Getter + @Setter + private LinkBranding200DnsDomainCname domainCname; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("owner_cname") + @Getter + @Setter + private LinkBranding200DnsOwnerCname ownerCname; + + public LinkBranding200Dns() {} + + private LinkBranding200Dns(Builder builder) { + this.domainCname = builder.domainCname; + this.ownerCname = builder.ownerCname; + } + + // Builder class for constructing object + public static class Builder { + + private LinkBranding200DnsDomainCname domainCname; + private LinkBranding200DnsOwnerCname ownerCname; + + public Builder(LinkBranding200DnsDomainCname domainCname) { + this.domainCname = domainCname; + } + + public Builder ownerCname(LinkBranding200DnsOwnerCname ownerCname) { + this.ownerCname = ownerCname; + return this; + } + + public LinkBranding200Dns build() { + return new LinkBranding200Dns(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + LinkBranding200Dns.class.getSimpleName() + "(", + ")" + ); + if (domainCname != null) joiner.add("domainCname=" + domainCname); + if (ownerCname != null) joiner.add("ownerCname=" + ownerCname); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/LinkBranding200DnsDomainCname.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/LinkBranding200DnsDomainCname.java new file mode 100644 index 00000000..856aaae9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/LinkBranding200DnsDomainCname.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.linkbranding.models.Type; +import com.sendgrid.rest.api.v3.linkbranding.models.Valid4; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class LinkBranding200DnsDomainCname { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Valid4 valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private Type type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("host") + @Getter + @Setter + private String host; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("data") + @Getter + @Setter + private String data; + + public LinkBranding200DnsDomainCname() {} + + private LinkBranding200DnsDomainCname(Builder builder) { + this.valid = builder.valid; + this.type = builder.type; + this.host = builder.host; + this.data = builder.data; + } + + // Builder class for constructing object + public static class Builder { + + private Valid4 valid; + private Type type; + private String host; + private String data; + + public Builder(Valid4 valid, Type type, String host, String data) { + this.valid = valid; + this.type = type; + this.host = host; + this.data = data; + } + + public LinkBranding200DnsDomainCname build() { + return new LinkBranding200DnsDomainCname(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + LinkBranding200DnsDomainCname.class.getSimpleName() + "(", + ")" + ); + if (valid != null) joiner.add("valid=" + valid); + if (type != null) joiner.add("type=" + type); + if (host != null) joiner.add("host=" + host); + if (data != null) joiner.add("data=" + data); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/LinkBranding200DnsOwnerCname.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/LinkBranding200DnsOwnerCname.java new file mode 100644 index 00000000..5689bc91 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/LinkBranding200DnsOwnerCname.java @@ -0,0 +1,98 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.linkbranding.models.Type1; +import com.sendgrid.rest.api.v3.linkbranding.models.Valid5; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class LinkBranding200DnsOwnerCname { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Valid5 valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private Type1 type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("host") + @Getter + @Setter + private String host; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("data") + @Getter + @Setter + private String data; + + public LinkBranding200DnsOwnerCname() {} + + private LinkBranding200DnsOwnerCname(Builder builder) { + this.valid = builder.valid; + this.type = builder.type; + this.host = builder.host; + this.data = builder.data; + } + + // Builder class for constructing object + public static class Builder { + + private Valid5 valid; + private Type1 type; + private String host; + private String data; + + public Builder(Valid5 valid, String host, String data) { + this.valid = valid; + this.host = host; + this.data = data; + } + + public Builder type(Type1 type) { + this.type = type; + return this; + } + + public LinkBranding200DnsOwnerCname build() { + return new LinkBranding200DnsOwnerCname(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + LinkBranding200DnsOwnerCname.class.getSimpleName() + "(", + ")" + ); + if (valid != null) joiner.add("valid=" + valid); + if (type != null) joiner.add("type=" + type); + if (host != null) joiner.add("host=" + host); + if (data != null) joiner.add("data=" + data); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ModelDefault.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ModelDefault.java new file mode 100644 index 00000000..c176c5ab --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ModelDefault.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum ModelDefault { + TRUE("true"), + + FALSE("false"); + + private final String value; + + private ModelDefault(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static ModelDefault forValue(final String value) { + return Promoter.enumFromString(value, ModelDefault.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Region.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Region.java new file mode 100644 index 00000000..4e18f100 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Region.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Region { + EU("eu"), + + US("us"); + + private final String value; + + private Region(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Region forValue(final String value) { + return Promoter.enumFromString(value, Region.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Type.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Type.java new file mode 100644 index 00000000..377975ea --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Type.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Type { + CNAME("cname"), + + TXT("txt"), + + MX("mx"); + + private final String value; + + private Type(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Type forValue(final String value) { + return Promoter.enumFromString(value, Type.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Type1.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Type1.java new file mode 100644 index 00000000..7252c84e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Type1.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Type1 { + CNAME("cname"), + + TXT("txt"), + + MX("mx"); + + private final String value; + + private Type1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Type1 forValue(final String value) { + return Promoter.enumFromString(value, Type1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/UpdateBrandedLinkRequest.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/UpdateBrandedLinkRequest.java new file mode 100644 index 00000000..1c908cbe --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/UpdateBrandedLinkRequest.java @@ -0,0 +1,66 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.linkbranding.models.Default1; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateBrandedLinkRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("default") + @Getter + @Setter + private Default1 _default; + + public UpdateBrandedLinkRequest() {} + + private UpdateBrandedLinkRequest(Builder builder) { + this._default = builder._default; + } + + // Builder class for constructing object + public static class Builder { + + private Default1 _default; + + public Builder() {} + + public Builder _default(Default1 _default) { + this._default = _default; + return this; + } + + public UpdateBrandedLinkRequest build() { + return new UpdateBrandedLinkRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateBrandedLinkRequest.class.getSimpleName() + "(", + ")" + ); + if (_default != null) joiner.add("_default=" + _default); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid.java new file mode 100644 index 00000000..2fded4ef --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Valid { + TRUE("true"), + + FALSE("false"); + + private final String value; + + private Valid(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Valid forValue(final String value) { + return Promoter.enumFromString(value, Valid.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid1.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid1.java new file mode 100644 index 00000000..8f715cb6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid1.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Valid1 { + TRUE("true"), + + FALSE("false"); + + private final String value; + + private Valid1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Valid1 forValue(final String value) { + return Promoter.enumFromString(value, Valid1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid2.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid2.java new file mode 100644 index 00000000..48d3a8a7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid2.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Valid2 { + TRUE("true"), + + FALSE("false"); + + private final String value; + + private Valid2(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Valid2 forValue(final String value) { + return Promoter.enumFromString(value, Valid2.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid3.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid3.java new file mode 100644 index 00000000..d79becd2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid3.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Valid3 { + TRUE("true"), + + FALSE("false"); + + private final String value; + + private Valid3(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Valid3 forValue(final String value) { + return Promoter.enumFromString(value, Valid3.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid4.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid4.java new file mode 100644 index 00000000..7f2ce311 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid4.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Valid4 { + TRUE("true"), + + FALSE("false"); + + private final String value; + + private Valid4(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Valid4 forValue(final String value) { + return Promoter.enumFromString(value, Valid4.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid5.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid5.java new file mode 100644 index 00000000..a5fd600f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/Valid5.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Valid5 { + TRUE("true"), + + FALSE("false"); + + private final String value; + + private Valid5(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Valid5 forValue(final String value) { + return Promoter.enumFromString(value, Valid5.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink200Response.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink200Response.java new file mode 100644 index 00000000..f509c159 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink200Response.java @@ -0,0 +1,90 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.linkbranding.models.Valid; +import com.sendgrid.rest.api.v3.linkbranding.models.ValidateBrandedLink200ResponseValidationResults; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateBrandedLink200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Valid valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("validation_results") + @Getter + @Setter + private ValidateBrandedLink200ResponseValidationResults validationResults; + + public ValidateBrandedLink200Response() {} + + private ValidateBrandedLink200Response(Builder builder) { + this.id = builder.id; + this.valid = builder.valid; + this.validationResults = builder.validationResults; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private Valid valid; + private ValidateBrandedLink200ResponseValidationResults validationResults; + + public Builder( + Integer id, + Valid valid, + ValidateBrandedLink200ResponseValidationResults validationResults + ) { + this.id = id; + this.valid = valid; + this.validationResults = validationResults; + } + + public ValidateBrandedLink200Response build() { + return new ValidateBrandedLink200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateBrandedLink200Response.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (valid != null) joiner.add("valid=" + valid); + if (validationResults != null) joiner.add( + "validationResults=" + validationResults + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink200ResponseValidationResults.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink200ResponseValidationResults.java new file mode 100644 index 00000000..e15e1010 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink200ResponseValidationResults.java @@ -0,0 +1,83 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.linkbranding.models.ValidateBrandedLink200ResponseValidationResultsDomainCname; +import com.sendgrid.rest.api.v3.linkbranding.models.ValidateBrandedLink200ResponseValidationResultsOwnerCname; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateBrandedLink200ResponseValidationResults { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("domain_cname") + @Getter + @Setter + private ValidateBrandedLink200ResponseValidationResultsDomainCname domainCname; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("owner_cname") + @Getter + @Setter + private ValidateBrandedLink200ResponseValidationResultsOwnerCname ownerCname; + + public ValidateBrandedLink200ResponseValidationResults() {} + + private ValidateBrandedLink200ResponseValidationResults(Builder builder) { + this.domainCname = builder.domainCname; + this.ownerCname = builder.ownerCname; + } + + // Builder class for constructing object + public static class Builder { + + private ValidateBrandedLink200ResponseValidationResultsDomainCname domainCname; + private ValidateBrandedLink200ResponseValidationResultsOwnerCname ownerCname; + + public Builder( + ValidateBrandedLink200ResponseValidationResultsDomainCname domainCname + ) { + this.domainCname = domainCname; + } + + public Builder ownerCname( + ValidateBrandedLink200ResponseValidationResultsOwnerCname ownerCname + ) { + this.ownerCname = ownerCname; + return this; + } + + public ValidateBrandedLink200ResponseValidationResults build() { + return new ValidateBrandedLink200ResponseValidationResults(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateBrandedLink200ResponseValidationResults.class.getSimpleName() + + "(", + ")" + ); + if (domainCname != null) joiner.add("domainCname=" + domainCname); + if (ownerCname != null) joiner.add("ownerCname=" + ownerCname); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink200ResponseValidationResultsDomainCname.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink200ResponseValidationResultsDomainCname.java new file mode 100644 index 00000000..54e42f6f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink200ResponseValidationResultsDomainCname.java @@ -0,0 +1,78 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.linkbranding.models.Valid1; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateBrandedLink200ResponseValidationResultsDomainCname { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Valid1 valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reason") + @Getter + @Setter + private String reason; + + public ValidateBrandedLink200ResponseValidationResultsDomainCname() {} + + private ValidateBrandedLink200ResponseValidationResultsDomainCname( + Builder builder + ) { + this.valid = builder.valid; + this.reason = builder.reason; + } + + // Builder class for constructing object + public static class Builder { + + private Valid1 valid; + private String reason; + + public Builder(Valid1 valid, String reason) { + this.valid = valid; + this.reason = reason; + } + + public ValidateBrandedLink200ResponseValidationResultsDomainCname build() { + return new ValidateBrandedLink200ResponseValidationResultsDomainCname( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateBrandedLink200ResponseValidationResultsDomainCname.class.getSimpleName() + + "(", + ")" + ); + if (valid != null) joiner.add("valid=" + valid); + if (reason != null) joiner.add("reason=" + reason); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink200ResponseValidationResultsOwnerCname.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink200ResponseValidationResultsOwnerCname.java new file mode 100644 index 00000000..315ce10a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink200ResponseValidationResultsOwnerCname.java @@ -0,0 +1,78 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.linkbranding.models.Valid2; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateBrandedLink200ResponseValidationResultsOwnerCname { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Valid2 valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reason") + @Getter + @Setter + private String reason; + + public ValidateBrandedLink200ResponseValidationResultsOwnerCname() {} + + private ValidateBrandedLink200ResponseValidationResultsOwnerCname( + Builder builder + ) { + this.valid = builder.valid; + this.reason = builder.reason; + } + + // Builder class for constructing object + public static class Builder { + + private Valid2 valid; + private String reason; + + public Builder(Valid2 valid, String reason) { + this.valid = valid; + this.reason = reason; + } + + public ValidateBrandedLink200ResponseValidationResultsOwnerCname build() { + return new ValidateBrandedLink200ResponseValidationResultsOwnerCname( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateBrandedLink200ResponseValidationResultsOwnerCname.class.getSimpleName() + + "(", + ")" + ); + if (valid != null) joiner.add("valid=" + valid); + if (reason != null) joiner.add("reason=" + reason); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink500Response.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink500Response.java new file mode 100644 index 00000000..123e88c9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink500Response.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.linkbranding.models.ValidateBrandedLink500ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateBrandedLink500Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ValidateBrandedLink500Response() {} + + private ValidateBrandedLink500Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder(List errors) { + this.errors = errors; + } + + public ValidateBrandedLink500Response build() { + return new ValidateBrandedLink500Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateBrandedLink500Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink500ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink500ResponseErrorsInner.java new file mode 100644 index 00000000..b5053000 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/linkbranding/models/ValidateBrandedLink500ResponseErrorsInner.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Link Branding API + * The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + * + * 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.linkbranding.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateBrandedLink500ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public ValidateBrandedLink500ResponseErrorsInner() {} + + private ValidateBrandedLink500ResponseErrorsInner(Builder builder) { + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + + public Builder(String message) { + this.message = message; + } + + public ValidateBrandedLink500ResponseErrorsInner build() { + return new ValidateBrandedLink500ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateBrandedLink500ResponseErrorsInner.class.getSimpleName() + + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/CreateCampaign.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/CreateCampaign.java new file mode 100644 index 00000000..d6b15508 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/CreateCampaign.java @@ -0,0 +1,119 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns; + +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.lmccampaigns.models.Campaigns2xx; +import com.sendgrid.rest.api.v3.lmccampaigns.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccampaigns.models.PostCampaignsRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateCampaign extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private PostCampaignsRequest postCampaignsRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/campaigns"; + 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( + "CreateCampaign 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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() + ); + } + + 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(), Campaigns2xx.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (postCampaignsRequest != null) { + request.addBody(JsonUtil.toJson(postCampaignsRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/DeleteCampaign.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/DeleteCampaign.java new file mode 100644 index 00000000..7f71ccdc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/DeleteCampaign.java @@ -0,0 +1,115 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns; + +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; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteCampaign extends ApiKeyBase { + + private final Integer campaignId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/campaigns/{campaign_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteCampaign 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), "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, + JsonUtil.fromJson(response.getStream(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (campaignId != null) { + request.addPathParam("campaign_id", campaignId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/GetCampaign.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/GetCampaign.java new file mode 100644 index 00000000..a3da0d9a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/GetCampaign.java @@ -0,0 +1,121 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns; + +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.lmccampaigns.models.GetCampaign200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetCampaign extends ApiKeyBase { + + private final Integer campaignId; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/campaigns/{campaign_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetCampaign 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), "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, + JsonUtil.fromJson( + response.getStream(), + GetCampaign200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (campaignId != null) { + request.addPathParam("campaign_id", campaignId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/GetScheduledCampaign.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/GetScheduledCampaign.java new file mode 100644 index 00000000..4c2db719 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/GetScheduledCampaign.java @@ -0,0 +1,109 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns; + +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.lmccampaigns.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccampaigns.models.ViewScheduledTimeOfACampaignResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetScheduledCampaign extends ApiKeyBase { + + private final Integer campaignId; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/campaigns/{campaign_id}/schedules"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetScheduledCampaign creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + ViewScheduledTimeOfACampaignResponse.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (campaignId != null) { + request.addPathParam("campaign_id", campaignId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/ListCampaign.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/ListCampaign.java new file mode 100644 index 00000000..75e8c914 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/ListCampaign.java @@ -0,0 +1,101 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns; + +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.lmccampaigns.models.ListCampaign200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListCampaign extends ApiKeyBase { + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/campaigns"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListCampaign creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + ListCampaign200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/ScheduleCampaign.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/ScheduleCampaign.java new file mode 100644 index 00000000..e1be9d05 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/ScheduleCampaign.java @@ -0,0 +1,159 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns; + +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.lmccampaigns.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccampaigns.models.ScheduleACampaignRequest; +import com.sendgrid.rest.api.v3.lmccampaigns.models.ScheduleACampaignResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ScheduleCampaign extends ApiKeyBase { + + private final Integer campaignId; + + @Setter + private String onBehalfOf; + + @Setter + private ScheduleACampaignRequest scheduleACampaignRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/campaigns/{campaign_id}/schedules"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ScheduleCampaign 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + ScheduleACampaignResponse.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (campaignId != null) { + request.addPathParam("campaign_id", campaignId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (scheduleACampaignRequest != null) { + request.addBody(JsonUtil.toJson(scheduleACampaignRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/SendCampaign.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/SendCampaign.java new file mode 100644 index 00000000..ad10eb6f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/SendCampaign.java @@ -0,0 +1,148 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns; + +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.lmccampaigns.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccampaigns.models.SendACampaignResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class SendCampaign extends ApiKeyBase { + + private final Integer campaignId; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/campaigns/{campaign_id}/schedules/now"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "SendCampaign 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + SendACampaignResponse.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (campaignId != null) { + request.addPathParam("campaign_id", campaignId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/SendTestCampaign.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/SendTestCampaign.java new file mode 100644 index 00000000..7a2c5424 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/SendTestCampaign.java @@ -0,0 +1,133 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns; + +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.lmccampaigns.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccampaigns.models.SendATestCampaignRequest; +import com.sendgrid.rest.api.v3.lmccampaigns.models.SendTestCampaignRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class SendTestCampaign extends ApiKeyBase { + + private final Integer campaignId; + + @Setter + private String onBehalfOf; + + @Setter + private SendTestCampaignRequest sendTestCampaignRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/campaigns/{campaign_id}/schedules/test"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "SendTestCampaign 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + SendATestCampaignRequest.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (campaignId != null) { + request.addPathParam("campaign_id", campaignId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (sendTestCampaignRequest != null) { + request.addBody(JsonUtil.toJson(sendTestCampaignRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/UnScheduleCampaign.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/UnScheduleCampaign.java new file mode 100644 index 00000000..4966a0c1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/UnScheduleCampaign.java @@ -0,0 +1,116 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns; + +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.lmccampaigns.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UnScheduleCampaign extends ApiKeyBase { + + private final Integer campaignId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/campaigns/{campaign_id}/schedules"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UnScheduleCampaign creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (campaignId != null) { + request.addPathParam("campaign_id", campaignId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/UpdateCampaign.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/UpdateCampaign.java new file mode 100644 index 00000000..55682370 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/UpdateCampaign.java @@ -0,0 +1,154 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns; + +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.lmccampaigns.models.Campaigns2xx; +import com.sendgrid.rest.api.v3.lmccampaigns.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccampaigns.models.UpdateACampaignRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateCampaign extends ApiKeyBase { + + private final Integer campaignId; + + @Setter + private String onBehalfOf; + + @Setter + private UpdateACampaignRequest updateACampaignRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/campaigns/{campaign_id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateCampaign 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), Campaigns2xx.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (campaignId != null) { + request.addPathParam("campaign_id", campaignId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateACampaignRequest != null) { + request.addBody(JsonUtil.toJson(updateACampaignRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/UpdateScheduledCampaign.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/UpdateScheduledCampaign.java new file mode 100644 index 00000000..7c7f2fa0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/UpdateScheduledCampaign.java @@ -0,0 +1,146 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns; + +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.lmccampaigns.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccampaigns.models.UpdateAScheduledCampaignRequest; +import com.sendgrid.rest.api.v3.lmccampaigns.models.UpdateAScheduledCampaignResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateScheduledCampaign extends ApiKeyBase { + + private final Integer campaignId; + + @Setter + private String onBehalfOf; + + @Setter + private UpdateAScheduledCampaignRequest updateAScheduledCampaignRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/campaigns/{campaign_id}/schedules"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateScheduledCampaign 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + UpdateAScheduledCampaignResponse.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (campaignId != null) { + request.addPathParam("campaign_id", campaignId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateAScheduledCampaignRequest != null) { + request.addBody(JsonUtil.toJson(updateAScheduledCampaignRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/Campaigns2xx.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/Campaigns2xx.java new file mode 100644 index 00000000..a53a4724 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/Campaigns2xx.java @@ -0,0 +1,246 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccampaigns.models.Editor; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Campaigns2xx { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("title") + @Getter + @Setter + private String title; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subject") + @Getter + @Setter + private String subject; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sender_id") + @Getter + @Setter + private Integer senderId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list_ids") + @Getter + @Setter + private List listIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("segment_ids") + @Getter + @Setter + private List segmentIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("categories") + @Getter + @Setter + private List categories; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("suppression_group_id") + @Getter + @Setter + private Integer suppressionGroupId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_unsubscribe_url") + @Getter + @Setter + private String customUnsubscribeUrl; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip_pool") + @Getter + @Setter + private String ipPool; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html_content") + @Getter + @Setter + private String htmlContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("plain_content") + @Getter + @Setter + private String plainContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("editor") + @Getter + @Setter + private Editor editor; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private String status; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + public Campaigns2xx() {} + + private Campaigns2xx(Builder builder) { + this.title = builder.title; + this.subject = builder.subject; + this.senderId = builder.senderId; + this.listIds = builder.listIds; + this.segmentIds = builder.segmentIds; + this.categories = builder.categories; + this.suppressionGroupId = builder.suppressionGroupId; + this.customUnsubscribeUrl = builder.customUnsubscribeUrl; + this.ipPool = builder.ipPool; + this.htmlContent = builder.htmlContent; + this.plainContent = builder.plainContent; + this.editor = builder.editor; + this.status = builder.status; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private String title; + private String subject; + private Integer senderId; + private List listIds; + private List segmentIds; + private List categories; + private Integer suppressionGroupId; + private String customUnsubscribeUrl; + private String ipPool; + private String htmlContent; + private String plainContent; + private Editor editor; + private String status; + private Integer id; + + public Builder(String title, String status) { + this.title = title; + this.status = status; + } + + public Builder subject(String subject) { + this.subject = subject; + return this; + } + + public Builder senderId(Integer senderId) { + this.senderId = senderId; + return this; + } + + public Builder listIds(List listIds) { + this.listIds = listIds; + return this; + } + + public Builder segmentIds(List segmentIds) { + this.segmentIds = segmentIds; + return this; + } + + public Builder categories(List categories) { + this.categories = categories; + return this; + } + + public Builder suppressionGroupId(Integer suppressionGroupId) { + this.suppressionGroupId = suppressionGroupId; + return this; + } + + public Builder customUnsubscribeUrl(String customUnsubscribeUrl) { + this.customUnsubscribeUrl = customUnsubscribeUrl; + return this; + } + + public Builder ipPool(String ipPool) { + this.ipPool = ipPool; + return this; + } + + public Builder htmlContent(String htmlContent) { + this.htmlContent = htmlContent; + return this; + } + + public Builder plainContent(String plainContent) { + this.plainContent = plainContent; + return this; + } + + public Builder editor(Editor editor) { + this.editor = editor; + return this; + } + + public Builder id(Integer id) { + this.id = id; + return this; + } + + public Campaigns2xx build() { + return new Campaigns2xx(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Campaigns2xx.class.getSimpleName() + "(", + ")" + ); + if (title != null) joiner.add("title=" + title); + if (subject != null) joiner.add("subject=" + subject); + if (senderId != null) joiner.add("senderId=" + senderId); + if (listIds != null) joiner.add("listIds=" + listIds); + if (segmentIds != null) joiner.add("segmentIds=" + segmentIds); + if (categories != null) joiner.add("categories=" + categories); + if (suppressionGroupId != null) joiner.add( + "suppressionGroupId=" + suppressionGroupId + ); + if (customUnsubscribeUrl != null) joiner.add( + "customUnsubscribeUrl=" + customUnsubscribeUrl + ); + if (ipPool != null) joiner.add("ipPool=" + ipPool); + if (htmlContent != null) joiner.add("htmlContent=" + htmlContent); + if (plainContent != null) joiner.add("plainContent=" + plainContent); + if (editor != null) joiner.add("editor=" + editor); + if (status != null) joiner.add("status=" + status); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/Editor.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/Editor.java new file mode 100644 index 00000000..a98b2151 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/Editor.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Editor { + CODE("code"), + + DESIGN("design"); + + private final String value; + + private Editor(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Editor forValue(final String value) { + return Promoter.enumFromString(value, Editor.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ErrorResponse.java new file mode 100644 index 00000000..f5d69561 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccampaigns.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..50ab029c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/GetCampaign200Response.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/GetCampaign200Response.java new file mode 100644 index 00000000..b0ce2d33 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/GetCampaign200Response.java @@ -0,0 +1,238 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetCampaign200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("categories") + @Getter + @Setter + private List categories; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_unsubscribe_url") + @Getter + @Setter + private String customUnsubscribeUrl; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html_content") + @Getter + @Setter + private String htmlContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip_pool") + @Getter + @Setter + private String ipPool; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list_ids") + @Getter + @Setter + private List listIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("plain_content") + @Getter + @Setter + private String plainContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("segment_ids") + @Getter + @Setter + private List segmentIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sender_id") + @Getter + @Setter + private Integer senderId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private String status; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subject") + @Getter + @Setter + private String subject; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("suppression_group_id") + @Getter + @Setter + private Integer suppressionGroupId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("title") + @Getter + @Setter + private String title; + + public GetCampaign200Response() {} + + private GetCampaign200Response(Builder builder) { + this.categories = builder.categories; + this.customUnsubscribeUrl = builder.customUnsubscribeUrl; + this.htmlContent = builder.htmlContent; + this.id = builder.id; + this.ipPool = builder.ipPool; + this.listIds = builder.listIds; + this.plainContent = builder.plainContent; + this.segmentIds = builder.segmentIds; + this.senderId = builder.senderId; + this.status = builder.status; + this.subject = builder.subject; + this.suppressionGroupId = builder.suppressionGroupId; + this.title = builder.title; + } + + // Builder class for constructing object + public static class Builder { + + private List categories; + private String customUnsubscribeUrl; + private String htmlContent; + private Integer id; + private String ipPool; + private List listIds; + private String plainContent; + private List segmentIds; + private Integer senderId; + private String status; + private String subject; + private Integer suppressionGroupId; + private String title; + + public Builder() {} + + public Builder categories(List categories) { + this.categories = categories; + return this; + } + + public Builder customUnsubscribeUrl(String customUnsubscribeUrl) { + this.customUnsubscribeUrl = customUnsubscribeUrl; + return this; + } + + public Builder htmlContent(String htmlContent) { + this.htmlContent = htmlContent; + return this; + } + + public Builder id(Integer id) { + this.id = id; + return this; + } + + public Builder ipPool(String ipPool) { + this.ipPool = ipPool; + return this; + } + + public Builder listIds(List listIds) { + this.listIds = listIds; + return this; + } + + public Builder plainContent(String plainContent) { + this.plainContent = plainContent; + return this; + } + + public Builder segmentIds(List segmentIds) { + this.segmentIds = segmentIds; + return this; + } + + public Builder senderId(Integer senderId) { + this.senderId = senderId; + return this; + } + + public Builder status(String status) { + this.status = status; + return this; + } + + public Builder subject(String subject) { + this.subject = subject; + return this; + } + + public Builder suppressionGroupId(Integer suppressionGroupId) { + this.suppressionGroupId = suppressionGroupId; + return this; + } + + public Builder title(String title) { + this.title = title; + return this; + } + + public GetCampaign200Response build() { + return new GetCampaign200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetCampaign200Response.class.getSimpleName() + "(", + ")" + ); + if (categories != null) joiner.add("categories=" + categories); + if (customUnsubscribeUrl != null) joiner.add( + "customUnsubscribeUrl=" + customUnsubscribeUrl + ); + if (htmlContent != null) joiner.add("htmlContent=" + htmlContent); + if (id != null) joiner.add("id=" + id); + if (ipPool != null) joiner.add("ipPool=" + ipPool); + if (listIds != null) joiner.add("listIds=" + listIds); + if (plainContent != null) joiner.add("plainContent=" + plainContent); + if (segmentIds != null) joiner.add("segmentIds=" + segmentIds); + if (senderId != null) joiner.add("senderId=" + senderId); + if (status != null) joiner.add("status=" + status); + if (subject != null) joiner.add("subject=" + subject); + if (suppressionGroupId != null) joiner.add( + "suppressionGroupId=" + suppressionGroupId + ); + if (title != null) joiner.add("title=" + title); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ListCampaign200Response.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ListCampaign200Response.java new file mode 100644 index 00000000..a61a29c1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ListCampaign200Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccampaigns.models.Campaigns2xx; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListCampaign200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + public ListCampaign200Response() {} + + private ListCampaign200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + + public Builder() {} + + public Builder result(List result) { + this.result = result; + return this; + } + + public ListCampaign200Response build() { + return new ListCampaign200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListCampaign200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/PostCampaignsRequest.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/PostCampaignsRequest.java new file mode 100644 index 00000000..e86f1d2e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/PostCampaignsRequest.java @@ -0,0 +1,222 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccampaigns.models.Editor; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class PostCampaignsRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("title") + @Getter + @Setter + private String title; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subject") + @Getter + @Setter + private String subject; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sender_id") + @Getter + @Setter + private Integer senderId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list_ids") + @Getter + @Setter + private List listIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("segment_ids") + @Getter + @Setter + private List segmentIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("categories") + @Getter + @Setter + private List categories; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("suppression_group_id") + @Getter + @Setter + private Integer suppressionGroupId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_unsubscribe_url") + @Getter + @Setter + private String customUnsubscribeUrl; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip_pool") + @Getter + @Setter + private String ipPool; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html_content") + @Getter + @Setter + private String htmlContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("plain_content") + @Getter + @Setter + private String plainContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("editor") + @Getter + @Setter + private Editor editor; + + public PostCampaignsRequest() {} + + private PostCampaignsRequest(Builder builder) { + this.title = builder.title; + this.subject = builder.subject; + this.senderId = builder.senderId; + this.listIds = builder.listIds; + this.segmentIds = builder.segmentIds; + this.categories = builder.categories; + this.suppressionGroupId = builder.suppressionGroupId; + this.customUnsubscribeUrl = builder.customUnsubscribeUrl; + this.ipPool = builder.ipPool; + this.htmlContent = builder.htmlContent; + this.plainContent = builder.plainContent; + this.editor = builder.editor; + } + + // Builder class for constructing object + public static class Builder { + + private String title; + private String subject; + private Integer senderId; + private List listIds; + private List segmentIds; + private List categories; + private Integer suppressionGroupId; + private String customUnsubscribeUrl; + private String ipPool; + private String htmlContent; + private String plainContent; + private Editor editor; + + public Builder(String title) { + this.title = title; + } + + public Builder subject(String subject) { + this.subject = subject; + return this; + } + + public Builder senderId(Integer senderId) { + this.senderId = senderId; + return this; + } + + public Builder listIds(List listIds) { + this.listIds = listIds; + return this; + } + + public Builder segmentIds(List segmentIds) { + this.segmentIds = segmentIds; + return this; + } + + public Builder categories(List categories) { + this.categories = categories; + return this; + } + + public Builder suppressionGroupId(Integer suppressionGroupId) { + this.suppressionGroupId = suppressionGroupId; + return this; + } + + public Builder customUnsubscribeUrl(String customUnsubscribeUrl) { + this.customUnsubscribeUrl = customUnsubscribeUrl; + return this; + } + + public Builder ipPool(String ipPool) { + this.ipPool = ipPool; + return this; + } + + public Builder htmlContent(String htmlContent) { + this.htmlContent = htmlContent; + return this; + } + + public Builder plainContent(String plainContent) { + this.plainContent = plainContent; + return this; + } + + public Builder editor(Editor editor) { + this.editor = editor; + return this; + } + + public PostCampaignsRequest build() { + return new PostCampaignsRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + PostCampaignsRequest.class.getSimpleName() + "(", + ")" + ); + if (title != null) joiner.add("title=" + title); + if (subject != null) joiner.add("subject=" + subject); + if (senderId != null) joiner.add("senderId=" + senderId); + if (listIds != null) joiner.add("listIds=" + listIds); + if (segmentIds != null) joiner.add("segmentIds=" + segmentIds); + if (categories != null) joiner.add("categories=" + categories); + if (suppressionGroupId != null) joiner.add( + "suppressionGroupId=" + suppressionGroupId + ); + if (customUnsubscribeUrl != null) joiner.add( + "customUnsubscribeUrl=" + customUnsubscribeUrl + ); + if (ipPool != null) joiner.add("ipPool=" + ipPool); + if (htmlContent != null) joiner.add("htmlContent=" + htmlContent); + if (plainContent != null) joiner.add("plainContent=" + plainContent); + if (editor != null) joiner.add("editor=" + editor); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ScheduleACampaignRequest.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ScheduleACampaignRequest.java new file mode 100644 index 00000000..f903e9ce --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ScheduleACampaignRequest.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ScheduleACampaignRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("send_at") + @Getter + @Setter + private Integer sendAt; + + public ScheduleACampaignRequest() {} + + private ScheduleACampaignRequest(Builder builder) { + this.sendAt = builder.sendAt; + } + + // Builder class for constructing object + public static class Builder { + + private Integer sendAt; + + public Builder(Integer sendAt) { + this.sendAt = sendAt; + } + + public ScheduleACampaignRequest build() { + return new ScheduleACampaignRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ScheduleACampaignRequest.class.getSimpleName() + "(", + ")" + ); + if (sendAt != null) joiner.add("sendAt=" + sendAt); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ScheduleACampaignResponse.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ScheduleACampaignResponse.java new file mode 100644 index 00000000..837a8d15 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ScheduleACampaignResponse.java @@ -0,0 +1,83 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccampaigns.models.Status; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ScheduleACampaignResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("send_at") + @Getter + @Setter + private Integer sendAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private Status status; + + public ScheduleACampaignResponse() {} + + private ScheduleACampaignResponse(Builder builder) { + this.id = builder.id; + this.sendAt = builder.sendAt; + this.status = builder.status; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private Integer sendAt; + private Status status; + + public Builder(Integer id, Integer sendAt, Status status) { + this.id = id; + this.sendAt = sendAt; + this.status = status; + } + + public ScheduleACampaignResponse build() { + return new ScheduleACampaignResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ScheduleACampaignResponse.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (sendAt != null) joiner.add("sendAt=" + sendAt); + if (status != null) joiner.add("status=" + status); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/SendACampaignResponse.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/SendACampaignResponse.java new file mode 100644 index 00000000..9c2c9a16 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/SendACampaignResponse.java @@ -0,0 +1,72 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendACampaignResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Long id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private String status; + + public SendACampaignResponse() {} + + private SendACampaignResponse(Builder builder) { + this.id = builder.id; + this.status = builder.status; + } + + // Builder class for constructing object + public static class Builder { + + private Long id; + private String status; + + public Builder(Long id, String status) { + this.id = id; + this.status = status; + } + + public SendACampaignResponse build() { + return new SendACampaignResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendACampaignResponse.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (status != null) joiner.add("status=" + status); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/SendATestCampaignRequest.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/SendATestCampaignRequest.java new file mode 100644 index 00000000..1150f9ab --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/SendATestCampaignRequest.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendATestCampaignRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("to") + @Getter + @Setter + private String to; + + public SendATestCampaignRequest() {} + + private SendATestCampaignRequest(Builder builder) { + this.to = builder.to; + } + + // Builder class for constructing object + public static class Builder { + + private String to; + + public Builder(String to) { + this.to = to; + } + + public SendATestCampaignRequest build() { + return new SendATestCampaignRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendATestCampaignRequest.class.getSimpleName() + "(", + ")" + ); + if (to != null) joiner.add("to=" + to); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/SendTestCampaignRequest.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/SendTestCampaignRequest.java new file mode 100644 index 00000000..b16790a0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/SendTestCampaignRequest.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendTestCampaignRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("to") + @Getter + @Setter + private String to; + + public SendTestCampaignRequest() {} + + private SendTestCampaignRequest(Builder builder) { + this.to = builder.to; + } + + // Builder class for constructing object + public static class Builder { + + private String to; + + public Builder(String to) { + this.to = to; + } + + public SendTestCampaignRequest build() { + return new SendTestCampaignRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendTestCampaignRequest.class.getSimpleName() + "(", + ")" + ); + if (to != null) joiner.add("to=" + to); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/Status.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/Status.java new file mode 100644 index 00000000..5be87419 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/Status.java @@ -0,0 +1,40 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Status { + SCHEDULED("Scheduled"); + + private final String value; + + private Status(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Status forValue(final String value) { + return Promoter.enumFromString(value, Status.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/UpdateACampaignRequest.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/UpdateACampaignRequest.java new file mode 100644 index 00000000..05b7e511 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/UpdateACampaignRequest.java @@ -0,0 +1,109 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateACampaignRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("title") + @Getter + @Setter + private String title; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subject") + @Getter + @Setter + private String subject; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("categories") + @Getter + @Setter + private List categories; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html_content") + @Getter + @Setter + private String htmlContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("plain_content") + @Getter + @Setter + private String plainContent; + + public UpdateACampaignRequest() {} + + private UpdateACampaignRequest(Builder builder) { + this.title = builder.title; + this.subject = builder.subject; + this.categories = builder.categories; + this.htmlContent = builder.htmlContent; + this.plainContent = builder.plainContent; + } + + // Builder class for constructing object + public static class Builder { + + private String title; + private String subject; + private List categories; + private String htmlContent; + private String plainContent; + + public Builder( + String title, + String subject, + List categories, + String htmlContent, + String plainContent + ) { + this.title = title; + this.subject = subject; + this.categories = categories; + this.htmlContent = htmlContent; + this.plainContent = plainContent; + } + + public UpdateACampaignRequest build() { + return new UpdateACampaignRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateACampaignRequest.class.getSimpleName() + "(", + ")" + ); + if (title != null) joiner.add("title=" + title); + if (subject != null) joiner.add("subject=" + subject); + if (categories != null) joiner.add("categories=" + categories); + if (htmlContent != null) joiner.add("htmlContent=" + htmlContent); + if (plainContent != null) joiner.add("plainContent=" + plainContent); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/UpdateAScheduledCampaignRequest.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/UpdateAScheduledCampaignRequest.java new file mode 100644 index 00000000..95a32545 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/UpdateAScheduledCampaignRequest.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateAScheduledCampaignRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("send_at") + @Getter + @Setter + private Long sendAt; + + public UpdateAScheduledCampaignRequest() {} + + private UpdateAScheduledCampaignRequest(Builder builder) { + this.sendAt = builder.sendAt; + } + + // Builder class for constructing object + public static class Builder { + + private Long sendAt; + + public Builder(Long sendAt) { + this.sendAt = sendAt; + } + + public UpdateAScheduledCampaignRequest build() { + return new UpdateAScheduledCampaignRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateAScheduledCampaignRequest.class.getSimpleName() + "(", + ")" + ); + if (sendAt != null) joiner.add("sendAt=" + sendAt); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/UpdateAScheduledCampaignResponse.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/UpdateAScheduledCampaignResponse.java new file mode 100644 index 00000000..11e35dd2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/UpdateAScheduledCampaignResponse.java @@ -0,0 +1,82 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateAScheduledCampaignResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("send_at") + @Getter + @Setter + private Integer sendAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private String status; + + public UpdateAScheduledCampaignResponse() {} + + private UpdateAScheduledCampaignResponse(Builder builder) { + this.id = builder.id; + this.sendAt = builder.sendAt; + this.status = builder.status; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private Integer sendAt; + private String status; + + public Builder(Integer id, Integer sendAt, String status) { + this.id = id; + this.sendAt = sendAt; + this.status = status; + } + + public UpdateAScheduledCampaignResponse build() { + return new UpdateAScheduledCampaignResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateAScheduledCampaignResponse.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (sendAt != null) joiner.add("sendAt=" + sendAt); + if (status != null) joiner.add("status=" + status); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ViewScheduledTimeOfACampaignResponse.java b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ViewScheduledTimeOfACampaignResponse.java new file mode 100644 index 00000000..64ed97b3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccampaigns/models/ViewScheduledTimeOfACampaignResponse.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Campaigns API + * The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccampaigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ViewScheduledTimeOfACampaignResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("send_at") + @Getter + @Setter + private Long sendAt; + + public ViewScheduledTimeOfACampaignResponse() {} + + private ViewScheduledTimeOfACampaignResponse(Builder builder) { + this.sendAt = builder.sendAt; + } + + // Builder class for constructing object + public static class Builder { + + private Long sendAt; + + public Builder(Long sendAt) { + this.sendAt = sendAt; + } + + public ViewScheduledTimeOfACampaignResponse build() { + return new ViewScheduledTimeOfACampaignResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ViewScheduledTimeOfACampaignResponse.class.getSimpleName() + "(", + ")" + ); + if (sendAt != null) joiner.add("sendAt=" + sendAt); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/AddRecipient.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/AddRecipient.java new file mode 100644 index 00000000..abb12673 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/AddRecipient.java @@ -0,0 +1,125 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.AddRecipientRequestInner; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ContactdbRecipientResponse201; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class AddRecipient extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private List addRecipientRequestInner; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/recipients"; + 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( + "AddRecipient 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + ContactdbRecipientResponse201.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (addRecipientRequestInner != null) { + request.addBody(JsonUtil.toJson(addRecipientRequestInner)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/AddRecipientToContactDbList.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/AddRecipientToContactDbList.java new file mode 100644 index 00000000..12d50dc3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/AddRecipientToContactDbList.java @@ -0,0 +1,134 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class AddRecipientToContactDbList extends ApiKeyBase { + + private final Integer listsId; + private final String recipientsId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = + "/v3/contactdb/lists/{lists_id}/recipients/{recipients_id}"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "AddRecipientToContactDbList 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (listsId != null) { + request.addPathParam("lists_id", listsId.toString()); + } + if (recipientsId != null) { + request.addPathParam("recipients_id", recipientsId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/AddRecipientsToContactDbList.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/AddRecipientsToContactDbList.java new file mode 100644 index 00000000..cdf24310 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/AddRecipientsToContactDbList.java @@ -0,0 +1,140 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class AddRecipientsToContactDbList extends ApiKeyBase { + + private final Integer listsId; + + @Setter + private String onBehalfOf; + + @Setter + private List requestBody; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/contactdb/lists/{lists_id}/recipients"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "AddRecipientsToContactDbList 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (listsId != null) { + request.addPathParam("lists_id", listsId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (requestBody != null) { + request.addBody(JsonUtil.toJson(requestBody)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/CreateContactDbList.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/CreateContactDbList.java new file mode 100644 index 00000000..f129cf10 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/CreateContactDbList.java @@ -0,0 +1,119 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ContactdbList2xx; +import com.sendgrid.rest.api.v3.lmccontactdb.models.CreateAListRequest; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateContactDbList extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private CreateAListRequest createAListRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/contactdb/lists"; + 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( + "CreateContactDbList 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), ContactdbList2xx.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (createAListRequest != null) { + request.addBody(JsonUtil.toJson(createAListRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/CreateCustomField.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/CreateCustomField.java new file mode 100644 index 00000000..75f62149 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/CreateCustomField.java @@ -0,0 +1,111 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ContactdbCustomFieldId2xx; +import com.sendgrid.rest.api.v3.lmccontactdb.models.CreateCustomFieldRequest; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateCustomField extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private CreateCustomFieldRequest createCustomFieldRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/custom_fields"; + 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( + "CreateCustomField 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + ContactdbCustomFieldId2xx.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (createCustomFieldRequest != null) { + request.addBody(JsonUtil.toJson(createCustomFieldRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/CreateSegment.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/CreateSegment.java new file mode 100644 index 00000000..b9894ba2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/CreateSegment.java @@ -0,0 +1,124 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ContactdbSegments; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ContactdbSegmentsId200; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateSegment extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private ContactdbSegments contactdbSegments; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/segments"; + 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( + "CreateSegment 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + ContactdbSegmentsId200.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (contactdbSegments != null) { + request.addBody(JsonUtil.toJson(contactdbSegments)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteContactDbList.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteContactDbList.java new file mode 100644 index 00000000..cfd28823 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteContactDbList.java @@ -0,0 +1,150 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.DeleteContacts; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteContactDbList extends ApiKeyBase { + + private final String listsId; + + @Setter + private DeleteContacts deleteContacts; + + @Setter + private String onBehalfOf; + + @Setter + private Object body; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/contactdb/lists/{lists_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteContactDbList 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (listsId != null) { + request.addPathParam("lists_id", listsId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (deleteContacts != null) { + request.addQueryParam("delete_contacts", deleteContacts.toString()); + } + } + + private void addBody(final Request request) { + if (body != null) { + request.addBody(JsonUtil.toJson(body)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteContactDbLists.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteContactDbLists.java new file mode 100644 index 00000000..9f9e6991 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteContactDbLists.java @@ -0,0 +1,118 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteContactDbLists extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private List requestBody; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/contactdb/lists"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteContactDbLists 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), Object.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (requestBody != null) { + request.addBody(JsonUtil.toJson(requestBody)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteCustomField.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteCustomField.java new file mode 100644 index 00000000..11618431 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteCustomField.java @@ -0,0 +1,129 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteCustomField extends ApiKeyBase { + + private final Integer customFieldId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/contactdb/custom_fields/{custom_field_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteCustomField 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), ErrorResponse.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (customFieldId != null) { + request.addPathParam("custom_field_id", customFieldId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteRecipient.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteRecipient.java new file mode 100644 index 00000000..974b5fa7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteRecipient.java @@ -0,0 +1,129 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteRecipient extends ApiKeyBase { + + private final String recipientId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/contactdb/recipients/{recipient_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteRecipient 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (recipientId != null) { + request.addPathParam("recipient_id", recipientId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteRecipientFromContactDbList.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteRecipientFromContactDbList.java new file mode 100644 index 00000000..e19aafcd --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteRecipientFromContactDbList.java @@ -0,0 +1,156 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteRecipientFromContactDbList extends ApiKeyBase { + + private final Integer listsId; + private final String recipientsId; + private final Integer listId; + private final Integer recipientId; + + @Setter + private String onBehalfOf; + + @Setter + private Object body; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = + "/v3/contactdb/lists/{lists_id}/recipients/{recipients_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteRecipientFromContactDbList 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (listsId != null) { + request.addPathParam("lists_id", listsId.toString()); + } + if (recipientsId != null) { + request.addPathParam("recipients_id", recipientsId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (listId != null) { + request.addQueryParam("list_id", listId.toString()); + } + if (recipientId != null) { + request.addQueryParam("recipient_id", recipientId.toString()); + } + } + + private void addBody(final Request request) { + if (body != null) { + request.addBody(JsonUtil.toJson(body)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteRecipients.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteRecipients.java new file mode 100644 index 00000000..09bde0ae --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteRecipients.java @@ -0,0 +1,118 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteRecipients extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private List requestBody; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/contactdb/recipients"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteRecipients 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), Object.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (requestBody != null) { + request.addBody(JsonUtil.toJson(requestBody)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteSegment.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteSegment.java new file mode 100644 index 00000000..70551178 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/DeleteSegment.java @@ -0,0 +1,149 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteSegment extends ApiKeyBase { + + private final String segmentsId; + + @Setter + private Boolean deleteContacts; + + @Setter + private String onBehalfOf; + + @Setter + private Object body; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/contactdb/segments/{segments_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSegment 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (segmentsId != null) { + request.addPathParam("segments_id", segmentsId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (deleteContacts != null) { + request.addQueryParam("delete_contacts", deleteContacts.toString()); + } + } + + private void addBody(final Request request) { + if (body != null) { + request.addBody(JsonUtil.toJson(body)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetBillable.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetBillable.java new file mode 100644 index 00000000..21fe03d1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetBillable.java @@ -0,0 +1,100 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ContactdbRecipientCount200; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetBillable extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/recipients/billable_count"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetBillable 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + ContactdbRecipientCount200.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetContactDbList.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetContactDbList.java new file mode 100644 index 00000000..2cf6a5af --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetContactDbList.java @@ -0,0 +1,140 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ContactdbList2xx; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetContactDbList extends ApiKeyBase { + + private final String listsId; + + @Setter + private Integer listId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/contactdb/lists/{lists_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetContactDbList 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), ContactdbList2xx.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (listsId != null) { + request.addPathParam("lists_id", listsId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (listId != null) { + request.addQueryParam("list_id", listId.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetCustomField.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetCustomField.java new file mode 100644 index 00000000..840053ac --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetCustomField.java @@ -0,0 +1,135 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ContactdbCustomFieldId2xx; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetCustomField extends ApiKeyBase { + + private final Integer customFieldId; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/custom_fields/{custom_field_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetCustomField 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + ContactdbCustomFieldId2xx.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (customFieldId != null) { + request.addPathParam("custom_field_id", customFieldId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetRecipient.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetRecipient.java new file mode 100644 index 00000000..88379df7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetRecipient.java @@ -0,0 +1,135 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ContactdbRecipient200; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetRecipient extends ApiKeyBase { + + private final String recipientId; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/recipients/{recipient_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetRecipient 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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, + JsonUtil.fromJson( + response.getStream(), + ContactdbRecipient200.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (recipientId != null) { + request.addPathParam("recipient_id", recipientId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetRecipientList.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetRecipientList.java new file mode 100644 index 00000000..550a7f11 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetRecipientList.java @@ -0,0 +1,135 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccontactdb.models.GetRecipientList200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetRecipientList extends ApiKeyBase { + + private final String recipientId; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/recipients/{recipient_id}/lists"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetRecipientList 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + GetRecipientList200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (recipientId != null) { + request.addPathParam("recipient_id", recipientId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetSegment.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetSegment.java new file mode 100644 index 00000000..4fa8f1c2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/GetSegment.java @@ -0,0 +1,138 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ContactdbSegments; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetSegment extends ApiKeyBase { + + private final String segmentsId; + private final Integer segmentId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/contactdb/segments/{segments_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetSegment 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), ContactdbSegments.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (segmentsId != null) { + request.addPathParam("segments_id", segmentsId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (segmentId != null) { + request.addQueryParam("segment_id", segmentId.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListContactDbList.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListContactDbList.java new file mode 100644 index 00000000..57a32707 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListContactDbList.java @@ -0,0 +1,82 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ListAllListsResponse; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListContactDbList extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/lists"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListContactDbList creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), ListAllListsResponse.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListCustomField.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListCustomField.java new file mode 100644 index 00000000..750a592e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListCustomField.java @@ -0,0 +1,100 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ListAllCustomFieldsResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListCustomField extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/custom_fields"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListCustomField 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + ListAllCustomFieldsResponse.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListRecipient.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListRecipient.java new file mode 100644 index 00000000..0c112579 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListRecipient.java @@ -0,0 +1,129 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ListRecipientsResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListRecipient extends ApiKeyBase { + + @Setter + private Integer page; + + @Setter + private Integer pageSize; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/recipients"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListRecipient 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + ListRecipientsResponse.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (page != null) { + request.addQueryParam("page", page.toString()); + } + if (pageSize != null) { + request.addQueryParam("page_size", pageSize.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListRecipientCount.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListRecipientCount.java new file mode 100644 index 00000000..701b70be --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListRecipientCount.java @@ -0,0 +1,100 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ContactdbRecipientCount200; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListRecipientCount extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/recipients/count"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListRecipientCount 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + ContactdbRecipientCount200.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListRecipientForSegment.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListRecipientForSegment.java new file mode 100644 index 00000000..f028e593 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListRecipientForSegment.java @@ -0,0 +1,151 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ListRecipientsOnASegmentResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListRecipientForSegment extends ApiKeyBase { + + private final Integer segmentId; + + @Setter + private Integer page; + + @Setter + private Integer pageSize; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/segments/{segment_id}/recipients"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListRecipientForSegment 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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, + JsonUtil.fromJson( + response.getStream(), + ListRecipientsOnASegmentResponse.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (segmentId != null) { + request.addPathParam("segment_id", segmentId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (page != null) { + request.addQueryParam("page", page.toString()); + } + if (pageSize != null) { + request.addQueryParam("page_size", pageSize.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListRecipientsFromContactDbList.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListRecipientsFromContactDbList.java new file mode 100644 index 00000000..8a7a201b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListRecipientsFromContactDbList.java @@ -0,0 +1,143 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ListRecipientsFromContactDbList200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListRecipientsFromContactDbList extends ApiKeyBase { + + private final Integer listsId; + + @Setter + private Integer page; + + @Setter + private Integer pageSize; + + private final Integer listId; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/lists/{lists_id}/recipients"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListRecipientsFromContactDbList 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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, + JsonUtil.fromJson( + response.getStream(), + ListRecipientsFromContactDbList200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (listsId != null) { + request.addPathParam("lists_id", listsId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (page != null) { + request.addQueryParam("page", page.toString()); + } + if (pageSize != null) { + request.addQueryParam("page_size", pageSize.toString()); + } + if (listId != null) { + request.addQueryParam("list_id", listId.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListReservedField.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListReservedField.java new file mode 100644 index 00000000..86006a5a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListReservedField.java @@ -0,0 +1,100 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ListReservedField200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListReservedField extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/reserved_fields"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListReservedField 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + ListReservedField200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListSearchRecipient.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListSearchRecipient.java new file mode 100644 index 00000000..f43b83bb --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListSearchRecipient.java @@ -0,0 +1,126 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ListRecipientsFromContactDbList200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSearchRecipient extends ApiKeyBase { + + @Setter + private String leftCurlyBracketFieldNameRightCurlyBracket; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/recipients/search"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSearchRecipient 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + ListRecipientsFromContactDbList200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (leftCurlyBracketFieldNameRightCurlyBracket != null) { + request.addQueryParam( + "{field_name}", + leftCurlyBracketFieldNameRightCurlyBracket.toString() + ); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListSegment.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListSegment.java new file mode 100644 index 00000000..d1768298 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListSegment.java @@ -0,0 +1,100 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ListAllSegmentsResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSegment extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/segments"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSegment 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + ListAllSegmentsResponse.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListStatus.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListStatus.java new file mode 100644 index 00000000..e96191b1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/ListStatus.java @@ -0,0 +1,85 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ListStatus200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListStatus extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/status"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListStatus creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + ListStatus200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/SearchRecipient.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/SearchRecipient.java new file mode 100644 index 00000000..46ece038 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/SearchRecipient.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.SearchRecipient200Response; +import com.sendgrid.rest.api.v3.lmccontactdb.models.SearchRecipientRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class SearchRecipient extends ApiKeyBase { + + @Setter + private SearchRecipientRequest searchRecipientRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/recipients/search"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "SearchRecipient creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + + 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 addBody(final Request request) { + if (searchRecipientRequest != null) { + request.addBody(JsonUtil.toJson(searchRecipientRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/UpdateContactDbList.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/UpdateContactDbList.java new file mode 100644 index 00000000..ef65ff7d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/UpdateContactDbList.java @@ -0,0 +1,141 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccontactdb.models.UpdateAListRequest; +import com.sendgrid.rest.api.v3.lmccontactdb.models.UpdateContactDbList200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateContactDbList extends ApiKeyBase { + + private final String listsId; + private final Integer listId; + + @Setter + private String onBehalfOf; + + @Setter + private UpdateAListRequest updateAListRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/lists/{lists_id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateContactDbList 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + UpdateContactDbList200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (listsId != null) { + request.addPathParam("lists_id", listsId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (listId != null) { + request.addQueryParam("list_id", listId.toString()); + } + } + + private void addBody(final Request request) { + if (updateAListRequest != null) { + request.addBody(JsonUtil.toJson(updateAListRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/UpdateRecipient.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/UpdateRecipient.java new file mode 100644 index 00000000..0b67f9b2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/UpdateRecipient.java @@ -0,0 +1,125 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ContactdbRecipientResponse201; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccontactdb.models.UpdateRecipientRequestInner; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateRecipient extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private List updateRecipientRequestInner; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/contactdb/recipients"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateRecipient 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + ContactdbRecipientResponse201.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateRecipientRequestInner != null) { + request.addBody(JsonUtil.toJson(updateRecipientRequestInner)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/UpdateSegment.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/UpdateSegment.java new file mode 100644 index 00000000..7e470c03 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/UpdateSegment.java @@ -0,0 +1,138 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb; + +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.lmccontactdb.models.ContactdbSegments; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ErrorResponse; +import com.sendgrid.rest.api.v3.lmccontactdb.models.UpdateSegmentRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateSegment extends ApiKeyBase { + + private final String segmentsId; + + @Setter + private String segmentId; + + @Setter + private String onBehalfOf; + + @Setter + private UpdateSegmentRequest updateSegmentRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/contactdb/segments/{segments_id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateSegment 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), ContactdbSegments.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (segmentsId != null) { + request.addPathParam("segments_id", segmentsId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (segmentId != null) { + request.addQueryParam("segment_id", segmentId.toString()); + } + } + + private void addBody(final Request request) { + if (updateSegmentRequest != null) { + request.addBody(JsonUtil.toJson(updateSegmentRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/AddRecipientRequestInner.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/AddRecipientRequestInner.java new file mode 100644 index 00000000..d3b5eecb --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/AddRecipientRequestInner.java @@ -0,0 +1,104 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddRecipientRequestInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("age") + @Getter + @Setter + private Integer age; + + public AddRecipientRequestInner() {} + + private AddRecipientRequestInner(Builder builder) { + this.email = builder.email; + this.firstName = builder.firstName; + this.lastName = builder.lastName; + this.age = builder.age; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + private String firstName; + private String lastName; + private Integer age; + + public Builder(String email) { + this.email = email; + } + + public Builder firstName(String firstName) { + this.firstName = firstName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = lastName; + return this; + } + + public Builder age(Integer age) { + this.age = age; + return this; + } + + public AddRecipientRequestInner build() { + return new AddRecipientRequestInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddRecipientRequestInner.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + if (firstName != null) joiner.add("firstName=" + firstName); + if (lastName != null) joiner.add("lastName=" + lastName); + if (age != null) joiner.add("age=" + age); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/AndOr.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/AndOr.java new file mode 100644 index 00000000..e783f550 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/AndOr.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum AndOr { + AND("and"), + + OR("or"), + + EMPTY(""); + + private final String value; + + private AndOr(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static AndOr forValue(final String value) { + return Promoter.enumFromString(value, AndOr.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbCustomField.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbCustomField.java new file mode 100644 index 00000000..93a3de5b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbCustomField.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.Type; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactdbCustomField { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private Type type; + + public ContactdbCustomField() {} + + private ContactdbCustomField(Builder builder) { + this.name = builder.name; + this.type = builder.type; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private Type type; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder type(Type type) { + this.type = type; + return this; + } + + public ContactdbCustomField build() { + return new ContactdbCustomField(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactdbCustomField.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (type != null) joiner.add("type=" + type); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbCustomFieldId2xx.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbCustomFieldId2xx.java new file mode 100644 index 00000000..6aba4f86 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbCustomFieldId2xx.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.Type; +import java.math.BigDecimal; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactdbCustomFieldId2xx { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private Type type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private BigDecimal id; + + public ContactdbCustomFieldId2xx() {} + + private ContactdbCustomFieldId2xx(Builder builder) { + this.name = builder.name; + this.type = builder.type; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private Type type; + private BigDecimal id; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder type(Type type) { + this.type = type; + return this; + } + + public Builder id(BigDecimal id) { + this.id = id; + return this; + } + + public ContactdbCustomFieldId2xx build() { + return new ContactdbCustomFieldId2xx(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactdbCustomFieldId2xx.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (type != null) joiner.add("type=" + type); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbCustomFieldIdValue.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbCustomFieldIdValue.java new file mode 100644 index 00000000..213356fa --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbCustomFieldIdValue.java @@ -0,0 +1,109 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.Type; +import java.math.BigDecimal; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactdbCustomFieldIdValue { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private Type type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private BigDecimal id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("value") + @Getter + @Setter + private String value; + + public ContactdbCustomFieldIdValue() {} + + private ContactdbCustomFieldIdValue(Builder builder) { + this.name = builder.name; + this.type = builder.type; + this.id = builder.id; + this.value = builder.value; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private Type type; + private BigDecimal id; + private String value; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder type(Type type) { + this.type = type; + return this; + } + + public Builder id(BigDecimal id) { + this.id = id; + return this; + } + + public Builder value(String value) { + this.value = value; + return this; + } + + public ContactdbCustomFieldIdValue build() { + return new ContactdbCustomFieldIdValue(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactdbCustomFieldIdValue.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (type != null) joiner.add("type=" + type); + if (id != null) joiner.add("id=" + id); + if (value != null) joiner.add("value=" + value); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbList2xx.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbList2xx.java new file mode 100644 index 00000000..920e98f9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbList2xx.java @@ -0,0 +1,84 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactdbList2xx { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("recipient_count") + @Getter + @Setter + private Integer recipientCount; + + public ContactdbList2xx() {} + + private ContactdbList2xx(Builder builder) { + this.id = builder.id; + this.name = builder.name; + this.recipientCount = builder.recipientCount; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private String name; + private Integer recipientCount; + + public Builder(Integer id, String name, Integer recipientCount) { + this.id = id; + this.name = name; + this.recipientCount = recipientCount; + } + + public ContactdbList2xx build() { + return new ContactdbList2xx(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactdbList2xx.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (name != null) joiner.add("name=" + name); + if (recipientCount != null) joiner.add( + "recipientCount=" + recipientCount + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbRecipient200.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbRecipient200.java new file mode 100644 index 00000000..f34ccc0d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbRecipient200.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ContactdbRecipient200RecipientsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactdbRecipient200 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("recipients") + @Getter + @Setter + private List recipients; + + public ContactdbRecipient200() {} + + private ContactdbRecipient200(Builder builder) { + this.recipients = builder.recipients; + } + + // Builder class for constructing object + public static class Builder { + + private List recipients; + + public Builder() {} + + public Builder recipients( + List recipients + ) { + this.recipients = recipients; + return this; + } + + public ContactdbRecipient200 build() { + return new ContactdbRecipient200(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactdbRecipient200.class.getSimpleName() + "(", + ")" + ); + if (recipients != null) joiner.add("recipients=" + recipients); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbRecipient200RecipientsInner.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbRecipient200RecipientsInner.java new file mode 100644 index 00000000..fce0846a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbRecipient200RecipientsInner.java @@ -0,0 +1,193 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ContactdbCustomFieldIdValue; +import java.math.BigDecimal; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactdbRecipient200RecipientsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private BigDecimal createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_fields") + @Getter + @Setter + private List customFields; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_clicked") + @Getter + @Setter + private BigDecimal lastClicked; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_emailed") + @Getter + @Setter + private BigDecimal lastEmailed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_opened") + @Getter + @Setter + private BigDecimal lastOpened; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private BigDecimal updatedAt; + + public ContactdbRecipient200RecipientsInner() {} + + private ContactdbRecipient200RecipientsInner(Builder builder) { + this.id = builder.id; + this.createdAt = builder.createdAt; + this.customFields = builder.customFields; + this.email = builder.email; + this.firstName = builder.firstName; + this.lastName = builder.lastName; + this.lastClicked = builder.lastClicked; + this.lastEmailed = builder.lastEmailed; + this.lastOpened = builder.lastOpened; + this.updatedAt = builder.updatedAt; + } + + // Builder class for constructing object + public static class Builder { + + private String id; + private BigDecimal createdAt; + private List customFields; + private String email; + private String firstName; + private String lastName; + private BigDecimal lastClicked; + private BigDecimal lastEmailed; + private BigDecimal lastOpened; + private BigDecimal updatedAt; + + public Builder(String email) { + this.email = email; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder createdAt(BigDecimal createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder customFields( + List customFields + ) { + this.customFields = customFields; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = firstName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = lastName; + return this; + } + + public Builder lastClicked(BigDecimal lastClicked) { + this.lastClicked = lastClicked; + return this; + } + + public Builder lastEmailed(BigDecimal lastEmailed) { + this.lastEmailed = lastEmailed; + return this; + } + + public Builder lastOpened(BigDecimal lastOpened) { + this.lastOpened = lastOpened; + return this; + } + + public Builder updatedAt(BigDecimal updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public ContactdbRecipient200RecipientsInner build() { + return new ContactdbRecipient200RecipientsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactdbRecipient200RecipientsInner.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (customFields != null) joiner.add("customFields=" + customFields); + if (email != null) joiner.add("email=" + email); + if (firstName != null) joiner.add("firstName=" + firstName); + if (lastName != null) joiner.add("lastName=" + lastName); + if (lastClicked != null) joiner.add("lastClicked=" + lastClicked); + if (lastEmailed != null) joiner.add("lastEmailed=" + lastEmailed); + if (lastOpened != null) joiner.add("lastOpened=" + lastOpened); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbRecipientCount200.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbRecipientCount200.java new file mode 100644 index 00000000..fe35d409 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbRecipientCount200.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactdbRecipientCount200 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("recipient_count") + @Getter + @Setter + private BigDecimal recipientCount; + + public ContactdbRecipientCount200() {} + + private ContactdbRecipientCount200(Builder builder) { + this.recipientCount = builder.recipientCount; + } + + // Builder class for constructing object + public static class Builder { + + private BigDecimal recipientCount; + + public Builder(BigDecimal recipientCount) { + this.recipientCount = recipientCount; + } + + public ContactdbRecipientCount200 build() { + return new ContactdbRecipientCount200(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactdbRecipientCount200.class.getSimpleName() + "(", + ")" + ); + if (recipientCount != null) joiner.add( + "recipientCount=" + recipientCount + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbRecipientResponse201.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbRecipientResponse201.java new file mode 100644 index 00000000..498709f2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbRecipientResponse201.java @@ -0,0 +1,132 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ContactdbRecipientResponse201ErrorsInner; +import java.math.BigDecimal; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactdbRecipientResponse201 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_count") + @Getter + @Setter + private BigDecimal errorCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_indices") + @Getter + @Setter + private List errorIndices; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("new_count") + @Getter + @Setter + private BigDecimal newCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("persisted_recipients") + @Getter + @Setter + private List persistedRecipients; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_count") + @Getter + @Setter + private BigDecimal updatedCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ContactdbRecipientResponse201() {} + + private ContactdbRecipientResponse201(Builder builder) { + this.errorCount = builder.errorCount; + this.errorIndices = builder.errorIndices; + this.newCount = builder.newCount; + this.persistedRecipients = builder.persistedRecipients; + this.updatedCount = builder.updatedCount; + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private BigDecimal errorCount; + private List errorIndices; + private BigDecimal newCount; + private List persistedRecipients; + private BigDecimal updatedCount; + private List errors; + + public Builder( + BigDecimal errorCount, + BigDecimal newCount, + List persistedRecipients, + BigDecimal updatedCount + ) { + this.errorCount = errorCount; + this.newCount = newCount; + this.persistedRecipients = persistedRecipients; + this.updatedCount = updatedCount; + } + + public Builder errorIndices(List errorIndices) { + this.errorIndices = errorIndices; + return this; + } + + public Builder errors( + List errors + ) { + this.errors = errors; + return this; + } + + public ContactdbRecipientResponse201 build() { + return new ContactdbRecipientResponse201(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactdbRecipientResponse201.class.getSimpleName() + "(", + ")" + ); + if (errorCount != null) joiner.add("errorCount=" + errorCount); + if (errorIndices != null) joiner.add("errorIndices=" + errorIndices); + if (newCount != null) joiner.add("newCount=" + newCount); + if (persistedRecipients != null) joiner.add( + "persistedRecipients=" + persistedRecipients + ); + if (updatedCount != null) joiner.add("updatedCount=" + updatedCount); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbRecipientResponse201ErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbRecipientResponse201ErrorsInner.java new file mode 100644 index 00000000..55415dcd --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbRecipientResponse201ErrorsInner.java @@ -0,0 +1,82 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactdbRecipientResponse201ErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_indices") + @Getter + @Setter + private List errorIndices; + + public ContactdbRecipientResponse201ErrorsInner() {} + + private ContactdbRecipientResponse201ErrorsInner(Builder builder) { + this.message = builder.message; + this.errorIndices = builder.errorIndices; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private List errorIndices; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder errorIndices(List errorIndices) { + this.errorIndices = errorIndices; + return this; + } + + public ContactdbRecipientResponse201ErrorsInner build() { + return new ContactdbRecipientResponse201ErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactdbRecipientResponse201ErrorsInner.class.getSimpleName() + + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (errorIndices != null) joiner.add("errorIndices=" + errorIndices); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbSegments.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbSegments.java new file mode 100644 index 00000000..48cd1fbe --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbSegments.java @@ -0,0 +1,108 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ContactdbSegmentsConditions; +import java.math.BigDecimal; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactdbSegments { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list_id") + @Getter + @Setter + private Integer listId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("conditions") + @Getter + @Setter + private List conditions; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("recipient_count") + @Getter + @Setter + private BigDecimal recipientCount; + + public ContactdbSegments() {} + + private ContactdbSegments(Builder builder) { + this.name = builder.name; + this.listId = builder.listId; + this.conditions = builder.conditions; + this.recipientCount = builder.recipientCount; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private Integer listId; + private List conditions; + private BigDecimal recipientCount; + + public Builder( + String name, + List conditions + ) { + this.name = name; + this.conditions = conditions; + } + + public Builder listId(Integer listId) { + this.listId = listId; + return this; + } + + public Builder recipientCount(BigDecimal recipientCount) { + this.recipientCount = recipientCount; + return this; + } + + public ContactdbSegments build() { + return new ContactdbSegments(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactdbSegments.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (listId != null) joiner.add("listId=" + listId); + if (conditions != null) joiner.add("conditions=" + conditions); + if (recipientCount != null) joiner.add( + "recipientCount=" + recipientCount + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbSegmentsConditions.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbSegmentsConditions.java new file mode 100644 index 00000000..4fe6ef5e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbSegmentsConditions.java @@ -0,0 +1,98 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.AndOr; +import com.sendgrid.rest.api.v3.lmccontactdb.models.Operator; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactdbSegmentsConditions { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("value") + @Getter + @Setter + private String value; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("operator") + @Getter + @Setter + private Operator operator; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("and_or") + @Getter + @Setter + private AndOr andOr; + + public ContactdbSegmentsConditions() {} + + private ContactdbSegmentsConditions(Builder builder) { + this.field = builder.field; + this.value = builder.value; + this.operator = builder.operator; + this.andOr = builder.andOr; + } + + // Builder class for constructing object + public static class Builder { + + private String field; + private String value; + private Operator operator; + private AndOr andOr; + + public Builder(String field, String value, Operator operator) { + this.field = field; + this.value = value; + this.operator = operator; + } + + public Builder andOr(AndOr andOr) { + this.andOr = andOr; + return this; + } + + public ContactdbSegmentsConditions build() { + return new ContactdbSegmentsConditions(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactdbSegmentsConditions.class.getSimpleName() + "(", + ")" + ); + if (field != null) joiner.add("field=" + field); + if (value != null) joiner.add("value=" + value); + if (operator != null) joiner.add("operator=" + operator); + if (andOr != null) joiner.add("andOr=" + andOr); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbSegmentsId200.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbSegmentsId200.java new file mode 100644 index 00000000..eded4ee3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ContactdbSegmentsId200.java @@ -0,0 +1,119 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ContactdbSegmentsConditions; +import java.math.BigDecimal; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactdbSegmentsId200 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private BigDecimal id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list_id") + @Getter + @Setter + private Integer listId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("conditions") + @Getter + @Setter + private List conditions; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("recipient_count") + @Getter + @Setter + private BigDecimal recipientCount; + + public ContactdbSegmentsId200() {} + + private ContactdbSegmentsId200(Builder builder) { + this.id = builder.id; + this.name = builder.name; + this.listId = builder.listId; + this.conditions = builder.conditions; + this.recipientCount = builder.recipientCount; + } + + // Builder class for constructing object + public static class Builder { + + private BigDecimal id; + private String name; + private Integer listId; + private List conditions; + private BigDecimal recipientCount; + + public Builder( + BigDecimal id, + String name, + List conditions + ) { + this.id = id; + this.name = name; + this.conditions = conditions; + } + + public Builder listId(Integer listId) { + this.listId = listId; + return this; + } + + public Builder recipientCount(BigDecimal recipientCount) { + this.recipientCount = recipientCount; + return this; + } + + public ContactdbSegmentsId200 build() { + return new ContactdbSegmentsId200(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactdbSegmentsId200.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (name != null) joiner.add("name=" + name); + if (listId != null) joiner.add("listId=" + listId); + if (conditions != null) joiner.add("conditions=" + conditions); + if (recipientCount != null) joiner.add( + "recipientCount=" + recipientCount + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/CreateAListRequest.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/CreateAListRequest.java new file mode 100644 index 00000000..de51a4ea --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/CreateAListRequest.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateAListRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public CreateAListRequest() {} + + private CreateAListRequest(Builder builder) { + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + + public Builder(String name) { + this.name = name; + } + + public CreateAListRequest build() { + return new CreateAListRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateAListRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/CreateCustomFieldRequest.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/CreateCustomFieldRequest.java new file mode 100644 index 00000000..8749be9d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/CreateCustomFieldRequest.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateCustomFieldRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + public CreateCustomFieldRequest() {} + + private CreateCustomFieldRequest(Builder builder) { + this.name = builder.name; + this.type = builder.type; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private String type; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder type(String type) { + this.type = type; + return this; + } + + public CreateCustomFieldRequest build() { + return new CreateCustomFieldRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateCustomFieldRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (type != null) joiner.add("type=" + type); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/DeleteContacts.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/DeleteContacts.java new file mode 100644 index 00000000..ff29203d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/DeleteContacts.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum DeleteContacts { + TRUE("true"), + + FALSE("false"); + + private final String value; + + private DeleteContacts(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static DeleteContacts forValue(final String value) { + return Promoter.enumFromString(value, DeleteContacts.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ErrorResponse.java new file mode 100644 index 00000000..9b64bf33 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..8e718a43 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/GetRecipientList200Response.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/GetRecipientList200Response.java new file mode 100644 index 00000000..c14c73fd --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/GetRecipientList200Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ContactdbList2xx; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetRecipientList200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("lists") + @Getter + @Setter + private List lists; + + public GetRecipientList200Response() {} + + private GetRecipientList200Response(Builder builder) { + this.lists = builder.lists; + } + + // Builder class for constructing object + public static class Builder { + + private List lists; + + public Builder() {} + + public Builder lists(List lists) { + this.lists = lists; + return this; + } + + public GetRecipientList200Response build() { + return new GetRecipientList200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetRecipientList200Response.class.getSimpleName() + "(", + ")" + ); + if (lists != null) joiner.add("lists=" + lists); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListAllCustomFieldsResponse.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListAllCustomFieldsResponse.java new file mode 100644 index 00000000..336ce80a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListAllCustomFieldsResponse.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ContactdbCustomFieldId2xx; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListAllCustomFieldsResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_fields") + @Getter + @Setter + private List customFields; + + public ListAllCustomFieldsResponse() {} + + private ListAllCustomFieldsResponse(Builder builder) { + this.customFields = builder.customFields; + } + + // Builder class for constructing object + public static class Builder { + + private List customFields; + + public Builder(List customFields) { + this.customFields = customFields; + } + + public ListAllCustomFieldsResponse build() { + return new ListAllCustomFieldsResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListAllCustomFieldsResponse.class.getSimpleName() + "(", + ")" + ); + if (customFields != null) joiner.add("customFields=" + customFields); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListAllListsResponse.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListAllListsResponse.java new file mode 100644 index 00000000..30d28851 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListAllListsResponse.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ContactdbList2xx; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListAllListsResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("lists") + @Getter + @Setter + private List lists; + + public ListAllListsResponse() {} + + private ListAllListsResponse(Builder builder) { + this.lists = builder.lists; + } + + // Builder class for constructing object + public static class Builder { + + private List lists; + + public Builder(List lists) { + this.lists = lists; + } + + public ListAllListsResponse build() { + return new ListAllListsResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListAllListsResponse.class.getSimpleName() + "(", + ")" + ); + if (lists != null) joiner.add("lists=" + lists); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListAllSegmentsResponse.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListAllSegmentsResponse.java new file mode 100644 index 00000000..e26c5342 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListAllSegmentsResponse.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ContactdbSegments; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListAllSegmentsResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("segments") + @Getter + @Setter + private List segments; + + public ListAllSegmentsResponse() {} + + private ListAllSegmentsResponse(Builder builder) { + this.segments = builder.segments; + } + + // Builder class for constructing object + public static class Builder { + + private List segments; + + public Builder(List segments) { + this.segments = segments; + } + + public ListAllSegmentsResponse build() { + return new ListAllSegmentsResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListAllSegmentsResponse.class.getSimpleName() + "(", + ")" + ); + if (segments != null) joiner.add("segments=" + segments); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListRecipientsFromContactDbList200Response.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListRecipientsFromContactDbList200Response.java new file mode 100644 index 00000000..603816a1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListRecipientsFromContactDbList200Response.java @@ -0,0 +1,68 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ContactdbRecipient200; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListRecipientsFromContactDbList200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("recipients") + @Getter + @Setter + private List recipients; + + public ListRecipientsFromContactDbList200Response() {} + + private ListRecipientsFromContactDbList200Response(Builder builder) { + this.recipients = builder.recipients; + } + + // Builder class for constructing object + public static class Builder { + + private List recipients; + + public Builder() {} + + public Builder recipients(List recipients) { + this.recipients = recipients; + return this; + } + + public ListRecipientsFromContactDbList200Response build() { + return new ListRecipientsFromContactDbList200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListRecipientsFromContactDbList200Response.class.getSimpleName() + + "(", + ")" + ); + if (recipients != null) joiner.add("recipients=" + recipients); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListRecipientsOnASegmentResponse.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListRecipientsOnASegmentResponse.java new file mode 100644 index 00000000..d8b9b524 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListRecipientsOnASegmentResponse.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ContactdbRecipient200; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListRecipientsOnASegmentResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("recipients") + @Getter + @Setter + private List recipients; + + public ListRecipientsOnASegmentResponse() {} + + private ListRecipientsOnASegmentResponse(Builder builder) { + this.recipients = builder.recipients; + } + + // Builder class for constructing object + public static class Builder { + + private List recipients; + + public Builder(List recipients) { + this.recipients = recipients; + } + + public ListRecipientsOnASegmentResponse build() { + return new ListRecipientsOnASegmentResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListRecipientsOnASegmentResponse.class.getSimpleName() + "(", + ")" + ); + if (recipients != null) joiner.add("recipients=" + recipients); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListRecipientsResponse.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListRecipientsResponse.java new file mode 100644 index 00000000..2342e02a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListRecipientsResponse.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListRecipientsResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("recipients") + @Getter + @Setter + private List recipients; + + public ListRecipientsResponse() {} + + private ListRecipientsResponse(Builder builder) { + this.recipients = builder.recipients; + } + + // Builder class for constructing object + public static class Builder { + + private List recipients; + + public Builder(List recipients) { + this.recipients = recipients; + } + + public ListRecipientsResponse build() { + return new ListRecipientsResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListRecipientsResponse.class.getSimpleName() + "(", + ")" + ); + if (recipients != null) joiner.add("recipients=" + recipients); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListReservedField200Response.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListReservedField200Response.java new file mode 100644 index 00000000..782054a9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListReservedField200Response.java @@ -0,0 +1,75 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ListReservedField200ResponseReservedFieldsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListReservedField200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reserved_fields") + @Getter + @Setter + private List< + ListReservedField200ResponseReservedFieldsInner + > reservedFields; + + public ListReservedField200Response() {} + + private ListReservedField200Response(Builder builder) { + this.reservedFields = builder.reservedFields; + } + + // Builder class for constructing object + public static class Builder { + + private List< + ListReservedField200ResponseReservedFieldsInner + > reservedFields; + + public Builder() {} + + public Builder reservedFields( + List reservedFields + ) { + this.reservedFields = reservedFields; + return this; + } + + public ListReservedField200Response build() { + return new ListReservedField200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListReservedField200Response.class.getSimpleName() + "(", + ")" + ); + if (reservedFields != null) joiner.add( + "reservedFields=" + reservedFields + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListReservedField200ResponseReservedFieldsInner.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListReservedField200ResponseReservedFieldsInner.java new file mode 100644 index 00000000..05070dd7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListReservedField200ResponseReservedFieldsInner.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListReservedField200ResponseReservedFieldsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + public ListReservedField200ResponseReservedFieldsInner() {} + + private ListReservedField200ResponseReservedFieldsInner(Builder builder) { + this.name = builder.name; + this.type = builder.type; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private String type; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder type(String type) { + this.type = type; + return this; + } + + public ListReservedField200ResponseReservedFieldsInner build() { + return new ListReservedField200ResponseReservedFieldsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListReservedField200ResponseReservedFieldsInner.class.getSimpleName() + + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (type != null) joiner.add("type=" + type); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListStatus200Response.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListStatus200Response.java new file mode 100644 index 00000000..faea905f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListStatus200Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ListStatus200ResponseStatusInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListStatus200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private List status; + + public ListStatus200Response() {} + + private ListStatus200Response(Builder builder) { + this.status = builder.status; + } + + // Builder class for constructing object + public static class Builder { + + private List status; + + public Builder() {} + + public Builder status(List status) { + this.status = status; + return this; + } + + public ListStatus200Response build() { + return new ListStatus200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListStatus200Response.class.getSimpleName() + "(", + ")" + ); + if (status != null) joiner.add("status=" + status); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListStatus200ResponseStatusInner.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListStatus200ResponseStatusInner.java new file mode 100644 index 00000000..121082c1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/ListStatus200ResponseStatusInner.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListStatus200ResponseStatusInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("value") + @Getter + @Setter + private String value; + + public ListStatus200ResponseStatusInner() {} + + private ListStatus200ResponseStatusInner(Builder builder) { + this.id = builder.id; + this.value = builder.value; + } + + // Builder class for constructing object + public static class Builder { + + private String id; + private String value; + + public Builder() {} + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder value(String value) { + this.value = value; + return this; + } + + public ListStatus200ResponseStatusInner build() { + return new ListStatus200ResponseStatusInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListStatus200ResponseStatusInner.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (value != null) joiner.add("value=" + value); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/Operator.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/Operator.java new file mode 100644 index 00000000..914c308b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/Operator.java @@ -0,0 +1,48 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Operator { + EQ("eq"), + + NE("ne"), + + LT("lt"), + + GT("gt"), + + CONTAINS("contains"); + + private final String value; + + private Operator(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Operator forValue(final String value) { + return Promoter.enumFromString(value, Operator.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/SearchRecipient200Response.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/SearchRecipient200Response.java new file mode 100644 index 00000000..416fb0a0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/SearchRecipient200Response.java @@ -0,0 +1,85 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.SearchRecipient200ResponseRecipientsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SearchRecipient200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("recipients") + @Getter + @Setter + private List recipients; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("recipient_count") + @Getter + @Setter + private Integer recipientCount; + + public SearchRecipient200Response() {} + + private SearchRecipient200Response(Builder builder) { + this.recipients = builder.recipients; + this.recipientCount = builder.recipientCount; + } + + // Builder class for constructing object + public static class Builder { + + private List recipients; + private Integer recipientCount; + + public Builder() {} + + public Builder recipients( + List recipients + ) { + this.recipients = recipients; + return this; + } + + public Builder recipientCount(Integer recipientCount) { + this.recipientCount = recipientCount; + return this; + } + + public SearchRecipient200Response build() { + return new SearchRecipient200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SearchRecipient200Response.class.getSimpleName() + "(", + ")" + ); + if (recipients != null) joiner.add("recipients=" + recipients); + if (recipientCount != null) joiner.add( + "recipientCount=" + recipientCount + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/SearchRecipient200ResponseRecipientsInner.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/SearchRecipient200ResponseRecipientsInner.java new file mode 100644 index 00000000..de2080ac --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/SearchRecipient200ResponseRecipientsInner.java @@ -0,0 +1,188 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.SearchRecipient200ResponseRecipientsInnerCustomFieldsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SearchRecipient200ResponseRecipientsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private Integer createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_emailed") + @Getter + @Setter + private Integer lastEmailed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_clicked") + @Getter + @Setter + private Integer lastClicked; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_opened") + @Getter + @Setter + private Integer lastOpened; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_fields") + @Getter + @Setter + private List< + SearchRecipient200ResponseRecipientsInnerCustomFieldsInner + > customFields; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private Integer updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + public SearchRecipient200ResponseRecipientsInner() {} + + private SearchRecipient200ResponseRecipientsInner(Builder builder) { + this.createdAt = builder.createdAt; + this.email = builder.email; + this.id = builder.id; + this.lastEmailed = builder.lastEmailed; + this.lastClicked = builder.lastClicked; + this.lastOpened = builder.lastOpened; + this.customFields = builder.customFields; + this.updatedAt = builder.updatedAt; + this.firstName = builder.firstName; + } + + // Builder class for constructing object + public static class Builder { + + private Integer createdAt; + private String email; + private String id; + private Integer lastEmailed; + private Integer lastClicked; + private Integer lastOpened; + private List< + SearchRecipient200ResponseRecipientsInnerCustomFieldsInner + > customFields; + private Integer updatedAt; + private String firstName; + + public Builder() {} + + public Builder createdAt(Integer createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder lastEmailed(Integer lastEmailed) { + this.lastEmailed = lastEmailed; + return this; + } + + public Builder lastClicked(Integer lastClicked) { + this.lastClicked = lastClicked; + return this; + } + + public Builder lastOpened(Integer lastOpened) { + this.lastOpened = lastOpened; + return this; + } + + public Builder customFields( + List< + SearchRecipient200ResponseRecipientsInnerCustomFieldsInner + > customFields + ) { + this.customFields = customFields; + return this; + } + + public Builder updatedAt(Integer updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = firstName; + return this; + } + + public SearchRecipient200ResponseRecipientsInner build() { + return new SearchRecipient200ResponseRecipientsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SearchRecipient200ResponseRecipientsInner.class.getSimpleName() + + "(", + ")" + ); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (email != null) joiner.add("email=" + email); + if (id != null) joiner.add("id=" + id); + if (lastEmailed != null) joiner.add("lastEmailed=" + lastEmailed); + if (lastClicked != null) joiner.add("lastClicked=" + lastClicked); + if (lastOpened != null) joiner.add("lastOpened=" + lastOpened); + if (customFields != null) joiner.add("customFields=" + customFields); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (firstName != null) joiner.add("firstName=" + firstName); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/SearchRecipient200ResponseRecipientsInnerCustomFieldsInner.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/SearchRecipient200ResponseRecipientsInnerCustomFieldsInner.java new file mode 100644 index 00000000..a817eb97 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/SearchRecipient200ResponseRecipientsInnerCustomFieldsInner.java @@ -0,0 +1,115 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SearchRecipient200ResponseRecipientsInnerCustomFieldsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("value") + @Getter + @Setter + private SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue value; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + public SearchRecipient200ResponseRecipientsInnerCustomFieldsInner() {} + + private SearchRecipient200ResponseRecipientsInnerCustomFieldsInner( + Builder builder + ) { + this.id = builder.id; + this.name = builder.name; + this.value = builder.value; + this.type = builder.type; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private String name; + private SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue value; + private String type; + + public Builder() {} + + public Builder id(Integer id) { + this.id = id; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder value( + SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue value + ) { + this.value = value; + return this; + } + + public Builder type(String type) { + this.type = type; + return this; + } + + public SearchRecipient200ResponseRecipientsInnerCustomFieldsInner build() { + return new SearchRecipient200ResponseRecipientsInnerCustomFieldsInner( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SearchRecipient200ResponseRecipientsInnerCustomFieldsInner.class.getSimpleName() + + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (name != null) joiner.add("name=" + name); + if (value != null) joiner.add("value=" + value); + if (type != null) joiner.add("type=" + type); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue.java new file mode 100644 index 00000000..281400db --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue.java @@ -0,0 +1,50 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import java.util.StringJoiner; +import lombok.ToString; + +@ToString +public class SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue { + + public SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue() {} + + private SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue( + Builder builder + ) {} + + // Builder class for constructing object + public static class Builder { + + public Builder() {} + + public SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue build() { + return new SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue.class.getSimpleName() + + "(", + ")" + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/SearchRecipientRequest.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/SearchRecipientRequest.java new file mode 100644 index 00000000..87662751 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/SearchRecipientRequest.java @@ -0,0 +1,77 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ContactdbSegmentsConditions; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SearchRecipientRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list_id") + @Getter + @Setter + private Integer listId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("conditions") + @Getter + @Setter + private List conditions; + + public SearchRecipientRequest() {} + + private SearchRecipientRequest(Builder builder) { + this.listId = builder.listId; + this.conditions = builder.conditions; + } + + // Builder class for constructing object + public static class Builder { + + private Integer listId; + private List conditions; + + public Builder( + Integer listId, + List conditions + ) { + this.listId = listId; + this.conditions = conditions; + } + + public SearchRecipientRequest build() { + return new SearchRecipientRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SearchRecipientRequest.class.getSimpleName() + "(", + ")" + ); + if (listId != null) joiner.add("listId=" + listId); + if (conditions != null) joiner.add("conditions=" + conditions); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/Type.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/Type.java new file mode 100644 index 00000000..d13fc08e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/Type.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Type { + DATE("date"), + + TEXT("text"), + + NUMBER("number"); + + private final String value; + + private Type(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Type forValue(final String value) { + return Promoter.enumFromString(value, Type.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/UpdateAListRequest.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/UpdateAListRequest.java new file mode 100644 index 00000000..ce6acff7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/UpdateAListRequest.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateAListRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public UpdateAListRequest() {} + + private UpdateAListRequest(Builder builder) { + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + + public Builder(String name) { + this.name = name; + } + + public UpdateAListRequest build() { + return new UpdateAListRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateAListRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/UpdateContactDbList200Response.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/UpdateContactDbList200Response.java new file mode 100644 index 00000000..4a3b1069 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/UpdateContactDbList200Response.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateContactDbList200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("recipient_count") + @Getter + @Setter + private Integer recipientCount; + + public UpdateContactDbList200Response() {} + + private UpdateContactDbList200Response(Builder builder) { + this.id = builder.id; + this.name = builder.name; + this.recipientCount = builder.recipientCount; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private String name; + private Integer recipientCount; + + public Builder() {} + + public Builder id(Integer id) { + this.id = id; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder recipientCount(Integer recipientCount) { + this.recipientCount = recipientCount; + return this; + } + + public UpdateContactDbList200Response build() { + return new UpdateContactDbList200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateContactDbList200Response.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (name != null) joiner.add("name=" + name); + if (recipientCount != null) joiner.add( + "recipientCount=" + recipientCount + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/UpdateRecipientRequestInner.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/UpdateRecipientRequestInner.java new file mode 100644 index 00000000..3e82ad6c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/UpdateRecipientRequestInner.java @@ -0,0 +1,90 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateRecipientRequestInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + public UpdateRecipientRequestInner() {} + + private UpdateRecipientRequestInner(Builder builder) { + this.email = builder.email; + this.lastName = builder.lastName; + this.firstName = builder.firstName; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + private String lastName; + private String firstName; + + public Builder(String email) { + this.email = email; + } + + public Builder lastName(String lastName) { + this.lastName = lastName; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = firstName; + return this; + } + + public UpdateRecipientRequestInner build() { + return new UpdateRecipientRequestInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateRecipientRequestInner.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + if (lastName != null) joiner.add("lastName=" + lastName); + if (firstName != null) joiner.add("firstName=" + firstName); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/UpdateSegmentRequest.java b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/UpdateSegmentRequest.java new file mode 100644 index 00000000..9007aa8e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmccontactdb/models/UpdateSegmentRequest.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Contacts API + * The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmccontactdb.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmccontactdb.models.ContactdbSegmentsConditions; +import java.math.BigDecimal; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateSegmentRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list_id") + @Getter + @Setter + private BigDecimal listId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("conditions") + @Getter + @Setter + private List conditions; + + public UpdateSegmentRequest() {} + + private UpdateSegmentRequest(Builder builder) { + this.name = builder.name; + this.listId = builder.listId; + this.conditions = builder.conditions; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private BigDecimal listId; + private List conditions; + + public Builder(String name) { + this.name = name; + } + + public Builder listId(BigDecimal listId) { + this.listId = listId; + return this; + } + + public Builder conditions( + List conditions + ) { + this.conditions = conditions; + return this; + } + + public UpdateSegmentRequest build() { + return new UpdateSegmentRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateSegmentRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (listId != null) joiner.add("listId=" + listId); + if (conditions != null) joiner.add("conditions=" + conditions); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/CreateSender.java b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/CreateSender.java new file mode 100644 index 00000000..e743ccd6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/CreateSender.java @@ -0,0 +1,106 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + * The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmcsenders; + +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.lmcsenders.models.CreateSender400Response; +import com.sendgrid.rest.api.v3.lmcsenders.models.CreateSenderRequest; +import com.sendgrid.rest.api.v3.lmcsenders.models.SenderId; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateSender extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private CreateSenderRequest createSenderRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/senders"; + 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( + "CreateSender 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")) { + CreateSender400Response error = JsonUtil.fromJson( + response.getStream(), + CreateSender400Response.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(), SenderId.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (createSenderRequest != null) { + request.addBody(JsonUtil.toJson(createSenderRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/DeleteSender.java b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/DeleteSender.java new file mode 100644 index 00000000..2575eed6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/DeleteSender.java @@ -0,0 +1,116 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + * The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmcsenders; + +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.lmcsenders.models.CreateSender400Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteSender extends ApiKeyBase { + + private final Integer senderId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/senders/{sender_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSender creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "403")) { + CreateSender400Response error = JsonUtil.fromJson( + response.getStream(), + CreateSender400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + CreateSender400Response error = JsonUtil.fromJson( + response.getStream(), + CreateSender400Response.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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (senderId != null) { + request.addPathParam("sender_id", senderId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/GetSender.java b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/GetSender.java new file mode 100644 index 00000000..a57682f3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/GetSender.java @@ -0,0 +1,104 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + * The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmcsenders; + +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.lmcsenders.models.CreateSender400Response; +import com.sendgrid.rest.api.v3.lmcsenders.models.SenderId; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetSender extends ApiKeyBase { + + private final Integer senderId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/senders/{sender_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetSender creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + CreateSender400Response error = JsonUtil.fromJson( + response.getStream(), + CreateSender400Response.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(), SenderId.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (senderId != null) { + request.addPathParam("sender_id", senderId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/ListSender.java b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/ListSender.java new file mode 100644 index 00000000..3fd4ff71 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/ListSender.java @@ -0,0 +1,85 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + * The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmcsenders; + +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.lmcsenders.models.ListSender200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSender extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/senders"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSender creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + ListSender200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/ResetSenderVerification.java b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/ResetSenderVerification.java new file mode 100644 index 00000000..0844382d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/ResetSenderVerification.java @@ -0,0 +1,116 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + * The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmcsenders; + +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.lmcsenders.models.CreateSender400Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ResetSenderVerification extends ApiKeyBase { + + private final Integer senderId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/senders/{sender_id}/resend_verification"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ResetSenderVerification 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")) { + CreateSender400Response error = JsonUtil.fromJson( + response.getStream(), + CreateSender400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + CreateSender400Response error = JsonUtil.fromJson( + response.getStream(), + CreateSender400Response.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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (senderId != null) { + request.addPathParam("sender_id", senderId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/UpdateSender.java b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/UpdateSender.java new file mode 100644 index 00000000..e1371088 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/UpdateSender.java @@ -0,0 +1,141 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + * The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmcsenders; + +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.lmcsenders.models.CreateSender400Response; +import com.sendgrid.rest.api.v3.lmcsenders.models.SenderId; +import com.sendgrid.rest.api.v3.lmcsenders.models.SenderIdRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateSender extends ApiKeyBase { + + private final Integer senderId; + + @Setter + private String onBehalfOf; + + @Setter + private SenderIdRequest senderIdRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/senders/{sender_id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateSender 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")) { + CreateSender400Response error = JsonUtil.fromJson( + response.getStream(), + CreateSender400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + CreateSender400Response error = JsonUtil.fromJson( + response.getStream(), + CreateSender400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + CreateSender400Response error = JsonUtil.fromJson( + response.getStream(), + CreateSender400Response.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(), SenderId.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (senderId != null) { + request.addPathParam("sender_id", senderId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (senderIdRequest != null) { + request.addBody(JsonUtil.toJson(senderIdRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/CreateSender400Response.java b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/CreateSender400Response.java new file mode 100644 index 00000000..7d386b7b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/CreateSender400Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + * The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmcsenders.models.CreateSender400ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateSender400Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public CreateSender400Response() {} + + private CreateSender400Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public CreateSender400Response build() { + return new CreateSender400Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateSender400Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/CreateSender400ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/CreateSender400ResponseErrorsInner.java new file mode 100644 index 00000000..4e39239b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/CreateSender400ResponseErrorsInner.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + * The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateSender400ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + public CreateSender400ResponseErrorsInner() {} + + private CreateSender400ResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public CreateSender400ResponseErrorsInner build() { + return new CreateSender400ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateSender400ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/CreateSenderRequest.java b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/CreateSenderRequest.java new file mode 100644 index 00000000..7fb87ae9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/CreateSenderRequest.java @@ -0,0 +1,167 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + * The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateSenderRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("nickname") + @Getter + @Setter + private String nickname; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("from") + @Getter + @Setter + private Object from; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reply_to") + @Getter + @Setter + private Object replyTo; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address") + @Getter + @Setter + private String address; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_2") + @Getter + @Setter + private String address2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city") + @Getter + @Setter + private String city; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state") + @Getter + @Setter + private String state; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("zip") + @Getter + @Setter + private String zip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country") + @Getter + @Setter + private String country; + + public CreateSenderRequest() {} + + private CreateSenderRequest(Builder builder) { + this.nickname = builder.nickname; + this.from = builder.from; + this.replyTo = builder.replyTo; + this.address = builder.address; + this.address2 = builder.address2; + this.city = builder.city; + this.state = builder.state; + this.zip = builder.zip; + this.country = builder.country; + } + + // Builder class for constructing object + public static class Builder { + + private String nickname; + private Object from; + private Object replyTo; + private String address; + private String address2; + private String city; + private String state; + private String zip; + private String country; + + public Builder( + String nickname, + String address, + String city, + String country + ) { + this.nickname = nickname; + this.address = address; + this.city = city; + this.country = country; + } + + public Builder from(Object from) { + this.from = from; + return this; + } + + public Builder replyTo(Object replyTo) { + this.replyTo = replyTo; + return this; + } + + public Builder address2(String address2) { + this.address2 = address2; + return this; + } + + public Builder state(String state) { + this.state = state; + return this; + } + + public Builder zip(String zip) { + this.zip = zip; + return this; + } + + public CreateSenderRequest build() { + return new CreateSenderRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateSenderRequest.class.getSimpleName() + "(", + ")" + ); + if (nickname != null) joiner.add("nickname=" + nickname); + if (from != null) joiner.add("from=" + from); + if (replyTo != null) joiner.add("replyTo=" + replyTo); + if (address != null) joiner.add("address=" + address); + if (address2 != null) joiner.add("address2=" + address2); + if (city != null) joiner.add("city=" + city); + if (state != null) joiner.add("state=" + state); + if (zip != null) joiner.add("zip=" + zip); + if (country != null) joiner.add("country=" + country); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/ListSender200Response.java b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/ListSender200Response.java new file mode 100644 index 00000000..ce3b6d98 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/ListSender200Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + * The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmcsenders.models.SenderId; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListSender200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + public ListSender200Response() {} + + private ListSender200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + + public Builder() {} + + public Builder result(List result) { + this.result = result; + return this; + } + + public ListSender200Response build() { + return new ListSender200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListSender200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/SenderId.java b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/SenderId.java new file mode 100644 index 00000000..47abf15a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/SenderId.java @@ -0,0 +1,239 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + * The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmcsenders.models.SenderIdRequestFrom; +import com.sendgrid.rest.api.v3.lmcsenders.models.SenderIdRequestReplyTo; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SenderId { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("nickname") + @Getter + @Setter + private String nickname; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("from") + @Getter + @Setter + private SenderIdRequestFrom from; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reply_to") + @Getter + @Setter + private SenderIdRequestReplyTo replyTo; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address") + @Getter + @Setter + private String address; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_2") + @Getter + @Setter + private String address2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city") + @Getter + @Setter + private String city; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state") + @Getter + @Setter + private String state; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("zip") + @Getter + @Setter + private String zip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country") + @Getter + @Setter + private String country; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("verified") + @Getter + @Setter + private Boolean verified; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private Integer updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private Integer createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("locked") + @Getter + @Setter + private Boolean locked; + + public SenderId() {} + + private SenderId(Builder builder) { + this.nickname = builder.nickname; + this.from = builder.from; + this.replyTo = builder.replyTo; + this.address = builder.address; + this.address2 = builder.address2; + this.city = builder.city; + this.state = builder.state; + this.zip = builder.zip; + this.country = builder.country; + this.id = builder.id; + this.verified = builder.verified; + this.updatedAt = builder.updatedAt; + this.createdAt = builder.createdAt; + this.locked = builder.locked; + } + + // Builder class for constructing object + public static class Builder { + + private String nickname; + private SenderIdRequestFrom from; + private SenderIdRequestReplyTo replyTo; + private String address; + private String address2; + private String city; + private String state; + private String zip; + private String country; + private Integer id; + private Boolean verified; + private Integer updatedAt; + private Integer createdAt; + private Boolean locked; + + public Builder( + String nickname, + String address, + String city, + String country + ) { + this.nickname = nickname; + this.address = address; + this.city = city; + this.country = country; + } + + public Builder from(SenderIdRequestFrom from) { + this.from = from; + return this; + } + + public Builder replyTo(SenderIdRequestReplyTo replyTo) { + this.replyTo = replyTo; + return this; + } + + public Builder address2(String address2) { + this.address2 = address2; + return this; + } + + public Builder state(String state) { + this.state = state; + return this; + } + + public Builder zip(String zip) { + this.zip = zip; + return this; + } + + public Builder id(Integer id) { + this.id = id; + return this; + } + + public Builder verified(Boolean verified) { + this.verified = verified; + return this; + } + + public Builder updatedAt(Integer updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder createdAt(Integer createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder locked(Boolean locked) { + this.locked = locked; + return this; + } + + public SenderId build() { + return new SenderId(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SenderId.class.getSimpleName() + "(", + ")" + ); + if (nickname != null) joiner.add("nickname=" + nickname); + if (from != null) joiner.add("from=" + from); + if (replyTo != null) joiner.add("replyTo=" + replyTo); + if (address != null) joiner.add("address=" + address); + if (address2 != null) joiner.add("address2=" + address2); + if (city != null) joiner.add("city=" + city); + if (state != null) joiner.add("state=" + state); + if (zip != null) joiner.add("zip=" + zip); + if (country != null) joiner.add("country=" + country); + if (id != null) joiner.add("id=" + id); + if (verified != null) joiner.add("verified=" + verified); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (locked != null) joiner.add("locked=" + locked); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/SenderIdRequest.java b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/SenderIdRequest.java new file mode 100644 index 00000000..ad2b158f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/SenderIdRequest.java @@ -0,0 +1,179 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + * The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.lmcsenders.models.SenderIdRequestFrom; +import com.sendgrid.rest.api.v3.lmcsenders.models.SenderIdRequestReplyTo; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SenderIdRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("nickname") + @Getter + @Setter + private String nickname; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("from") + @Getter + @Setter + private SenderIdRequestFrom from; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reply_to") + @Getter + @Setter + private SenderIdRequestReplyTo replyTo; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address") + @Getter + @Setter + private String address; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_2") + @Getter + @Setter + private String address2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city") + @Getter + @Setter + private String city; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state") + @Getter + @Setter + private String state; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("zip") + @Getter + @Setter + private String zip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country") + @Getter + @Setter + private String country; + + public SenderIdRequest() {} + + private SenderIdRequest(Builder builder) { + this.nickname = builder.nickname; + this.from = builder.from; + this.replyTo = builder.replyTo; + this.address = builder.address; + this.address2 = builder.address2; + this.city = builder.city; + this.state = builder.state; + this.zip = builder.zip; + this.country = builder.country; + } + + // Builder class for constructing object + public static class Builder { + + private String nickname; + private SenderIdRequestFrom from; + private SenderIdRequestReplyTo replyTo; + private String address; + private String address2; + private String city; + private String state; + private String zip; + private String country; + + public Builder() {} + + public Builder nickname(String nickname) { + this.nickname = nickname; + return this; + } + + public Builder from(SenderIdRequestFrom from) { + this.from = from; + return this; + } + + public Builder replyTo(SenderIdRequestReplyTo replyTo) { + this.replyTo = replyTo; + return this; + } + + public Builder address(String address) { + this.address = address; + return this; + } + + public Builder address2(String address2) { + this.address2 = address2; + return this; + } + + public Builder city(String city) { + this.city = city; + return this; + } + + public Builder state(String state) { + this.state = state; + return this; + } + + public Builder zip(String zip) { + this.zip = zip; + return this; + } + + public Builder country(String country) { + this.country = country; + return this; + } + + public SenderIdRequest build() { + return new SenderIdRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SenderIdRequest.class.getSimpleName() + "(", + ")" + ); + if (nickname != null) joiner.add("nickname=" + nickname); + if (from != null) joiner.add("from=" + from); + if (replyTo != null) joiner.add("replyTo=" + replyTo); + if (address != null) joiner.add("address=" + address); + if (address2 != null) joiner.add("address2=" + address2); + if (city != null) joiner.add("city=" + city); + if (state != null) joiner.add("state=" + state); + if (zip != null) joiner.add("zip=" + zip); + if (country != null) joiner.add("country=" + country); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/SenderIdRequestFrom.java b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/SenderIdRequestFrom.java new file mode 100644 index 00000000..0b37cae5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/SenderIdRequestFrom.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + * The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SenderIdRequestFrom { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public SenderIdRequestFrom() {} + + private SenderIdRequestFrom(Builder builder) { + this.email = builder.email; + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + private String name; + + public Builder() {} + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public SenderIdRequestFrom build() { + return new SenderIdRequestFrom(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SenderIdRequestFrom.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/SenderIdRequestReplyTo.java b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/SenderIdRequestReplyTo.java new file mode 100644 index 00000000..72a08f19 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/lmcsenders/models/SenderIdRequestReplyTo.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + * The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + * + * 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.lmcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SenderIdRequestReplyTo { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public SenderIdRequestReplyTo() {} + + private SenderIdRequestReplyTo(Builder builder) { + this.email = builder.email; + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + private String name; + + public Builder() {} + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public SenderIdRequestReplyTo build() { + return new SenderIdRequestReplyTo(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SenderIdRequestReplyTo.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/CreateMailBatch.java b/src/main/java/com/sendgrid/rest/api/v3/mail/CreateMailBatch.java new file mode 100644 index 00000000..210e95be --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/CreateMailBatch.java @@ -0,0 +1,160 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail; + +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.mail.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mail.models.MailBatchResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateMailBatch extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/mail/batch"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "CreateMailBatch 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "405")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), MailBatchResponse.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/GetMailBatch.java b/src/main/java/com/sendgrid/rest/api/v3/mail/GetMailBatch.java new file mode 100644 index 00000000..3286cbe3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/GetMailBatch.java @@ -0,0 +1,147 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail; + +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.mail.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mail.models.MailBatchResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetMailBatch extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/mail/batch/{batch_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetMailBatch 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "405")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), MailBatchResponse.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/SendMail.java b/src/main/java/com/sendgrid/rest/api/v3/mail/SendMail.java new file mode 100644 index 00000000..e239ceec --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/SendMail.java @@ -0,0 +1,183 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail; + +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.mail.models.ContentEncoding; +import com.sendgrid.rest.api.v3.mail.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mail.models.SendMailRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class SendMail extends ApiKeyBase { + + @Setter + private ContentEncoding contentEncoding; + + @Setter + private SendMailRequest sendMailRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/mail/send"; + 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( + "SendMail 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "405")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "413")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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 addHeaderParams(Request request) { + if (contentEncoding != null) { + request.addHeaderParam( + "Content-Encoding", + contentEncoding.toString() + ); + } + } + + private void addBody(final Request request) { + if (sendMailRequest != null) { + request.addBody(JsonUtil.toJson(sendMailRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/ContentEncoding.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/ContentEncoding.java new file mode 100644 index 00000000..924e92f1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/ContentEncoding.java @@ -0,0 +1,40 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum ContentEncoding { + GZIP("gzip"); + + private final String value; + + private ContentEncoding(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static ContentEncoding forValue(final String value) { + return Promoter.enumFromString(value, ContentEncoding.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/Disposition.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/Disposition.java new file mode 100644 index 00000000..ae0052c5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/Disposition.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Disposition { + INLINE("inline"), + + ATTACHMENT("attachment"); + + private final String value; + + private Disposition(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Disposition forValue(final String value) { + return Promoter.enumFromString(value, Disposition.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/ErrorResponse.java new file mode 100644 index 00000000..e98baaa9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mail.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..a1db5b61 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/MailBatchResponse.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/MailBatchResponse.java new file mode 100644 index 00000000..9ee7169b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/MailBatchResponse.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class MailBatchResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("batch_id") + @Getter + @Setter + private String batchId; + + public MailBatchResponse() {} + + private MailBatchResponse(Builder builder) { + this.batchId = builder.batchId; + } + + // Builder class for constructing object + public static class Builder { + + private String batchId; + + public Builder() {} + + public Builder batchId(String batchId) { + this.batchId = batchId; + return this; + } + + public MailBatchResponse build() { + return new MailBatchResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + MailBatchResponse.class.getSimpleName() + "(", + ")" + ); + if (batchId != null) joiner.add("batchId=" + batchId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/MailFrom.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/MailFrom.java new file mode 100644 index 00000000..95a88079 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/MailFrom.java @@ -0,0 +1,76 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class MailFrom { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public MailFrom() {} + + private MailFrom(Builder builder) { + this.email = builder.email; + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + private String name; + + public Builder(String email) { + this.email = email; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public MailFrom build() { + return new MailFrom(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + MailFrom.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/MailTo.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/MailTo.java new file mode 100644 index 00000000..a1082c06 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/MailTo.java @@ -0,0 +1,76 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class MailTo { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public MailTo() {} + + private MailTo(Builder builder) { + this.email = builder.email; + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + private String name; + + public Builder(String email) { + this.email = email; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public MailTo build() { + return new MailTo(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + MailTo.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequest.java new file mode 100644 index 00000000..3fb431da --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequest.java @@ -0,0 +1,302 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mail.models.MailFrom; +import com.sendgrid.rest.api.v3.mail.models.MailTo; +import com.sendgrid.rest.api.v3.mail.models.SendMailRequestAsm; +import com.sendgrid.rest.api.v3.mail.models.SendMailRequestAttachmentsInner; +import com.sendgrid.rest.api.v3.mail.models.SendMailRequestContentInner; +import com.sendgrid.rest.api.v3.mail.models.SendMailRequestMailSettings; +import com.sendgrid.rest.api.v3.mail.models.SendMailRequestPersonalizationsInner; +import com.sendgrid.rest.api.v3.mail.models.SendMailRequestTrackingSettings; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendMailRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("personalizations") + @Getter + @Setter + private List personalizations; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("from") + @Getter + @Setter + private MailFrom from; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reply_to") + @Getter + @Setter + private MailTo replyTo; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reply_to_list") + @Getter + @Setter + private List replyToList; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subject") + @Getter + @Setter + private String subject; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("content") + @Getter + @Setter + private List content; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("attachments") + @Getter + @Setter + private List attachments; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("template_id") + @Getter + @Setter + private String templateId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("headers") + @Getter + @Setter + private Object headers; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("categories") + @Getter + @Setter + private List categories; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_args") + @Getter + @Setter + private String customArgs; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("send_at") + @Getter + @Setter + private Integer sendAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("batch_id") + @Getter + @Setter + private String batchId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("asm") + @Getter + @Setter + private SendMailRequestAsm asm; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip_pool_name") + @Getter + @Setter + private String ipPoolName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("mail_settings") + @Getter + @Setter + private SendMailRequestMailSettings mailSettings; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("tracking_settings") + @Getter + @Setter + private SendMailRequestTrackingSettings trackingSettings; + + public SendMailRequest() {} + + private SendMailRequest(Builder builder) { + this.personalizations = builder.personalizations; + this.from = builder.from; + this.replyTo = builder.replyTo; + this.replyToList = builder.replyToList; + this.subject = builder.subject; + this.content = builder.content; + this.attachments = builder.attachments; + this.templateId = builder.templateId; + this.headers = builder.headers; + this.categories = builder.categories; + this.customArgs = builder.customArgs; + this.sendAt = builder.sendAt; + this.batchId = builder.batchId; + this.asm = builder.asm; + this.ipPoolName = builder.ipPoolName; + this.mailSettings = builder.mailSettings; + this.trackingSettings = builder.trackingSettings; + } + + // Builder class for constructing object + public static class Builder { + + private List personalizations; + private MailFrom from; + private MailTo replyTo; + private List replyToList; + private String subject; + private List content; + private List attachments; + private String templateId; + private Object headers; + private List categories; + private String customArgs; + private Integer sendAt; + private String batchId; + private SendMailRequestAsm asm; + private String ipPoolName; + private SendMailRequestMailSettings mailSettings; + private SendMailRequestTrackingSettings trackingSettings; + + public Builder( + List personalizations, + MailFrom from + ) { + this.personalizations = personalizations; + this.from = from; + } + + public Builder replyTo(MailTo replyTo) { + this.replyTo = replyTo; + return this; + } + + public Builder replyToList(List replyToList) { + this.replyToList = replyToList; + return this; + } + + public Builder subject(String subject) { + this.subject = subject; + return this; + } + + public Builder content(List content) { + this.content = content; + return this; + } + + public Builder attachments( + List attachments + ) { + this.attachments = attachments; + return this; + } + + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + public Builder headers(Object headers) { + this.headers = headers; + return this; + } + + public Builder categories(List categories) { + this.categories = categories; + return this; + } + + public Builder customArgs(String customArgs) { + this.customArgs = customArgs; + return this; + } + + public Builder sendAt(Integer sendAt) { + this.sendAt = sendAt; + return this; + } + + public Builder batchId(String batchId) { + this.batchId = batchId; + return this; + } + + public Builder asm(SendMailRequestAsm asm) { + this.asm = asm; + return this; + } + + public Builder ipPoolName(String ipPoolName) { + this.ipPoolName = ipPoolName; + return this; + } + + public Builder mailSettings(SendMailRequestMailSettings mailSettings) { + this.mailSettings = mailSettings; + return this; + } + + public Builder trackingSettings( + SendMailRequestTrackingSettings trackingSettings + ) { + this.trackingSettings = trackingSettings; + return this; + } + + public SendMailRequest build() { + return new SendMailRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendMailRequest.class.getSimpleName() + "(", + ")" + ); + if (personalizations != null) joiner.add( + "personalizations=" + personalizations + ); + if (from != null) joiner.add("from=" + from); + if (replyTo != null) joiner.add("replyTo=" + replyTo); + if (replyToList != null) joiner.add("replyToList=" + replyToList); + if (subject != null) joiner.add("subject=" + subject); + if (content != null) joiner.add("content=" + content); + if (attachments != null) joiner.add("attachments=" + attachments); + if (templateId != null) joiner.add("templateId=" + templateId); + if (headers != null) joiner.add("headers=" + headers); + if (categories != null) joiner.add("categories=" + categories); + if (customArgs != null) joiner.add("customArgs=" + customArgs); + if (sendAt != null) joiner.add("sendAt=" + sendAt); + if (batchId != null) joiner.add("batchId=" + batchId); + if (asm != null) joiner.add("asm=" + asm); + if (ipPoolName != null) joiner.add("ipPoolName=" + ipPoolName); + if (mailSettings != null) joiner.add("mailSettings=" + mailSettings); + if (trackingSettings != null) joiner.add( + "trackingSettings=" + trackingSettings + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestAsm.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestAsm.java new file mode 100644 index 00000000..6326f576 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestAsm.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendMailRequestAsm { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("group_id") + @Getter + @Setter + private Integer groupId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("groups_to_display") + @Getter + @Setter + private List groupsToDisplay; + + public SendMailRequestAsm() {} + + private SendMailRequestAsm(Builder builder) { + this.groupId = builder.groupId; + this.groupsToDisplay = builder.groupsToDisplay; + } + + // Builder class for constructing object + public static class Builder { + + private Integer groupId; + private List groupsToDisplay; + + public Builder(Integer groupId) { + this.groupId = groupId; + } + + public Builder groupsToDisplay(List groupsToDisplay) { + this.groupsToDisplay = groupsToDisplay; + return this; + } + + public SendMailRequestAsm build() { + return new SendMailRequestAsm(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendMailRequestAsm.class.getSimpleName() + "(", + ")" + ); + if (groupId != null) joiner.add("groupId=" + groupId); + if (groupsToDisplay != null) joiner.add( + "groupsToDisplay=" + groupsToDisplay + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestAttachmentsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestAttachmentsInner.java new file mode 100644 index 00000000..df327964 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestAttachmentsInner.java @@ -0,0 +1,115 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mail.models.Disposition; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendMailRequestAttachmentsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("content") + @Getter + @Setter + private String content; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("filename") + @Getter + @Setter + private String filename; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("disposition") + @Getter + @Setter + private Disposition disposition; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("content_id") + @Getter + @Setter + private String contentId; + + public SendMailRequestAttachmentsInner() {} + + private SendMailRequestAttachmentsInner(Builder builder) { + this.content = builder.content; + this.type = builder.type; + this.filename = builder.filename; + this.disposition = builder.disposition; + this.contentId = builder.contentId; + } + + // Builder class for constructing object + public static class Builder { + + private String content; + private String type; + private String filename; + private Disposition disposition; + private String contentId; + + public Builder(String content, String filename) { + this.content = content; + this.filename = filename; + } + + public Builder type(String type) { + this.type = type; + return this; + } + + public Builder disposition(Disposition disposition) { + this.disposition = disposition; + return this; + } + + public Builder contentId(String contentId) { + this.contentId = contentId; + return this; + } + + public SendMailRequestAttachmentsInner build() { + return new SendMailRequestAttachmentsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendMailRequestAttachmentsInner.class.getSimpleName() + "(", + ")" + ); + if (content != null) joiner.add("content=" + content); + if (type != null) joiner.add("type=" + type); + if (filename != null) joiner.add("filename=" + filename); + if (disposition != null) joiner.add("disposition=" + disposition); + if (contentId != null) joiner.add("contentId=" + contentId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestContentInner.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestContentInner.java new file mode 100644 index 00000000..3adad7c0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestContentInner.java @@ -0,0 +1,72 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendMailRequestContentInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("value") + @Getter + @Setter + private String value; + + public SendMailRequestContentInner() {} + + private SendMailRequestContentInner(Builder builder) { + this.type = builder.type; + this.value = builder.value; + } + + // Builder class for constructing object + public static class Builder { + + private String type; + private String value; + + public Builder(String type, String value) { + this.type = type; + this.value = value; + } + + public SendMailRequestContentInner build() { + return new SendMailRequestContentInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendMailRequestContentInner.class.getSimpleName() + "(", + ")" + ); + if (type != null) joiner.add("type=" + type); + if (value != null) joiner.add("value=" + value); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettings.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettings.java new file mode 100644 index 00000000..702e0257 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettings.java @@ -0,0 +1,159 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mail.models.SendMailRequestMailSettingsBypassBounceManagement; +import com.sendgrid.rest.api.v3.mail.models.SendMailRequestMailSettingsBypassListManagement; +import com.sendgrid.rest.api.v3.mail.models.SendMailRequestMailSettingsBypassSpamManagement; +import com.sendgrid.rest.api.v3.mail.models.SendMailRequestMailSettingsBypassUnsubscribeManagement; +import com.sendgrid.rest.api.v3.mail.models.SendMailRequestMailSettingsFooter; +import com.sendgrid.rest.api.v3.mail.models.SendMailRequestMailSettingsSandboxMode; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendMailRequestMailSettings { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bypass_list_management") + @Getter + @Setter + private SendMailRequestMailSettingsBypassListManagement bypassListManagement; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bypass_spam_management") + @Getter + @Setter + private SendMailRequestMailSettingsBypassSpamManagement bypassSpamManagement; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bypass_bounce_management") + @Getter + @Setter + private SendMailRequestMailSettingsBypassBounceManagement bypassBounceManagement; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bypass_unsubscribe_management") + @Getter + @Setter + private SendMailRequestMailSettingsBypassUnsubscribeManagement bypassUnsubscribeManagement; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("footer") + @Getter + @Setter + private SendMailRequestMailSettingsFooter footer; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sandbox_mode") + @Getter + @Setter + private SendMailRequestMailSettingsSandboxMode sandboxMode; + + public SendMailRequestMailSettings() {} + + private SendMailRequestMailSettings(Builder builder) { + this.bypassListManagement = builder.bypassListManagement; + this.bypassSpamManagement = builder.bypassSpamManagement; + this.bypassBounceManagement = builder.bypassBounceManagement; + this.bypassUnsubscribeManagement = builder.bypassUnsubscribeManagement; + this.footer = builder.footer; + this.sandboxMode = builder.sandboxMode; + } + + // Builder class for constructing object + public static class Builder { + + private SendMailRequestMailSettingsBypassListManagement bypassListManagement; + private SendMailRequestMailSettingsBypassSpamManagement bypassSpamManagement; + private SendMailRequestMailSettingsBypassBounceManagement bypassBounceManagement; + private SendMailRequestMailSettingsBypassUnsubscribeManagement bypassUnsubscribeManagement; + private SendMailRequestMailSettingsFooter footer; + private SendMailRequestMailSettingsSandboxMode sandboxMode; + + public Builder() {} + + public Builder bypassListManagement( + SendMailRequestMailSettingsBypassListManagement bypassListManagement + ) { + this.bypassListManagement = bypassListManagement; + return this; + } + + public Builder bypassSpamManagement( + SendMailRequestMailSettingsBypassSpamManagement bypassSpamManagement + ) { + this.bypassSpamManagement = bypassSpamManagement; + return this; + } + + public Builder bypassBounceManagement( + SendMailRequestMailSettingsBypassBounceManagement bypassBounceManagement + ) { + this.bypassBounceManagement = bypassBounceManagement; + return this; + } + + public Builder bypassUnsubscribeManagement( + SendMailRequestMailSettingsBypassUnsubscribeManagement bypassUnsubscribeManagement + ) { + this.bypassUnsubscribeManagement = bypassUnsubscribeManagement; + return this; + } + + public Builder footer(SendMailRequestMailSettingsFooter footer) { + this.footer = footer; + return this; + } + + public Builder sandboxMode( + SendMailRequestMailSettingsSandboxMode sandboxMode + ) { + this.sandboxMode = sandboxMode; + return this; + } + + public SendMailRequestMailSettings build() { + return new SendMailRequestMailSettings(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendMailRequestMailSettings.class.getSimpleName() + "(", + ")" + ); + if (bypassListManagement != null) joiner.add( + "bypassListManagement=" + bypassListManagement + ); + if (bypassSpamManagement != null) joiner.add( + "bypassSpamManagement=" + bypassSpamManagement + ); + if (bypassBounceManagement != null) joiner.add( + "bypassBounceManagement=" + bypassBounceManagement + ); + if (bypassUnsubscribeManagement != null) joiner.add( + "bypassUnsubscribeManagement=" + bypassUnsubscribeManagement + ); + if (footer != null) joiner.add("footer=" + footer); + if (sandboxMode != null) joiner.add("sandboxMode=" + sandboxMode); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsBypassBounceManagement.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsBypassBounceManagement.java new file mode 100644 index 00000000..26da3524 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsBypassBounceManagement.java @@ -0,0 +1,66 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendMailRequestMailSettingsBypassBounceManagement { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enable") + @Getter + @Setter + private Boolean enable; + + public SendMailRequestMailSettingsBypassBounceManagement() {} + + private SendMailRequestMailSettingsBypassBounceManagement(Builder builder) { + this.enable = builder.enable; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enable; + + public Builder() {} + + public Builder enable(Boolean enable) { + this.enable = enable; + return this; + } + + public SendMailRequestMailSettingsBypassBounceManagement build() { + return new SendMailRequestMailSettingsBypassBounceManagement(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendMailRequestMailSettingsBypassBounceManagement.class.getSimpleName() + + "(", + ")" + ); + if (enable != null) joiner.add("enable=" + enable); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsBypassListManagement.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsBypassListManagement.java new file mode 100644 index 00000000..71019280 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsBypassListManagement.java @@ -0,0 +1,66 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendMailRequestMailSettingsBypassListManagement { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enable") + @Getter + @Setter + private Boolean enable; + + public SendMailRequestMailSettingsBypassListManagement() {} + + private SendMailRequestMailSettingsBypassListManagement(Builder builder) { + this.enable = builder.enable; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enable; + + public Builder() {} + + public Builder enable(Boolean enable) { + this.enable = enable; + return this; + } + + public SendMailRequestMailSettingsBypassListManagement build() { + return new SendMailRequestMailSettingsBypassListManagement(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendMailRequestMailSettingsBypassListManagement.class.getSimpleName() + + "(", + ")" + ); + if (enable != null) joiner.add("enable=" + enable); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsBypassSpamManagement.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsBypassSpamManagement.java new file mode 100644 index 00000000..ed18ac07 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsBypassSpamManagement.java @@ -0,0 +1,66 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendMailRequestMailSettingsBypassSpamManagement { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enable") + @Getter + @Setter + private Boolean enable; + + public SendMailRequestMailSettingsBypassSpamManagement() {} + + private SendMailRequestMailSettingsBypassSpamManagement(Builder builder) { + this.enable = builder.enable; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enable; + + public Builder() {} + + public Builder enable(Boolean enable) { + this.enable = enable; + return this; + } + + public SendMailRequestMailSettingsBypassSpamManagement build() { + return new SendMailRequestMailSettingsBypassSpamManagement(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendMailRequestMailSettingsBypassSpamManagement.class.getSimpleName() + + "(", + ")" + ); + if (enable != null) joiner.add("enable=" + enable); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsBypassUnsubscribeManagement.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsBypassUnsubscribeManagement.java new file mode 100644 index 00000000..33138d97 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsBypassUnsubscribeManagement.java @@ -0,0 +1,70 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendMailRequestMailSettingsBypassUnsubscribeManagement { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enable") + @Getter + @Setter + private Boolean enable; + + public SendMailRequestMailSettingsBypassUnsubscribeManagement() {} + + private SendMailRequestMailSettingsBypassUnsubscribeManagement( + Builder builder + ) { + this.enable = builder.enable; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enable; + + public Builder() {} + + public Builder enable(Boolean enable) { + this.enable = enable; + return this; + } + + public SendMailRequestMailSettingsBypassUnsubscribeManagement build() { + return new SendMailRequestMailSettingsBypassUnsubscribeManagement( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendMailRequestMailSettingsBypassUnsubscribeManagement.class.getSimpleName() + + "(", + ")" + ); + if (enable != null) joiner.add("enable=" + enable); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsFooter.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsFooter.java new file mode 100644 index 00000000..ef2e6a7d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsFooter.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendMailRequestMailSettingsFooter { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enable") + @Getter + @Setter + private Boolean enable; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("text") + @Getter + @Setter + private String text; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html") + @Getter + @Setter + private String html; + + public SendMailRequestMailSettingsFooter() {} + + private SendMailRequestMailSettingsFooter(Builder builder) { + this.enable = builder.enable; + this.text = builder.text; + this.html = builder.html; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enable; + private String text; + private String html; + + public Builder() {} + + public Builder enable(Boolean enable) { + this.enable = enable; + return this; + } + + public Builder text(String text) { + this.text = text; + return this; + } + + public Builder html(String html) { + this.html = html; + return this; + } + + public SendMailRequestMailSettingsFooter build() { + return new SendMailRequestMailSettingsFooter(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendMailRequestMailSettingsFooter.class.getSimpleName() + "(", + ")" + ); + if (enable != null) joiner.add("enable=" + enable); + if (text != null) joiner.add("text=" + text); + if (html != null) joiner.add("html=" + html); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsSandboxMode.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsSandboxMode.java new file mode 100644 index 00000000..b965d700 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestMailSettingsSandboxMode.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendMailRequestMailSettingsSandboxMode { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enable") + @Getter + @Setter + private Boolean enable; + + public SendMailRequestMailSettingsSandboxMode() {} + + private SendMailRequestMailSettingsSandboxMode(Builder builder) { + this.enable = builder.enable; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enable; + + public Builder() {} + + public Builder enable(Boolean enable) { + this.enable = enable; + return this; + } + + public SendMailRequestMailSettingsSandboxMode build() { + return new SendMailRequestMailSettingsSandboxMode(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendMailRequestMailSettingsSandboxMode.class.getSimpleName() + "(", + ")" + ); + if (enable != null) joiner.add("enable=" + enable); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestPersonalizationsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestPersonalizationsInner.java new file mode 100644 index 00000000..3cf6f90f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestPersonalizationsInner.java @@ -0,0 +1,194 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mail.models.MailFrom; +import com.sendgrid.rest.api.v3.mail.models.MailTo; +import java.util.List; +import java.util.Map; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendMailRequestPersonalizationsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("from") + @Getter + @Setter + private MailFrom from; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("to") + @Getter + @Setter + private List to; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("cc") + @Getter + @Setter + private List cc; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bcc") + @Getter + @Setter + private List bcc; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subject") + @Getter + @Setter + private String subject; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("headers") + @Getter + @Setter + private Object headers; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("substitutions") + @Getter + @Setter + private Map substitutions; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("dynamic_template_data") + @Getter + @Setter + private Object dynamicTemplateData; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_args") + @Getter + @Setter + private Object customArgs; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("send_at") + @Getter + @Setter + private Integer sendAt; + + public SendMailRequestPersonalizationsInner() {} + + private SendMailRequestPersonalizationsInner(Builder builder) { + this.from = builder.from; + this.to = builder.to; + this.cc = builder.cc; + this.bcc = builder.bcc; + this.subject = builder.subject; + this.headers = builder.headers; + this.substitutions = builder.substitutions; + this.dynamicTemplateData = builder.dynamicTemplateData; + this.customArgs = builder.customArgs; + this.sendAt = builder.sendAt; + } + + // Builder class for constructing object + public static class Builder { + + private MailFrom from; + private List to; + private List cc; + private List bcc; + private String subject; + private Object headers; + private Map substitutions; + private Object dynamicTemplateData; + private Object customArgs; + private Integer sendAt; + + public Builder(List to) { + this.to = to; + } + + public Builder from(MailFrom from) { + this.from = from; + return this; + } + + public Builder cc(List cc) { + this.cc = cc; + return this; + } + + public Builder bcc(List bcc) { + this.bcc = bcc; + return this; + } + + public Builder subject(String subject) { + this.subject = subject; + return this; + } + + public Builder headers(Object headers) { + this.headers = headers; + return this; + } + + public Builder substitutions(Map substitutions) { + this.substitutions = substitutions; + return this; + } + + public Builder dynamicTemplateData(Object dynamicTemplateData) { + this.dynamicTemplateData = dynamicTemplateData; + return this; + } + + public Builder customArgs(Object customArgs) { + this.customArgs = customArgs; + return this; + } + + public Builder sendAt(Integer sendAt) { + this.sendAt = sendAt; + return this; + } + + public SendMailRequestPersonalizationsInner build() { + return new SendMailRequestPersonalizationsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendMailRequestPersonalizationsInner.class.getSimpleName() + "(", + ")" + ); + if (from != null) joiner.add("from=" + from); + if (to != null) joiner.add("to=" + to); + if (cc != null) joiner.add("cc=" + cc); + if (bcc != null) joiner.add("bcc=" + bcc); + if (subject != null) joiner.add("subject=" + subject); + if (headers != null) joiner.add("headers=" + headers); + if (substitutions != null) joiner.add("substitutions=" + substitutions); + if (dynamicTemplateData != null) joiner.add( + "dynamicTemplateData=" + dynamicTemplateData + ); + if (customArgs != null) joiner.add("customArgs=" + customArgs); + if (sendAt != null) joiner.add("sendAt=" + sendAt); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestTrackingSettings.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestTrackingSettings.java new file mode 100644 index 00000000..fafcea88 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestTrackingSettings.java @@ -0,0 +1,121 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mail.models.SendMailRequestTrackingSettingsClickTracking; +import com.sendgrid.rest.api.v3.mail.models.SendMailRequestTrackingSettingsGanalytics; +import com.sendgrid.rest.api.v3.mail.models.SendMailRequestTrackingSettingsOpenTracking; +import com.sendgrid.rest.api.v3.mail.models.SendMailRequestTrackingSettingsSubscriptionTracking; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendMailRequestTrackingSettings { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("click_tracking") + @Getter + @Setter + private SendMailRequestTrackingSettingsClickTracking clickTracking; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("open_tracking") + @Getter + @Setter + private SendMailRequestTrackingSettingsOpenTracking openTracking; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subscription_tracking") + @Getter + @Setter + private SendMailRequestTrackingSettingsSubscriptionTracking subscriptionTracking; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ganalytics") + @Getter + @Setter + private SendMailRequestTrackingSettingsGanalytics ganalytics; + + public SendMailRequestTrackingSettings() {} + + private SendMailRequestTrackingSettings(Builder builder) { + this.clickTracking = builder.clickTracking; + this.openTracking = builder.openTracking; + this.subscriptionTracking = builder.subscriptionTracking; + this.ganalytics = builder.ganalytics; + } + + // Builder class for constructing object + public static class Builder { + + private SendMailRequestTrackingSettingsClickTracking clickTracking; + private SendMailRequestTrackingSettingsOpenTracking openTracking; + private SendMailRequestTrackingSettingsSubscriptionTracking subscriptionTracking; + private SendMailRequestTrackingSettingsGanalytics ganalytics; + + public Builder() {} + + public Builder clickTracking( + SendMailRequestTrackingSettingsClickTracking clickTracking + ) { + this.clickTracking = clickTracking; + return this; + } + + public Builder openTracking( + SendMailRequestTrackingSettingsOpenTracking openTracking + ) { + this.openTracking = openTracking; + return this; + } + + public Builder subscriptionTracking( + SendMailRequestTrackingSettingsSubscriptionTracking subscriptionTracking + ) { + this.subscriptionTracking = subscriptionTracking; + return this; + } + + public Builder ganalytics( + SendMailRequestTrackingSettingsGanalytics ganalytics + ) { + this.ganalytics = ganalytics; + return this; + } + + public SendMailRequestTrackingSettings build() { + return new SendMailRequestTrackingSettings(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendMailRequestTrackingSettings.class.getSimpleName() + "(", + ")" + ); + if (clickTracking != null) joiner.add("clickTracking=" + clickTracking); + if (openTracking != null) joiner.add("openTracking=" + openTracking); + if (subscriptionTracking != null) joiner.add( + "subscriptionTracking=" + subscriptionTracking + ); + if (ganalytics != null) joiner.add("ganalytics=" + ganalytics); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestTrackingSettingsClickTracking.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestTrackingSettingsClickTracking.java new file mode 100644 index 00000000..51543686 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestTrackingSettingsClickTracking.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendMailRequestTrackingSettingsClickTracking { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enable") + @Getter + @Setter + private Boolean enable; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enable_text") + @Getter + @Setter + private Boolean enableText; + + public SendMailRequestTrackingSettingsClickTracking() {} + + private SendMailRequestTrackingSettingsClickTracking(Builder builder) { + this.enable = builder.enable; + this.enableText = builder.enableText; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enable; + private Boolean enableText; + + public Builder() {} + + public Builder enable(Boolean enable) { + this.enable = enable; + return this; + } + + public Builder enableText(Boolean enableText) { + this.enableText = enableText; + return this; + } + + public SendMailRequestTrackingSettingsClickTracking build() { + return new SendMailRequestTrackingSettingsClickTracking(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendMailRequestTrackingSettingsClickTracking.class.getSimpleName() + + "(", + ")" + ); + if (enable != null) joiner.add("enable=" + enable); + if (enableText != null) joiner.add("enableText=" + enableText); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestTrackingSettingsGanalytics.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestTrackingSettingsGanalytics.java new file mode 100644 index 00000000..0fd50853 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestTrackingSettingsGanalytics.java @@ -0,0 +1,136 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendMailRequestTrackingSettingsGanalytics { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enable") + @Getter + @Setter + private Boolean enable; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("utm_source") + @Getter + @Setter + private String utmSource; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("utm_medium") + @Getter + @Setter + private String utmMedium; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("utm_term") + @Getter + @Setter + private String utmTerm; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("utm_content") + @Getter + @Setter + private String utmContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("utm_campaign") + @Getter + @Setter + private String utmCampaign; + + public SendMailRequestTrackingSettingsGanalytics() {} + + private SendMailRequestTrackingSettingsGanalytics(Builder builder) { + this.enable = builder.enable; + this.utmSource = builder.utmSource; + this.utmMedium = builder.utmMedium; + this.utmTerm = builder.utmTerm; + this.utmContent = builder.utmContent; + this.utmCampaign = builder.utmCampaign; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enable; + private String utmSource; + private String utmMedium; + private String utmTerm; + private String utmContent; + private String utmCampaign; + + public Builder() {} + + public Builder enable(Boolean enable) { + this.enable = enable; + return this; + } + + public Builder utmSource(String utmSource) { + this.utmSource = utmSource; + return this; + } + + public Builder utmMedium(String utmMedium) { + this.utmMedium = utmMedium; + return this; + } + + public Builder utmTerm(String utmTerm) { + this.utmTerm = utmTerm; + return this; + } + + public Builder utmContent(String utmContent) { + this.utmContent = utmContent; + return this; + } + + public Builder utmCampaign(String utmCampaign) { + this.utmCampaign = utmCampaign; + return this; + } + + public SendMailRequestTrackingSettingsGanalytics build() { + return new SendMailRequestTrackingSettingsGanalytics(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendMailRequestTrackingSettingsGanalytics.class.getSimpleName() + + "(", + ")" + ); + if (enable != null) joiner.add("enable=" + enable); + if (utmSource != null) joiner.add("utmSource=" + utmSource); + if (utmMedium != null) joiner.add("utmMedium=" + utmMedium); + if (utmTerm != null) joiner.add("utmTerm=" + utmTerm); + if (utmContent != null) joiner.add("utmContent=" + utmContent); + if (utmCampaign != null) joiner.add("utmCampaign=" + utmCampaign); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestTrackingSettingsOpenTracking.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestTrackingSettingsOpenTracking.java new file mode 100644 index 00000000..e1699911 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestTrackingSettingsOpenTracking.java @@ -0,0 +1,82 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendMailRequestTrackingSettingsOpenTracking { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enable") + @Getter + @Setter + private Boolean enable; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("substitution_tag") + @Getter + @Setter + private String substitutionTag; + + public SendMailRequestTrackingSettingsOpenTracking() {} + + private SendMailRequestTrackingSettingsOpenTracking(Builder builder) { + this.enable = builder.enable; + this.substitutionTag = builder.substitutionTag; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enable; + private String substitutionTag; + + public Builder() {} + + public Builder enable(Boolean enable) { + this.enable = enable; + return this; + } + + public Builder substitutionTag(String substitutionTag) { + this.substitutionTag = substitutionTag; + return this; + } + + public SendMailRequestTrackingSettingsOpenTracking build() { + return new SendMailRequestTrackingSettingsOpenTracking(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendMailRequestTrackingSettingsOpenTracking.class.getSimpleName() + + "(", + ")" + ); + if (enable != null) joiner.add("enable=" + enable); + if (substitutionTag != null) joiner.add( + "substitutionTag=" + substitutionTag + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestTrackingSettingsSubscriptionTracking.java b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestTrackingSettingsSubscriptionTracking.java new file mode 100644 index 00000000..d7463d8b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mail/models/SendMailRequestTrackingSettingsSubscriptionTracking.java @@ -0,0 +1,114 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail API + * The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + * + * 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.mail.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendMailRequestTrackingSettingsSubscriptionTracking { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enable") + @Getter + @Setter + private Boolean enable; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("text") + @Getter + @Setter + private String text; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html") + @Getter + @Setter + private String html; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("substitution_tag") + @Getter + @Setter + private String substitutionTag; + + public SendMailRequestTrackingSettingsSubscriptionTracking() {} + + private SendMailRequestTrackingSettingsSubscriptionTracking( + Builder builder + ) { + this.enable = builder.enable; + this.text = builder.text; + this.html = builder.html; + this.substitutionTag = builder.substitutionTag; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enable; + private String text; + private String html; + private String substitutionTag; + + public Builder() {} + + public Builder enable(Boolean enable) { + this.enable = enable; + return this; + } + + public Builder text(String text) { + this.text = text; + return this; + } + + public Builder html(String html) { + this.html = html; + return this; + } + + public Builder substitutionTag(String substitutionTag) { + this.substitutionTag = substitutionTag; + return this; + } + + public SendMailRequestTrackingSettingsSubscriptionTracking build() { + return new SendMailRequestTrackingSettingsSubscriptionTracking( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendMailRequestTrackingSettingsSubscriptionTracking.class.getSimpleName() + + "(", + ")" + ); + if (enable != null) joiner.add("enable=" + enable); + if (text != null) joiner.add("text=" + text); + if (html != null) joiner.add("html=" + html); + if (substitutionTag != null) joiner.add( + "substitutionTag=" + substitutionTag + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListAddressWhitelist.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListAddressWhitelist.java new file mode 100644 index 00000000..009835b0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListAddressWhitelist.java @@ -0,0 +1,151 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings; + +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.mailsettings.models.MailSettingsAddressWhitelabel200; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListAddressWhitelist extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/mail_settings/address_whitelist"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListAddressWhitelist 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() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + Object error = JsonUtil.fromJson( + response.getStream(), + Object.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + MailSettingsAddressWhitelabel200.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListBouncePurge.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListBouncePurge.java new file mode 100644 index 00000000..6c605e01 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListBouncePurge.java @@ -0,0 +1,151 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings; + +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.mailsettings.models.MailSettingsBouncePurge; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListBouncePurge extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/mail_settings/bounce_purge"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListBouncePurge 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() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + Object error = JsonUtil.fromJson( + response.getStream(), + Object.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + MailSettingsBouncePurge.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListFooter.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListFooter.java new file mode 100644 index 00000000..5c16fdfe --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListFooter.java @@ -0,0 +1,146 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings; + +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.mailsettings.models.MailSettingsFooter; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListFooter extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/mail_settings/footer"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListFooter 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() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + Object error = JsonUtil.fromJson( + response.getStream(), + Object.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), MailSettingsFooter.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListForwardBounce.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListForwardBounce.java new file mode 100644 index 00000000..86435b40 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListForwardBounce.java @@ -0,0 +1,151 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings; + +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.mailsettings.models.MailSettingsForwardBounce; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListForwardBounce extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/mail_settings/forward_bounce"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListForwardBounce 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() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + Object error = JsonUtil.fromJson( + response.getStream(), + Object.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + MailSettingsForwardBounce.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListForwardSpam.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListForwardSpam.java new file mode 100644 index 00000000..ceaeab30 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListForwardSpam.java @@ -0,0 +1,151 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings; + +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.mailsettings.models.MailSettingsForwardSpam; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListForwardSpam extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/mail_settings/forward_spam"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListForwardSpam 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() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + Object error = JsonUtil.fromJson( + response.getStream(), + Object.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + MailSettingsForwardSpam.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListMailSetting.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListMailSetting.java new file mode 100644 index 00000000..f401e650 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListMailSetting.java @@ -0,0 +1,167 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings; + +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.mailsettings.models.ListMailSetting200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListMailSetting extends ApiKeyBase { + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/mail_settings"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListMailSetting 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() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + Object error = JsonUtil.fromJson( + response.getStream(), + Object.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + ListMailSetting200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListTemplate.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListTemplate.java new file mode 100644 index 00000000..12a86664 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/ListTemplate.java @@ -0,0 +1,151 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings; + +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.mailsettings.models.MailSettingsTemplate200; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListTemplate extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/mail_settings/template"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListTemplate 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() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + Object error = JsonUtil.fromJson( + response.getStream(), + Object.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + MailSettingsTemplate200.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateAddressWhitelist.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateAddressWhitelist.java new file mode 100644 index 00000000..5dbd695c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateAddressWhitelist.java @@ -0,0 +1,162 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings; + +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.mailsettings.models.MailSettingsAddressWhitelabel200; +import com.sendgrid.rest.api.v3.mailsettings.models.UpdateAddressWhitelistRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateAddressWhitelist extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private UpdateAddressWhitelistRequest updateAddressWhitelistRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/mail_settings/address_whitelist"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateAddressWhitelist 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() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + Object error = JsonUtil.fromJson( + response.getStream(), + Object.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + MailSettingsAddressWhitelabel200.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateAddressWhitelistRequest != null) { + request.addBody(JsonUtil.toJson(updateAddressWhitelistRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateBouncePurge.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateBouncePurge.java new file mode 100644 index 00000000..7b9321c8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateBouncePurge.java @@ -0,0 +1,161 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings; + +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.mailsettings.models.MailSettingsBouncePurge; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateBouncePurge extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private MailSettingsBouncePurge mailSettingsBouncePurge; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/mail_settings/bounce_purge"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateBouncePurge 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() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + Object error = JsonUtil.fromJson( + response.getStream(), + Object.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + MailSettingsBouncePurge.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (mailSettingsBouncePurge != null) { + request.addBody(JsonUtil.toJson(mailSettingsBouncePurge)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateFooter.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateFooter.java new file mode 100644 index 00000000..062ccf20 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateFooter.java @@ -0,0 +1,156 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings; + +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.mailsettings.models.MailSettingsFooter; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateFooter extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private MailSettingsFooter mailSettingsFooter; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/mail_settings/footer"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateFooter 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() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + Object error = JsonUtil.fromJson( + response.getStream(), + Object.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), MailSettingsFooter.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (mailSettingsFooter != null) { + request.addBody(JsonUtil.toJson(mailSettingsFooter)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateForwardBounce.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateForwardBounce.java new file mode 100644 index 00000000..ef57a315 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateForwardBounce.java @@ -0,0 +1,161 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings; + +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.mailsettings.models.MailSettingsForwardBounce; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateForwardBounce extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private MailSettingsForwardBounce mailSettingsForwardBounce; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/mail_settings/forward_bounce"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateForwardBounce 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() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + Object error = JsonUtil.fromJson( + response.getStream(), + Object.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + MailSettingsForwardBounce.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (mailSettingsForwardBounce != null) { + request.addBody(JsonUtil.toJson(mailSettingsForwardBounce)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateForwardSpam.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateForwardSpam.java new file mode 100644 index 00000000..74e87e20 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateForwardSpam.java @@ -0,0 +1,161 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings; + +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.mailsettings.models.MailSettingsForwardSpam; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateForwardSpam extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private MailSettingsForwardSpam mailSettingsForwardSpam; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/mail_settings/forward_spam"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateForwardSpam 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() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + Object error = JsonUtil.fromJson( + response.getStream(), + Object.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + MailSettingsForwardSpam.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (mailSettingsForwardSpam != null) { + request.addBody(JsonUtil.toJson(mailSettingsForwardSpam)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateTemplate.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateTemplate.java new file mode 100644 index 00000000..eb04b48b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/UpdateTemplate.java @@ -0,0 +1,162 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings; + +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.mailsettings.models.UpdateTemplate200Response; +import com.sendgrid.rest.api.v3.mailsettings.models.UpdateTemplateRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateTemplate extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private UpdateTemplateRequest updateTemplateRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/mail_settings/template"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateTemplate 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() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + Object error = JsonUtil.fromJson( + response.getStream(), + Object.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + UpdateTemplate200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateTemplateRequest != null) { + request.addBody(JsonUtil.toJson(updateTemplateRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/ListMailSetting200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/ListMailSetting200Response.java new file mode 100644 index 00000000..29ef8308 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/ListMailSetting200Response.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mailsettings.models.ListMailSetting200ResponseResultInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListMailSetting200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + public ListMailSetting200Response() {} + + private ListMailSetting200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + + public Builder(List result) { + this.result = result; + } + + public ListMailSetting200Response build() { + return new ListMailSetting200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListMailSetting200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/ListMailSetting200ResponseResultInner.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/ListMailSetting200ResponseResultInner.java new file mode 100644 index 00000000..8c11a0e4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/ListMailSetting200ResponseResultInner.java @@ -0,0 +1,97 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListMailSetting200ResponseResultInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("title") + @Getter + @Setter + private String title; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + @Getter + @Setter + private String description; + + public ListMailSetting200ResponseResultInner() {} + + private ListMailSetting200ResponseResultInner(Builder builder) { + this.title = builder.title; + this.enabled = builder.enabled; + this.name = builder.name; + this.description = builder.description; + } + + // Builder class for constructing object + public static class Builder { + + private String title; + private Boolean enabled; + private String name; + private String description; + + public Builder( + String title, + Boolean enabled, + String name, + String description + ) { + this.title = title; + this.enabled = enabled; + this.name = name; + this.description = description; + } + + public ListMailSetting200ResponseResultInner build() { + return new ListMailSetting200ResponseResultInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListMailSetting200ResponseResultInner.class.getSimpleName() + "(", + ")" + ); + if (title != null) joiner.add("title=" + title); + if (enabled != null) joiner.add("enabled=" + enabled); + if (name != null) joiner.add("name=" + name); + if (description != null) joiner.add("description=" + description); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsAddressWhitelabel200.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsAddressWhitelabel200.java new file mode 100644 index 00000000..983c097e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsAddressWhitelabel200.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class MailSettingsAddressWhitelabel200 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list") + @Getter + @Setter + private List _list; + + public MailSettingsAddressWhitelabel200() {} + + private MailSettingsAddressWhitelabel200(Builder builder) { + this.enabled = builder.enabled; + this._list = builder._list; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + private List _list; + + public Builder() {} + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public Builder _list(List _list) { + this._list = _list; + return this; + } + + public MailSettingsAddressWhitelabel200 build() { + return new MailSettingsAddressWhitelabel200(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + MailSettingsAddressWhitelabel200.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + if (_list != null) joiner.add("_list=" + _list); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsBouncePurge.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsBouncePurge.java new file mode 100644 index 00000000..156ae1ac --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsBouncePurge.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class MailSettingsBouncePurge { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("soft_bounces") + @Getter + @Setter + private Integer softBounces; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("hard_bounces") + @Getter + @Setter + private Integer hardBounces; + + public MailSettingsBouncePurge() {} + + private MailSettingsBouncePurge(Builder builder) { + this.enabled = builder.enabled; + this.softBounces = builder.softBounces; + this.hardBounces = builder.hardBounces; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + private Integer softBounces; + private Integer hardBounces; + + public Builder() {} + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public Builder softBounces(Integer softBounces) { + this.softBounces = softBounces; + return this; + } + + public Builder hardBounces(Integer hardBounces) { + this.hardBounces = hardBounces; + return this; + } + + public MailSettingsBouncePurge build() { + return new MailSettingsBouncePurge(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + MailSettingsBouncePurge.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + if (softBounces != null) joiner.add("softBounces=" + softBounces); + if (hardBounces != null) joiner.add("hardBounces=" + hardBounces); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsFooter.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsFooter.java new file mode 100644 index 00000000..a805cc84 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsFooter.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class MailSettingsFooter { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html_content") + @Getter + @Setter + private String htmlContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("plain_content") + @Getter + @Setter + private String plainContent; + + public MailSettingsFooter() {} + + private MailSettingsFooter(Builder builder) { + this.enabled = builder.enabled; + this.htmlContent = builder.htmlContent; + this.plainContent = builder.plainContent; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + private String htmlContent; + private String plainContent; + + public Builder() {} + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public Builder htmlContent(String htmlContent) { + this.htmlContent = htmlContent; + return this; + } + + public Builder plainContent(String plainContent) { + this.plainContent = plainContent; + return this; + } + + public MailSettingsFooter build() { + return new MailSettingsFooter(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + MailSettingsFooter.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + if (htmlContent != null) joiner.add("htmlContent=" + htmlContent); + if (plainContent != null) joiner.add("plainContent=" + plainContent); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsForwardBounce.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsForwardBounce.java new file mode 100644 index 00000000..2851a0bf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsForwardBounce.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class MailSettingsForwardBounce { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + public MailSettingsForwardBounce() {} + + private MailSettingsForwardBounce(Builder builder) { + this.email = builder.email; + this.enabled = builder.enabled; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + private Boolean enabled; + + public Builder() {} + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public MailSettingsForwardBounce build() { + return new MailSettingsForwardBounce(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + MailSettingsForwardBounce.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + if (enabled != null) joiner.add("enabled=" + enabled); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsForwardSpam.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsForwardSpam.java new file mode 100644 index 00000000..a1b6cbaa --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsForwardSpam.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class MailSettingsForwardSpam { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + public MailSettingsForwardSpam() {} + + private MailSettingsForwardSpam(Builder builder) { + this.email = builder.email; + this.enabled = builder.enabled; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + private Boolean enabled; + + public Builder() {} + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public MailSettingsForwardSpam build() { + return new MailSettingsForwardSpam(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + MailSettingsForwardSpam.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + if (enabled != null) joiner.add("enabled=" + enabled); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsTemplate200.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsTemplate200.java new file mode 100644 index 00000000..7e06a313 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/MailSettingsTemplate200.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class MailSettingsTemplate200 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html_content") + @Getter + @Setter + private String htmlContent; + + public MailSettingsTemplate200() {} + + private MailSettingsTemplate200(Builder builder) { + this.enabled = builder.enabled; + this.htmlContent = builder.htmlContent; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + private String htmlContent; + + public Builder() {} + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public Builder htmlContent(String htmlContent) { + this.htmlContent = htmlContent; + return this; + } + + public MailSettingsTemplate200 build() { + return new MailSettingsTemplate200(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + MailSettingsTemplate200.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + if (htmlContent != null) joiner.add("htmlContent=" + htmlContent); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/UpdateAddressWhitelistRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/UpdateAddressWhitelistRequest.java new file mode 100644 index 00000000..16b8c0cb --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/UpdateAddressWhitelistRequest.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateAddressWhitelistRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list") + @Getter + @Setter + private List _list; + + public UpdateAddressWhitelistRequest() {} + + private UpdateAddressWhitelistRequest(Builder builder) { + this.enabled = builder.enabled; + this._list = builder._list; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + private List _list; + + public Builder() {} + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public Builder _list(List _list) { + this._list = _list; + return this; + } + + public UpdateAddressWhitelistRequest build() { + return new UpdateAddressWhitelistRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateAddressWhitelistRequest.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + if (_list != null) joiner.add("_list=" + _list); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/UpdateTemplate200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/UpdateTemplate200Response.java new file mode 100644 index 00000000..d46cad78 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/UpdateTemplate200Response.java @@ -0,0 +1,72 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateTemplate200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html_content") + @Getter + @Setter + private String htmlContent; + + public UpdateTemplate200Response() {} + + private UpdateTemplate200Response(Builder builder) { + this.enabled = builder.enabled; + this.htmlContent = builder.htmlContent; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + private String htmlContent; + + public Builder(Boolean enabled, String htmlContent) { + this.enabled = enabled; + this.htmlContent = htmlContent; + } + + public UpdateTemplate200Response build() { + return new UpdateTemplate200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateTemplate200Response.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + if (htmlContent != null) joiner.add("htmlContent=" + htmlContent); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/UpdateTemplateRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/UpdateTemplateRequest.java new file mode 100644 index 00000000..e2968a55 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mailsettings/models/UpdateTemplateRequest.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Mail Settings API + * The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + * + * 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.mailsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateTemplateRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html_content") + @Getter + @Setter + private String htmlContent; + + public UpdateTemplateRequest() {} + + private UpdateTemplateRequest(Builder builder) { + this.enabled = builder.enabled; + this.htmlContent = builder.htmlContent; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + private String htmlContent; + + public Builder() {} + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public Builder htmlContent(String htmlContent) { + this.htmlContent = htmlContent; + return this; + } + + public UpdateTemplateRequest build() { + return new UpdateTemplateRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateTemplateRequest.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + if (htmlContent != null) joiner.add("htmlContent=" + htmlContent); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/DeleteContact.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/DeleteContact.java new file mode 100644 index 00000000..316a6827 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/DeleteContact.java @@ -0,0 +1,163 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts; + +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.mccontacts.models.DeleteContact202Response; +import com.sendgrid.rest.api.v3.mccontacts.models.DeleteContact400Response; +import com.sendgrid.rest.api.v3.mccontacts.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteContact extends ApiKeyBase { + + @Setter + private String deleteAllContacts; + + @Setter + private String ids; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/contacts"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteContact 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")) { + DeleteContact400Response error = JsonUtil.fromJson( + response.getStream(), + DeleteContact400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + SearchContact500Response error = JsonUtil.fromJson( + response.getStream(), + SearchContact500Response.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(), + DeleteContact202Response.class + ), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (deleteAllContacts != null) { + request.addQueryParam( + "delete_all_contacts", + deleteAllContacts.toString() + ); + } + if (ids != null) { + request.addQueryParam("ids", ids.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/DeleteContactIdentifier.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/DeleteContactIdentifier.java new file mode 100644 index 00000000..fe832826 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/DeleteContactIdentifier.java @@ -0,0 +1,164 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts; + +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.mccontacts.models.DeleteContact400Response; +import com.sendgrid.rest.api.v3.mccontacts.models.DeleteContactIdentifier202Response; +import com.sendgrid.rest.api.v3.mccontacts.models.DeleteContactIdentifierRequest; +import com.sendgrid.rest.api.v3.mccontacts.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteContactIdentifier extends ApiKeyBase { + + private final String contactId; + + @Setter + private DeleteContactIdentifierRequest deleteContactIdentifierRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/contacts/{contact_id}/identifiers"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteContactIdentifier 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")) { + DeleteContact400Response error = JsonUtil.fromJson( + response.getStream(), + DeleteContact400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + SearchContact500Response error = JsonUtil.fromJson( + response.getStream(), + SearchContact500Response.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(), + DeleteContactIdentifier202Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (contactId != null) { + request.addPathParam("contact_id", contactId.toString()); + } + } + + private void addBody(final Request request) { + if (deleteContactIdentifierRequest != null) { + request.addBody(JsonUtil.toJson(deleteContactIdentifierRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ExportContact.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ExportContact.java new file mode 100644 index 00000000..738dfab2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ExportContact.java @@ -0,0 +1,155 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts; + +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.mccontacts.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mccontacts.models.ExportContact202Response; +import com.sendgrid.rest.api.v3.mccontacts.models.ExportContactRequest; +import com.sendgrid.rest.api.v3.mccontacts.models.ListContact400Response; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ExportContact extends ApiKeyBase { + + @Setter + private ExportContactRequest exportContactRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/contacts/exports"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ExportContact 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")) { + ListContact400Response error = JsonUtil.fromJson( + response.getStream(), + ListContact400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + SearchContact500Response error = JsonUtil.fromJson( + response.getStream(), + SearchContact500Response.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(), + ExportContact202Response.class + ), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (exportContactRequest != null) { + request.addBody(JsonUtil.toJson(exportContactRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/GetContact.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/GetContact.java new file mode 100644 index 00000000..69d7116a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/GetContact.java @@ -0,0 +1,116 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts; + +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.mccontacts.models.ContactDetails3; +import com.sendgrid.rest.api.v3.mccontacts.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class GetContact extends ApiKeyBase { + + private final String id; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/contacts/{id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetContact 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + SearchContact500Response error = JsonUtil.fromJson( + response.getStream(), + SearchContact500Response.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 (id != null) { + request.addPathParam("id", id.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/GetContactByIdentifiers.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/GetContactByIdentifiers.java new file mode 100644 index 00000000..be8bfdb2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/GetContactByIdentifiers.java @@ -0,0 +1,166 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts; + +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.mccontacts.models.ContactsError; +import com.sendgrid.rest.api.v3.mccontacts.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mccontacts.models.GetContactByIdentifiers200Response; +import com.sendgrid.rest.api.v3.mccontacts.models.GetContactByIdentifiersRequest; +import com.sendgrid.rest.api.v3.mccontacts.models.IdentifierType; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetContactByIdentifiers extends ApiKeyBase { + + private final IdentifierType identifierType; + + @Setter + private GetContactByIdentifiersRequest getContactByIdentifiersRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = + "/v3/marketing/contacts/search/identifiers/{identifier_type}"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetContactByIdentifiers 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")) { + ContactsError error = JsonUtil.fromJson( + response.getStream(), + ContactsError.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ContactsError error = JsonUtil.fromJson( + response.getStream(), + ContactsError.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + SearchContact500Response error = JsonUtil.fromJson( + response.getStream(), + SearchContact500Response.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(), + GetContactByIdentifiers200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (identifierType != null) { + request.addPathParam("identifier_type", identifierType.toString()); + } + } + + private void addBody(final Request request) { + if (getContactByIdentifiersRequest != null) { + request.addBody(JsonUtil.toJson(getContactByIdentifiersRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/GetExportContact.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/GetExportContact.java new file mode 100644 index 00000000..095950ae --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/GetExportContact.java @@ -0,0 +1,147 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts; + +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.mccontacts.models.ContactExport; +import com.sendgrid.rest.api.v3.mccontacts.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mccontacts.models.ListContact400Response; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class GetExportContact extends ApiKeyBase { + + private final String id; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/contacts/exports/{id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetExportContact 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")) { + ListContact400Response error = JsonUtil.fromJson( + response.getStream(), + ListContact400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + SearchContact500Response error = JsonUtil.fromJson( + response.getStream(), + SearchContact500Response.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(), ContactExport.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/GetImportContact.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/GetImportContact.java new file mode 100644 index 00000000..c4921ac9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/GetImportContact.java @@ -0,0 +1,147 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts; + +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.mccontacts.models.ContactImport; +import com.sendgrid.rest.api.v3.mccontacts.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mccontacts.models.GetImportContact400Response; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class GetImportContact extends ApiKeyBase { + + private final String id; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/contacts/imports/{id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetImportContact 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")) { + GetImportContact400Response error = JsonUtil.fromJson( + response.getStream(), + GetImportContact400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + SearchContact500Response error = JsonUtil.fromJson( + response.getStream(), + SearchContact500Response.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(), ContactImport.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ImportContact.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ImportContact.java new file mode 100644 index 00000000..ce309da5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ImportContact.java @@ -0,0 +1,156 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts; + +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.mccontacts.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mccontacts.models.ImportContact200Response; +import com.sendgrid.rest.api.v3.mccontacts.models.ImportContact400Response; +import com.sendgrid.rest.api.v3.mccontacts.models.ImportContact404Response; +import com.sendgrid.rest.api.v3.mccontacts.models.ImportContactRequest; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ImportContact extends ApiKeyBase { + + @Setter + private ImportContactRequest importContactRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/contacts/imports"; + Request request = new Request( + HttpMethod.PUT, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ImportContact 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")) { + ImportContact400Response error = JsonUtil.fromJson( + response.getStream(), + ImportContact400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ImportContact404Response error = JsonUtil.fromJson( + response.getStream(), + ImportContact404Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + SearchContact500Response error = JsonUtil.fromJson( + response.getStream(), + SearchContact500Response.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(), + ImportContact200Response.class + ), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (importContactRequest != null) { + request.addBody(JsonUtil.toJson(importContactRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ListBatchedContact.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ListBatchedContact.java new file mode 100644 index 00000000..316e6584 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ListBatchedContact.java @@ -0,0 +1,141 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts; + +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.mccontacts.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mccontacts.models.ListBatchedContact200Response; +import com.sendgrid.rest.api.v3.mccontacts.models.ListBatchedContactRequest; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListBatchedContact extends ApiKeyBase { + + @Setter + private ListBatchedContactRequest listBatchedContactRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/contacts/batch"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListBatchedContact 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + SearchContact500Response error = JsonUtil.fromJson( + response.getStream(), + SearchContact500Response.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(), + ListBatchedContact200Response.class + ), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (listBatchedContactRequest != null) { + request.addBody(JsonUtil.toJson(listBatchedContactRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ListContact.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ListContact.java new file mode 100644 index 00000000..5eedc44f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ListContact.java @@ -0,0 +1,143 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts; + +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.mccontacts.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mccontacts.models.ListContact200Response; +import com.sendgrid.rest.api.v3.mccontacts.models.ListContact400Response; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListContact extends ApiKeyBase { + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/contacts"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListContact 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")) { + ListContact400Response error = JsonUtil.fromJson( + response.getStream(), + ListContact400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + SearchContact500Response error = JsonUtil.fromJson( + response.getStream(), + SearchContact500Response.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(), + ListContact200Response.class + ), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ListContactByEmail.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ListContactByEmail.java new file mode 100644 index 00000000..cb22047c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ListContactByEmail.java @@ -0,0 +1,154 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts; + +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.mccontacts.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mccontacts.models.ListContactByEmail200Response; +import com.sendgrid.rest.api.v3.mccontacts.models.ListContactByEmailRequest; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListContactByEmail extends ApiKeyBase { + + @Setter + private ListContactByEmailRequest listContactByEmailRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/contacts/search/emails"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListContactByEmail 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + SearchContact500Response error = JsonUtil.fromJson( + response.getStream(), + SearchContact500Response.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(), + ListContactByEmail200Response.class + ), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (listContactByEmailRequest != null) { + request.addBody(JsonUtil.toJson(listContactByEmailRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ListContactCount.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ListContactCount.java new file mode 100644 index 00000000..44f097f6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ListContactCount.java @@ -0,0 +1,129 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts; + +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.mccontacts.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mccontacts.models.ListContactCount200Response; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListContactCount extends ApiKeyBase { + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/contacts/count"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListContactCount 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + SearchContact500Response error = JsonUtil.fromJson( + response.getStream(), + SearchContact500Response.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(), + ListContactCount200Response.class + ), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ListExportContact.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ListExportContact.java new file mode 100644 index 00000000..ba6dbb21 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/ListExportContact.java @@ -0,0 +1,143 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts; + +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.mccontacts.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mccontacts.models.ListExportContact200Response; +import com.sendgrid.rest.api.v3.mccontacts.models.ListExportContact400Response; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListExportContact extends ApiKeyBase { + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/contacts/exports"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListExportContact 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")) { + ListExportContact400Response error = JsonUtil.fromJson( + response.getStream(), + ListExportContact400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + SearchContact500Response error = JsonUtil.fromJson( + response.getStream(), + SearchContact500Response.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(), + ListExportContact200Response.class + ), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/SearchContact.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/SearchContact.java new file mode 100644 index 00000000..244ceebf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/SearchContact.java @@ -0,0 +1,148 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts; + +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.mccontacts.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact200Response; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact400Response; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact500Response; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContactRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class SearchContact extends ApiKeyBase { + + @Setter + private SearchContactRequest searchContactRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/contacts/search"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "SearchContact 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")) { + SearchContact400Response error = JsonUtil.fromJson( + response.getStream(), + SearchContact400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + SearchContact500Response error = JsonUtil.fromJson( + response.getStream(), + SearchContact500Response.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 addBody(final Request request) { + if (searchContactRequest != null) { + request.addBody(JsonUtil.toJson(searchContactRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/UpdateContact.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/UpdateContact.java new file mode 100644 index 00000000..cf8493ce --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/UpdateContact.java @@ -0,0 +1,155 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts; + +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.mccontacts.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mccontacts.models.ListContact400Response; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact500Response; +import com.sendgrid.rest.api.v3.mccontacts.models.UpdateContact202Response; +import com.sendgrid.rest.api.v3.mccontacts.models.UpdateContactRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateContact extends ApiKeyBase { + + @Setter + private UpdateContactRequest updateContactRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/contacts"; + Request request = new Request( + HttpMethod.PUT, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateContact 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")) { + ListContact400Response error = JsonUtil.fromJson( + response.getStream(), + ListContact400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + SearchContact500Response error = JsonUtil.fromJson( + response.getStream(), + SearchContact500Response.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(), + UpdateContact202Response.class + ), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (updateContactRequest != null) { + request.addBody(JsonUtil.toJson(updateContactRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactDetails3.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactDetails3.java new file mode 100644 index 00000000..b1f728a9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactDetails3.java @@ -0,0 +1,394 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.SelfMetadata; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactDetails3 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unique_name") + @Getter + @Setter + private String uniqueName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("phone_number_id") + @Getter + @Setter + private String phoneNumberId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("external_id") + @Getter + @Setter + private String externalId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("anonymous_id") + @Getter + @Setter + private String anonymousId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("alternate_emails") + @Getter + @Setter + private List alternateEmails; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_line_1") + @Getter + @Setter + private String addressLine1; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_line_2") + @Getter + @Setter + private String addressLine2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city") + @Getter + @Setter + private String city; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state_province_region") + @Getter + @Setter + private String stateProvinceRegion; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country") + @Getter + @Setter + private String country; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("postal_code") + @Getter + @Setter + private String postalCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("phone_number") + @Getter + @Setter + private String phoneNumber; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("whatsapp") + @Getter + @Setter + private String whatsapp; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("line") + @Getter + @Setter + private String line; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("facebook") + @Getter + @Setter + private String facebook; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list_ids") + @Getter + @Setter + private List listIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("segment_ids") + @Getter + @Setter + private List segmentIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_fields") + @Getter + @Setter + private Object customFields; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private String createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private String updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private SelfMetadata metadata; + + public ContactDetails3() {} + + private ContactDetails3(Builder builder) { + this.id = builder.id; + this.firstName = builder.firstName; + this.lastName = builder.lastName; + this.uniqueName = builder.uniqueName; + this.email = builder.email; + this.phoneNumberId = builder.phoneNumberId; + this.externalId = builder.externalId; + this.anonymousId = builder.anonymousId; + this.alternateEmails = builder.alternateEmails; + this.addressLine1 = builder.addressLine1; + this.addressLine2 = builder.addressLine2; + this.city = builder.city; + this.stateProvinceRegion = builder.stateProvinceRegion; + this.country = builder.country; + this.postalCode = builder.postalCode; + this.phoneNumber = builder.phoneNumber; + this.whatsapp = builder.whatsapp; + this.line = builder.line; + this.facebook = builder.facebook; + this.listIds = builder.listIds; + this.segmentIds = builder.segmentIds; + this.customFields = builder.customFields; + this.createdAt = builder.createdAt; + this.updatedAt = builder.updatedAt; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private String id; + private String firstName; + private String lastName; + private String uniqueName; + private String email; + private String phoneNumberId; + private String externalId; + private String anonymousId; + private List alternateEmails; + private String addressLine1; + private String addressLine2; + private String city; + private String stateProvinceRegion; + private String country; + private String postalCode; + private String phoneNumber; + private String whatsapp; + private String line; + private String facebook; + private List listIds; + private List segmentIds; + private Object customFields; + private String createdAt; + private String updatedAt; + private SelfMetadata metadata; + + public Builder( + String id, + List listIds, + List segmentIds, + String createdAt, + String updatedAt + ) { + this.id = id; + this.listIds = listIds; + this.segmentIds = segmentIds; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Builder firstName(String firstName) { + this.firstName = firstName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = lastName; + return this; + } + + public Builder uniqueName(String uniqueName) { + this.uniqueName = uniqueName; + return this; + } + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder phoneNumberId(String phoneNumberId) { + this.phoneNumberId = phoneNumberId; + return this; + } + + public Builder externalId(String externalId) { + this.externalId = externalId; + return this; + } + + public Builder anonymousId(String anonymousId) { + this.anonymousId = anonymousId; + return this; + } + + public Builder alternateEmails(List alternateEmails) { + this.alternateEmails = alternateEmails; + return this; + } + + public Builder addressLine1(String addressLine1) { + this.addressLine1 = addressLine1; + return this; + } + + public Builder addressLine2(String addressLine2) { + this.addressLine2 = addressLine2; + return this; + } + + public Builder city(String city) { + this.city = city; + return this; + } + + public Builder stateProvinceRegion(String stateProvinceRegion) { + this.stateProvinceRegion = stateProvinceRegion; + return this; + } + + public Builder country(String country) { + this.country = country; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder phoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + public Builder whatsapp(String whatsapp) { + this.whatsapp = whatsapp; + return this; + } + + public Builder line(String line) { + this.line = line; + return this; + } + + public Builder facebook(String facebook) { + this.facebook = facebook; + return this; + } + + public Builder customFields(Object customFields) { + this.customFields = customFields; + return this; + } + + public Builder metadata(SelfMetadata metadata) { + this.metadata = metadata; + return this; + } + + public ContactDetails3 build() { + return new ContactDetails3(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactDetails3.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (firstName != null) joiner.add("firstName=" + firstName); + if (lastName != null) joiner.add("lastName=" + lastName); + if (uniqueName != null) joiner.add("uniqueName=" + uniqueName); + if (email != null) joiner.add("email=" + email); + if (phoneNumberId != null) joiner.add("phoneNumberId=" + phoneNumberId); + if (externalId != null) joiner.add("externalId=" + externalId); + if (anonymousId != null) joiner.add("anonymousId=" + anonymousId); + if (alternateEmails != null) joiner.add( + "alternateEmails=" + alternateEmails + ); + if (addressLine1 != null) joiner.add("addressLine1=" + addressLine1); + if (addressLine2 != null) joiner.add("addressLine2=" + addressLine2); + if (city != null) joiner.add("city=" + city); + if (stateProvinceRegion != null) joiner.add( + "stateProvinceRegion=" + stateProvinceRegion + ); + if (country != null) joiner.add("country=" + country); + if (postalCode != null) joiner.add("postalCode=" + postalCode); + if (phoneNumber != null) joiner.add("phoneNumber=" + phoneNumber); + if (whatsapp != null) joiner.add("whatsapp=" + whatsapp); + if (line != null) joiner.add("line=" + line); + if (facebook != null) joiner.add("facebook=" + facebook); + if (listIds != null) joiner.add("listIds=" + listIds); + if (segmentIds != null) joiner.add("segmentIds=" + segmentIds); + if (customFields != null) joiner.add("customFields=" + customFields); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactExport.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactExport.java new file mode 100644 index 00000000..75570d24 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactExport.java @@ -0,0 +1,181 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.Metadata; +import com.sendgrid.rest.api.v3.mccontacts.models.Status; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactExport { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private Status status; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private String createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private String updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("completed_at") + @Getter + @Setter + private String completedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("expires_at") + @Getter + @Setter + private String expiresAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("urls") + @Getter + @Setter + private List urls; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private Metadata metadata; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("contact_count") + @Getter + @Setter + private Integer contactCount; + + public ContactExport() {} + + private ContactExport(Builder builder) { + this.id = builder.id; + this.status = builder.status; + this.createdAt = builder.createdAt; + this.updatedAt = builder.updatedAt; + this.completedAt = builder.completedAt; + this.expiresAt = builder.expiresAt; + this.urls = builder.urls; + this.message = builder.message; + this.metadata = builder.metadata; + this.contactCount = builder.contactCount; + } + + // Builder class for constructing object + public static class Builder { + + private String id; + private Status status; + private String createdAt; + private String updatedAt; + private String completedAt; + private String expiresAt; + private List urls; + private String message; + private Metadata metadata; + private Integer contactCount; + + public Builder( + String id, + Status status, + String createdAt, + String updatedAt, + String expiresAt + ) { + this.id = id; + this.status = status; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.expiresAt = expiresAt; + } + + public Builder completedAt(String completedAt) { + this.completedAt = completedAt; + return this; + } + + public Builder urls(List urls) { + this.urls = urls; + return this; + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder metadata(Metadata metadata) { + this.metadata = metadata; + return this; + } + + public Builder contactCount(Integer contactCount) { + this.contactCount = contactCount; + return this; + } + + public ContactExport build() { + return new ContactExport(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactExport.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (status != null) joiner.add("status=" + status); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (completedAt != null) joiner.add("completedAt=" + completedAt); + if (expiresAt != null) joiner.add("expiresAt=" + expiresAt); + if (urls != null) joiner.add("urls=" + urls); + if (message != null) joiner.add("message=" + message); + if (metadata != null) joiner.add("metadata=" + metadata); + if (contactCount != null) joiner.add("contactCount=" + contactCount); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactImport.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactImport.java new file mode 100644 index 00000000..9f3f2216 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactImport.java @@ -0,0 +1,136 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ContactImportResults; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactImport { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private String status; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("job_type") + @Getter + @Setter + private String jobType; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("results") + @Getter + @Setter + private ContactImportResults results; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("started_at") + @Getter + @Setter + private String startedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("finished_at") + @Getter + @Setter + private String finishedAt; + + public ContactImport() {} + + private ContactImport(Builder builder) { + this.id = builder.id; + this.status = builder.status; + this.jobType = builder.jobType; + this.results = builder.results; + this.startedAt = builder.startedAt; + this.finishedAt = builder.finishedAt; + } + + // Builder class for constructing object + public static class Builder { + + private String id; + private String status; + private String jobType; + private ContactImportResults results; + private String startedAt; + private String finishedAt; + + public Builder() {} + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder status(String status) { + this.status = status; + return this; + } + + public Builder jobType(String jobType) { + this.jobType = jobType; + return this; + } + + public Builder results(ContactImportResults results) { + this.results = results; + return this; + } + + public Builder startedAt(String startedAt) { + this.startedAt = startedAt; + return this; + } + + public Builder finishedAt(String finishedAt) { + this.finishedAt = finishedAt; + return this; + } + + public ContactImport build() { + return new ContactImport(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactImport.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (status != null) joiner.add("status=" + status); + if (jobType != null) joiner.add("jobType=" + jobType); + if (results != null) joiner.add("results=" + results); + if (startedAt != null) joiner.add("startedAt=" + startedAt); + if (finishedAt != null) joiner.add("finishedAt=" + finishedAt); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactImportResults.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactImportResults.java new file mode 100644 index 00000000..0174e2b3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactImportResults.java @@ -0,0 +1,138 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactImportResults { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("requested_count") + @Getter + @Setter + private BigDecimal requestedCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_count") + @Getter + @Setter + private BigDecimal createdCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_count") + @Getter + @Setter + private BigDecimal updatedCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("deleted_count") + @Getter + @Setter + private BigDecimal deletedCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errored_count") + @Getter + @Setter + private BigDecimal erroredCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors_url") + @Getter + @Setter + private String errorsUrl; + + public ContactImportResults() {} + + private ContactImportResults(Builder builder) { + this.requestedCount = builder.requestedCount; + this.createdCount = builder.createdCount; + this.updatedCount = builder.updatedCount; + this.deletedCount = builder.deletedCount; + this.erroredCount = builder.erroredCount; + this.errorsUrl = builder.errorsUrl; + } + + // Builder class for constructing object + public static class Builder { + + private BigDecimal requestedCount; + private BigDecimal createdCount; + private BigDecimal updatedCount; + private BigDecimal deletedCount; + private BigDecimal erroredCount; + private String errorsUrl; + + public Builder() {} + + public Builder requestedCount(BigDecimal requestedCount) { + this.requestedCount = requestedCount; + return this; + } + + public Builder createdCount(BigDecimal createdCount) { + this.createdCount = createdCount; + return this; + } + + public Builder updatedCount(BigDecimal updatedCount) { + this.updatedCount = updatedCount; + return this; + } + + public Builder deletedCount(BigDecimal deletedCount) { + this.deletedCount = deletedCount; + return this; + } + + public Builder erroredCount(BigDecimal erroredCount) { + this.erroredCount = erroredCount; + return this; + } + + public Builder errorsUrl(String errorsUrl) { + this.errorsUrl = errorsUrl; + return this; + } + + public ContactImportResults build() { + return new ContactImportResults(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactImportResults.class.getSimpleName() + "(", + ")" + ); + if (requestedCount != null) joiner.add( + "requestedCount=" + requestedCount + ); + if (createdCount != null) joiner.add("createdCount=" + createdCount); + if (updatedCount != null) joiner.add("updatedCount=" + updatedCount); + if (deletedCount != null) joiner.add("deletedCount=" + deletedCount); + if (erroredCount != null) joiner.add("erroredCount=" + erroredCount); + if (errorsUrl != null) joiner.add("errorsUrl=" + errorsUrl); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactRequest.java new file mode 100644 index 00000000..da12071f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactRequest.java @@ -0,0 +1,253 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ContactRequestCustomFields; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_line_1") + @Getter + @Setter + private String addressLine1; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_line_2") + @Getter + @Setter + private String addressLine2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("alternate_emails") + @Getter + @Setter + private List alternateEmails; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city") + @Getter + @Setter + private String city; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country") + @Getter + @Setter + private String country; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("phone_number_id") + @Getter + @Setter + private String phoneNumberId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("external_id") + @Getter + @Setter + private String externalId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("anonymous_id") + @Getter + @Setter + private String anonymousId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("postal_code") + @Getter + @Setter + private String postalCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state_province_region") + @Getter + @Setter + private String stateProvinceRegion; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_fields") + @Getter + @Setter + private ContactRequestCustomFields customFields; + + public ContactRequest() {} + + private ContactRequest(Builder builder) { + this.addressLine1 = builder.addressLine1; + this.addressLine2 = builder.addressLine2; + this.alternateEmails = builder.alternateEmails; + this.city = builder.city; + this.country = builder.country; + this.email = builder.email; + this.phoneNumberId = builder.phoneNumberId; + this.externalId = builder.externalId; + this.anonymousId = builder.anonymousId; + this.firstName = builder.firstName; + this.lastName = builder.lastName; + this.postalCode = builder.postalCode; + this.stateProvinceRegion = builder.stateProvinceRegion; + this.customFields = builder.customFields; + } + + // Builder class for constructing object + public static class Builder { + + private String addressLine1; + private String addressLine2; + private List alternateEmails; + private String city; + private String country; + private String email; + private String phoneNumberId; + private String externalId; + private String anonymousId; + private String firstName; + private String lastName; + private String postalCode; + private String stateProvinceRegion; + private ContactRequestCustomFields customFields; + + public Builder() {} + + public Builder addressLine1(String addressLine1) { + this.addressLine1 = addressLine1; + return this; + } + + public Builder addressLine2(String addressLine2) { + this.addressLine2 = addressLine2; + return this; + } + + public Builder alternateEmails(List alternateEmails) { + this.alternateEmails = alternateEmails; + return this; + } + + public Builder city(String city) { + this.city = city; + return this; + } + + public Builder country(String country) { + this.country = country; + return this; + } + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder phoneNumberId(String phoneNumberId) { + this.phoneNumberId = phoneNumberId; + return this; + } + + public Builder externalId(String externalId) { + this.externalId = externalId; + return this; + } + + public Builder anonymousId(String anonymousId) { + this.anonymousId = anonymousId; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = firstName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = lastName; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder stateProvinceRegion(String stateProvinceRegion) { + this.stateProvinceRegion = stateProvinceRegion; + return this; + } + + public Builder customFields(ContactRequestCustomFields customFields) { + this.customFields = customFields; + return this; + } + + public ContactRequest build() { + return new ContactRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactRequest.class.getSimpleName() + "(", + ")" + ); + if (addressLine1 != null) joiner.add("addressLine1=" + addressLine1); + if (addressLine2 != null) joiner.add("addressLine2=" + addressLine2); + if (alternateEmails != null) joiner.add( + "alternateEmails=" + alternateEmails + ); + if (city != null) joiner.add("city=" + city); + if (country != null) joiner.add("country=" + country); + if (email != null) joiner.add("email=" + email); + if (phoneNumberId != null) joiner.add("phoneNumberId=" + phoneNumberId); + if (externalId != null) joiner.add("externalId=" + externalId); + if (anonymousId != null) joiner.add("anonymousId=" + anonymousId); + if (firstName != null) joiner.add("firstName=" + firstName); + if (lastName != null) joiner.add("lastName=" + lastName); + if (postalCode != null) joiner.add("postalCode=" + postalCode); + if (stateProvinceRegion != null) joiner.add( + "stateProvinceRegion=" + stateProvinceRegion + ); + if (customFields != null) joiner.add("customFields=" + customFields); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactRequestCustomFields.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactRequestCustomFields.java new file mode 100644 index 00000000..2a4e9854 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactRequestCustomFields.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactRequestCustomFields { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("w1") + @Getter + @Setter + private String w1; + + public ContactRequestCustomFields() {} + + private ContactRequestCustomFields(Builder builder) { + this.w1 = builder.w1; + } + + // Builder class for constructing object + public static class Builder { + + private String w1; + + public Builder() {} + + public Builder w1(String w1) { + this.w1 = w1; + return this; + } + + public ContactRequestCustomFields build() { + return new ContactRequestCustomFields(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactRequestCustomFields.class.getSimpleName() + "(", + ")" + ); + if (w1 != null) joiner.add("w1=" + w1); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactsError.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactsError.java new file mode 100644 index 00000000..f64d645c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ContactsError.java @@ -0,0 +1,104 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactsError { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_id") + @Getter + @Setter + private String errorId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("parameter") + @Getter + @Setter + private String parameter; + + public ContactsError() {} + + private ContactsError(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.errorId = builder.errorId; + this.parameter = builder.parameter; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private String errorId; + private String parameter; + + public Builder(String message) { + this.message = message; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder errorId(String errorId) { + this.errorId = errorId; + return this; + } + + public Builder parameter(String parameter) { + this.parameter = parameter; + return this; + } + + public ContactsError build() { + return new ContactsError(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactsError.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (errorId != null) joiner.add("errorId=" + errorId); + if (parameter != null) joiner.add("parameter=" + parameter); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/DeleteContact202Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/DeleteContact202Response.java new file mode 100644 index 00000000..8effe900 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/DeleteContact202Response.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteContact202Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("job_id") + @Getter + @Setter + private Object jobId; + + public DeleteContact202Response() {} + + private DeleteContact202Response(Builder builder) { + this.jobId = builder.jobId; + } + + // Builder class for constructing object + public static class Builder { + + private Object jobId; + + public Builder(Object jobId) { + this.jobId = jobId; + } + + public DeleteContact202Response build() { + return new DeleteContact202Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteContact202Response.class.getSimpleName() + "(", + ")" + ); + if (jobId != null) joiner.add("jobId=" + jobId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/DeleteContact400Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/DeleteContact400Response.java new file mode 100644 index 00000000..fa4742ca --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/DeleteContact400Response.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteContact400Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public DeleteContact400Response() {} + + private DeleteContact400Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder(List errors) { + this.errors = errors; + } + + public DeleteContact400Response build() { + return new DeleteContact400Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteContact400Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/DeleteContactIdentifier202Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/DeleteContactIdentifier202Response.java new file mode 100644 index 00000000..8cc5d7cd --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/DeleteContactIdentifier202Response.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteContactIdentifier202Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("job_id") + @Getter + @Setter + private Object jobId; + + public DeleteContactIdentifier202Response() {} + + private DeleteContactIdentifier202Response(Builder builder) { + this.jobId = builder.jobId; + } + + // Builder class for constructing object + public static class Builder { + + private Object jobId; + + public Builder(Object jobId) { + this.jobId = jobId; + } + + public DeleteContactIdentifier202Response build() { + return new DeleteContactIdentifier202Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteContactIdentifier202Response.class.getSimpleName() + "(", + ")" + ); + if (jobId != null) joiner.add("jobId=" + jobId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/DeleteContactIdentifierRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/DeleteContactIdentifierRequest.java new file mode 100644 index 00000000..e2f4769d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/DeleteContactIdentifierRequest.java @@ -0,0 +1,76 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteContactIdentifierRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("identifier_type") + @Getter + @Setter + private String identifierType; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("identifier_value") + @Getter + @Setter + private String identifierValue; + + public DeleteContactIdentifierRequest() {} + + private DeleteContactIdentifierRequest(Builder builder) { + this.identifierType = builder.identifierType; + this.identifierValue = builder.identifierValue; + } + + // Builder class for constructing object + public static class Builder { + + private String identifierType; + private String identifierValue; + + public Builder(String identifierType, String identifierValue) { + this.identifierType = identifierType; + this.identifierValue = identifierValue; + } + + public DeleteContactIdentifierRequest build() { + return new DeleteContactIdentifierRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteContactIdentifierRequest.class.getSimpleName() + "(", + ")" + ); + if (identifierType != null) joiner.add( + "identifierType=" + identifierType + ); + if (identifierValue != null) joiner.add( + "identifierValue=" + identifierValue + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ErrorResponse.java new file mode 100644 index 00000000..f25225d2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..b23d78f0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ExportContact202Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ExportContact202Response.java new file mode 100644 index 00000000..c561a6f2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ExportContact202Response.java @@ -0,0 +1,77 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.Metadata; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ExportContact202Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private Metadata metadata; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ExportContact202Response() {} + + private ExportContact202Response(Builder builder) { + this.metadata = builder.metadata; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private Metadata metadata; + private String id; + + public Builder(Metadata metadata) { + this.metadata = metadata; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ExportContact202Response build() { + return new ExportContact202Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ExportContact202Response.class.getSimpleName() + "(", + ")" + ); + if (metadata != null) joiner.add("metadata=" + metadata); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ExportContactRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ExportContactRequest.java new file mode 100644 index 00000000..d99ebc59 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ExportContactRequest.java @@ -0,0 +1,127 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ExportContactRequestNotifications; +import com.sendgrid.rest.api.v3.mccontacts.models.FileType; +import java.util.List; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ExportContactRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list_ids") + @Getter + @Setter + private List listIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("segment_ids") + @Getter + @Setter + private List segmentIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("notifications") + @Getter + @Setter + private ExportContactRequestNotifications notifications; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("file_type") + @Getter + @Setter + private FileType fileType; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("max_file_size") + @Getter + @Setter + private Integer maxFileSize; + + public ExportContactRequest() {} + + private ExportContactRequest(Builder builder) { + this.listIds = builder.listIds; + this.segmentIds = builder.segmentIds; + this.notifications = builder.notifications; + this.fileType = builder.fileType; + this.maxFileSize = builder.maxFileSize; + } + + // Builder class for constructing object + public static class Builder { + + private List listIds; + private List segmentIds; + private ExportContactRequestNotifications notifications; + private FileType fileType; + private Integer maxFileSize; + + public Builder() {} + + public Builder listIds(List listIds) { + this.listIds = listIds; + return this; + } + + public Builder segmentIds(List segmentIds) { + this.segmentIds = segmentIds; + return this; + } + + public Builder notifications( + ExportContactRequestNotifications notifications + ) { + this.notifications = notifications; + return this; + } + + public Builder fileType(FileType fileType) { + this.fileType = fileType; + return this; + } + + public Builder maxFileSize(Integer maxFileSize) { + this.maxFileSize = maxFileSize; + return this; + } + + public ExportContactRequest build() { + return new ExportContactRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ExportContactRequest.class.getSimpleName() + "(", + ")" + ); + if (listIds != null) joiner.add("listIds=" + listIds); + if (segmentIds != null) joiner.add("segmentIds=" + segmentIds); + if (notifications != null) joiner.add("notifications=" + notifications); + if (fileType != null) joiner.add("fileType=" + fileType); + if (maxFileSize != null) joiner.add("maxFileSize=" + maxFileSize); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ExportContactRequestNotifications.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ExportContactRequestNotifications.java new file mode 100644 index 00000000..9c0e9957 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ExportContactRequestNotifications.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ExportContactRequestNotifications { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private Boolean email; + + public ExportContactRequestNotifications() {} + + private ExportContactRequestNotifications(Builder builder) { + this.email = builder.email; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean email; + + public Builder() {} + + public Builder email(Boolean email) { + this.email = email; + return this; + } + + public ExportContactRequestNotifications build() { + return new ExportContactRequestNotifications(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ExportContactRequestNotifications.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/FileType.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/FileType.java new file mode 100644 index 00000000..f82b35b0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/FileType.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum FileType { + CSV("csv"), + + JSON("json"); + + private final String value; + + private FileType(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static FileType forValue(final String value) { + return Promoter.enumFromString(value, FileType.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/FileType1.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/FileType1.java new file mode 100644 index 00000000..c652ab31 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/FileType1.java @@ -0,0 +1,40 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum FileType1 { + CSV("csv"); + + private final String value; + + private FileType1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static FileType1 forValue(final String value) { + return Promoter.enumFromString(value, FileType1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/GetContactByIdentifiers200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/GetContactByIdentifiers200Response.java new file mode 100644 index 00000000..c80d6f11 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/GetContactByIdentifiers200Response.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetContactByIdentifiers200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private Object result; + + public GetContactByIdentifiers200Response() {} + + private GetContactByIdentifiers200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private Object result; + + public Builder() {} + + public Builder result(Object result) { + this.result = result; + return this; + } + + public GetContactByIdentifiers200Response build() { + return new GetContactByIdentifiers200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetContactByIdentifiers200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/GetContactByIdentifiers200ResponseResultValue.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/GetContactByIdentifiers200ResponseResultValue.java new file mode 100644 index 00000000..334283ca --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/GetContactByIdentifiers200ResponseResultValue.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ContactDetails3; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetContactByIdentifiers200ResponseResultValue { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("contact") + @Getter + @Setter + private ContactDetails3 contact; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error") + @Getter + @Setter + private String error; + + public GetContactByIdentifiers200ResponseResultValue() {} + + private GetContactByIdentifiers200ResponseResultValue(Builder builder) { + this.contact = builder.contact; + this.error = builder.error; + } + + // Builder class for constructing object + public static class Builder { + + private ContactDetails3 contact; + private String error; + + public Builder() {} + + public Builder contact(ContactDetails3 contact) { + this.contact = contact; + return this; + } + + public Builder error(String error) { + this.error = error; + return this; + } + + public GetContactByIdentifiers200ResponseResultValue build() { + return new GetContactByIdentifiers200ResponseResultValue(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetContactByIdentifiers200ResponseResultValue.class.getSimpleName() + + "(", + ")" + ); + if (contact != null) joiner.add("contact=" + contact); + if (error != null) joiner.add("error=" + error); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/GetContactByIdentifiersRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/GetContactByIdentifiersRequest.java new file mode 100644 index 00000000..aaafc0cc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/GetContactByIdentifiersRequest.java @@ -0,0 +1,68 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.GetContactByIdentifiersRequestIdentifiersInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetContactByIdentifiersRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("identifiers") + @Getter + @Setter + private List identifiers; + + public GetContactByIdentifiersRequest() {} + + private GetContactByIdentifiersRequest(Builder builder) { + this.identifiers = builder.identifiers; + } + + // Builder class for constructing object + public static class Builder { + + private List< + GetContactByIdentifiersRequestIdentifiersInner + > identifiers; + + public Builder( + List identifiers + ) { + this.identifiers = identifiers; + } + + public GetContactByIdentifiersRequest build() { + return new GetContactByIdentifiersRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetContactByIdentifiersRequest.class.getSimpleName() + "(", + ")" + ); + if (identifiers != null) joiner.add("identifiers=" + identifiers); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/GetContactByIdentifiersRequestIdentifiersInner.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/GetContactByIdentifiersRequestIdentifiersInner.java new file mode 100644 index 00000000..4d225064 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/GetContactByIdentifiersRequestIdentifiersInner.java @@ -0,0 +1,108 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetContactByIdentifiersRequestIdentifiersInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("phone_number_id") + @Getter + @Setter + private String phoneNumberId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("external_id") + @Getter + @Setter + private String externalId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("anonymous_id") + @Getter + @Setter + private String anonymousId; + + public GetContactByIdentifiersRequestIdentifiersInner() {} + + private GetContactByIdentifiersRequestIdentifiersInner(Builder builder) { + this.email = builder.email; + this.phoneNumberId = builder.phoneNumberId; + this.externalId = builder.externalId; + this.anonymousId = builder.anonymousId; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + private String phoneNumberId; + private String externalId; + private String anonymousId; + + public Builder() {} + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder phoneNumberId(String phoneNumberId) { + this.phoneNumberId = phoneNumberId; + return this; + } + + public Builder externalId(String externalId) { + this.externalId = externalId; + return this; + } + + public Builder anonymousId(String anonymousId) { + this.anonymousId = anonymousId; + return this; + } + + public GetContactByIdentifiersRequestIdentifiersInner build() { + return new GetContactByIdentifiersRequestIdentifiersInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetContactByIdentifiersRequestIdentifiersInner.class.getSimpleName() + + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + if (phoneNumberId != null) joiner.add("phoneNumberId=" + phoneNumberId); + if (externalId != null) joiner.add("externalId=" + externalId); + if (anonymousId != null) joiner.add("anonymousId=" + anonymousId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/GetImportContact400Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/GetImportContact400Response.java new file mode 100644 index 00000000..d10e96aa --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/GetImportContact400Response.java @@ -0,0 +1,66 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ContactsError; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetImportContact400Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private ContactsError errors; + + public GetImportContact400Response() {} + + private GetImportContact400Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private ContactsError errors; + + public Builder() {} + + public Builder errors(ContactsError errors) { + this.errors = errors; + return this; + } + + public GetImportContact400Response build() { + return new GetImportContact400Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetImportContact400Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/IdentifierType.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/IdentifierType.java new file mode 100644 index 00000000..6dd53ab2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/IdentifierType.java @@ -0,0 +1,46 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum IdentifierType { + EMAIL("email"), + + PHONE_NUMBER_ID("phone_number_id"), + + EXTERNAL_ID("external_id"), + + ANONYMOUS_ID("anonymous_id"); + + private final String value; + + private IdentifierType(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static IdentifierType forValue(final String value) { + return Promoter.enumFromString(value, IdentifierType.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ImportContact200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ImportContact200Response.java new file mode 100644 index 00000000..d254e87a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ImportContact200Response.java @@ -0,0 +1,97 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ImportContact200ResponseUploadHeadersInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ImportContact200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("job_id") + @Getter + @Setter + private String jobId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("upload_uri") + @Getter + @Setter + private String uploadUri; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("upload_headers") + @Getter + @Setter + private List uploadHeaders; + + public ImportContact200Response() {} + + private ImportContact200Response(Builder builder) { + this.jobId = builder.jobId; + this.uploadUri = builder.uploadUri; + this.uploadHeaders = builder.uploadHeaders; + } + + // Builder class for constructing object + public static class Builder { + + private String jobId; + private String uploadUri; + private List uploadHeaders; + + public Builder() {} + + public Builder jobId(String jobId) { + this.jobId = jobId; + return this; + } + + public Builder uploadUri(String uploadUri) { + this.uploadUri = uploadUri; + return this; + } + + public Builder uploadHeaders( + List uploadHeaders + ) { + this.uploadHeaders = uploadHeaders; + return this; + } + + public ImportContact200Response build() { + return new ImportContact200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ImportContact200Response.class.getSimpleName() + "(", + ")" + ); + if (jobId != null) joiner.add("jobId=" + jobId); + if (uploadUri != null) joiner.add("uploadUri=" + uploadUri); + if (uploadHeaders != null) joiner.add("uploadHeaders=" + uploadHeaders); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ImportContact200ResponseUploadHeadersInner.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ImportContact200ResponseUploadHeadersInner.java new file mode 100644 index 00000000..56562254 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ImportContact200ResponseUploadHeadersInner.java @@ -0,0 +1,73 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ImportContact200ResponseUploadHeadersInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("header") + @Getter + @Setter + private String header; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("value") + @Getter + @Setter + private String value; + + public ImportContact200ResponseUploadHeadersInner() {} + + private ImportContact200ResponseUploadHeadersInner(Builder builder) { + this.header = builder.header; + this.value = builder.value; + } + + // Builder class for constructing object + public static class Builder { + + private String header; + private String value; + + public Builder(String header, String value) { + this.header = header; + this.value = value; + } + + public ImportContact200ResponseUploadHeadersInner build() { + return new ImportContact200ResponseUploadHeadersInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ImportContact200ResponseUploadHeadersInner.class.getSimpleName() + + "(", + ")" + ); + if (header != null) joiner.add("header=" + header); + if (value != null) joiner.add("value=" + value); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ImportContact400Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ImportContact400Response.java new file mode 100644 index 00000000..b090f527 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ImportContact400Response.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ContactsError; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ImportContact400Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ImportContact400Response() {} + + private ImportContact400Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder(List errors) { + this.errors = errors; + } + + public ImportContact400Response build() { + return new ImportContact400Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ImportContact400Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ImportContact404Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ImportContact404Response.java new file mode 100644 index 00000000..9d2c68f0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ImportContact404Response.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ContactsError; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ImportContact404Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ImportContact404Response() {} + + private ImportContact404Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder(List errors) { + this.errors = errors; + } + + public ImportContact404Response build() { + return new ImportContact404Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ImportContact404Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ImportContactRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ImportContactRequest.java new file mode 100644 index 00000000..f93925d1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ImportContactRequest.java @@ -0,0 +1,88 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.FileType1; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ImportContactRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list_ids") + @Getter + @Setter + private List listIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("file_type") + @Getter + @Setter + private FileType1 fileType; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field_mappings") + @Getter + @Setter + private List fieldMappings; + + public ImportContactRequest() {} + + private ImportContactRequest(Builder builder) { + this.listIds = builder.listIds; + this.fileType = builder.fileType; + this.fieldMappings = builder.fieldMappings; + } + + // Builder class for constructing object + public static class Builder { + + private List listIds; + private FileType1 fileType; + private List fieldMappings; + + public Builder(FileType1 fileType, List fieldMappings) { + this.fileType = fileType; + this.fieldMappings = fieldMappings; + } + + public Builder listIds(List listIds) { + this.listIds = listIds; + return this; + } + + public ImportContactRequest build() { + return new ImportContactRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ImportContactRequest.class.getSimpleName() + "(", + ")" + ); + if (listIds != null) joiner.add("listIds=" + listIds); + if (fileType != null) joiner.add("fileType=" + fileType); + if (fieldMappings != null) joiner.add("fieldMappings=" + fieldMappings); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListBatchedContact200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListBatchedContact200Response.java new file mode 100644 index 00000000..9dbb025f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListBatchedContact200Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ContactDetails3; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListBatchedContact200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + public ListBatchedContact200Response() {} + + private ListBatchedContact200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + + public Builder() {} + + public Builder result(List result) { + this.result = result; + return this; + } + + public ListBatchedContact200Response build() { + return new ListBatchedContact200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListBatchedContact200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListBatchedContactRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListBatchedContactRequest.java new file mode 100644 index 00000000..9d0c1a72 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListBatchedContactRequest.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListBatchedContactRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ids") + @Getter + @Setter + private List ids; + + public ListBatchedContactRequest() {} + + private ListBatchedContactRequest(Builder builder) { + this.ids = builder.ids; + } + + // Builder class for constructing object + public static class Builder { + + private List ids; + + public Builder(List ids) { + this.ids = ids; + } + + public ListBatchedContactRequest build() { + return new ListBatchedContactRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListBatchedContactRequest.class.getSimpleName() + "(", + ")" + ); + if (ids != null) joiner.add("ids=" + ids); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContact200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContact200Response.java new file mode 100644 index 00000000..d775e1e3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContact200Response.java @@ -0,0 +1,96 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ContactDetails3; +import com.sendgrid.rest.api.v3.mccontacts.models.SelfMetadata; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListContact200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private SelfMetadata metadata; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("contact_count") + @Getter + @Setter + private Integer contactCount; + + public ListContact200Response() {} + + private ListContact200Response(Builder builder) { + this.result = builder.result; + this.metadata = builder.metadata; + this.contactCount = builder.contactCount; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + private SelfMetadata metadata; + private Integer contactCount; + + public Builder() {} + + public Builder result(List result) { + this.result = result; + return this; + } + + public Builder metadata(SelfMetadata metadata) { + this.metadata = metadata; + return this; + } + + public Builder contactCount(Integer contactCount) { + this.contactCount = contactCount; + return this; + } + + public ListContact200Response build() { + return new ListContact200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListContact200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + if (metadata != null) joiner.add("metadata=" + metadata); + if (contactCount != null) joiner.add("contactCount=" + contactCount); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContact400Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContact400Response.java new file mode 100644 index 00000000..b65c0989 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContact400Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ContactsError; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListContact400Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ListContact400Response() {} + + private ListContact400Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public ListContact400Response build() { + return new ListContact400Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListContact400Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContactByEmail200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContactByEmail200Response.java new file mode 100644 index 00000000..6ef71681 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContactByEmail200Response.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListContactByEmail200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private Object result; + + public ListContactByEmail200Response() {} + + private ListContactByEmail200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private Object result; + + public Builder() {} + + public Builder result(Object result) { + this.result = result; + return this; + } + + public ListContactByEmail200Response build() { + return new ListContactByEmail200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListContactByEmail200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContactByEmailRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContactByEmailRequest.java new file mode 100644 index 00000000..1b1e2674 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContactByEmailRequest.java @@ -0,0 +1,105 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListContactByEmailRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("emails") + @Getter + @Setter + private List emails; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("phone_number_id") + @Getter + @Setter + private String phoneNumberId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("external_id") + @Getter + @Setter + private String externalId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("anonymous_id") + @Getter + @Setter + private String anonymousId; + + public ListContactByEmailRequest() {} + + private ListContactByEmailRequest(Builder builder) { + this.emails = builder.emails; + this.phoneNumberId = builder.phoneNumberId; + this.externalId = builder.externalId; + this.anonymousId = builder.anonymousId; + } + + // Builder class for constructing object + public static class Builder { + + private List emails; + private String phoneNumberId; + private String externalId; + private String anonymousId; + + public Builder(List emails) { + this.emails = emails; + } + + public Builder phoneNumberId(String phoneNumberId) { + this.phoneNumberId = phoneNumberId; + return this; + } + + public Builder externalId(String externalId) { + this.externalId = externalId; + return this; + } + + public Builder anonymousId(String anonymousId) { + this.anonymousId = anonymousId; + return this; + } + + public ListContactByEmailRequest build() { + return new ListContactByEmailRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListContactByEmailRequest.class.getSimpleName() + "(", + ")" + ); + if (emails != null) joiner.add("emails=" + emails); + if (phoneNumberId != null) joiner.add("phoneNumberId=" + phoneNumberId); + if (externalId != null) joiner.add("externalId=" + externalId); + if (anonymousId != null) joiner.add("anonymousId=" + anonymousId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContactCount200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContactCount200Response.java new file mode 100644 index 00000000..9097b12c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContactCount200Response.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ListContactCount200ResponseBillableBreakdown; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListContactCount200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("contact_count") + @Getter + @Setter + private Integer contactCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("billable_count") + @Getter + @Setter + private Integer billableCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("billable_breakdown") + @Getter + @Setter + private ListContactCount200ResponseBillableBreakdown billableBreakdown; + + public ListContactCount200Response() {} + + private ListContactCount200Response(Builder builder) { + this.contactCount = builder.contactCount; + this.billableCount = builder.billableCount; + this.billableBreakdown = builder.billableBreakdown; + } + + // Builder class for constructing object + public static class Builder { + + private Integer contactCount; + private Integer billableCount; + private ListContactCount200ResponseBillableBreakdown billableBreakdown; + + public Builder(Integer contactCount) { + this.contactCount = contactCount; + } + + public Builder billableCount(Integer billableCount) { + this.billableCount = billableCount; + return this; + } + + public Builder billableBreakdown( + ListContactCount200ResponseBillableBreakdown billableBreakdown + ) { + this.billableBreakdown = billableBreakdown; + return this; + } + + public ListContactCount200Response build() { + return new ListContactCount200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListContactCount200Response.class.getSimpleName() + "(", + ")" + ); + if (contactCount != null) joiner.add("contactCount=" + contactCount); + if (billableCount != null) joiner.add("billableCount=" + billableCount); + if (billableBreakdown != null) joiner.add( + "billableBreakdown=" + billableBreakdown + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContactCount200ResponseBillableBreakdown.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContactCount200ResponseBillableBreakdown.java new file mode 100644 index 00000000..64dab35c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListContactCount200ResponseBillableBreakdown.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListContactCount200ResponseBillableBreakdown { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("total") + @Getter + @Setter + private Integer total; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("breakdown") + @Getter + @Setter + private Object breakdown; + + public ListContactCount200ResponseBillableBreakdown() {} + + private ListContactCount200ResponseBillableBreakdown(Builder builder) { + this.total = builder.total; + this.breakdown = builder.breakdown; + } + + // Builder class for constructing object + public static class Builder { + + private Integer total; + private Object breakdown; + + public Builder() {} + + public Builder total(Integer total) { + this.total = total; + return this; + } + + public Builder breakdown(Object breakdown) { + this.breakdown = breakdown; + return this; + } + + public ListContactCount200ResponseBillableBreakdown build() { + return new ListContactCount200ResponseBillableBreakdown(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListContactCount200ResponseBillableBreakdown.class.getSimpleName() + + "(", + ")" + ); + if (total != null) joiner.add("total=" + total); + if (breakdown != null) joiner.add("breakdown=" + breakdown); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact200Response.java new file mode 100644 index 00000000..400ebbc2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact200Response.java @@ -0,0 +1,84 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ListExportContact200ResponseMetadata; +import com.sendgrid.rest.api.v3.mccontacts.models.ListExportContact200ResponseResultInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListExportContact200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private ListExportContact200ResponseMetadata metadata; + + public ListExportContact200Response() {} + + private ListExportContact200Response(Builder builder) { + this.result = builder.result; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + private ListExportContact200ResponseMetadata metadata; + + public Builder() {} + + public Builder result( + List result + ) { + this.result = result; + return this; + } + + public Builder metadata(ListExportContact200ResponseMetadata metadata) { + this.metadata = metadata; + return this; + } + + public ListExportContact200Response build() { + return new ListExportContact200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListExportContact200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact200ResponseMetadata.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact200ResponseMetadata.java new file mode 100644 index 00000000..499636d2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact200ResponseMetadata.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListExportContact200ResponseMetadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("prev") + @Getter + @Setter + private String prev; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("self") + @Getter + @Setter + private String self; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next") + @Getter + @Setter + private String next; + + public ListExportContact200ResponseMetadata() {} + + private ListExportContact200ResponseMetadata(Builder builder) { + this.prev = builder.prev; + this.self = builder.self; + this.next = builder.next; + } + + // Builder class for constructing object + public static class Builder { + + private String prev; + private String self; + private String next; + + public Builder() {} + + public Builder prev(String prev) { + this.prev = prev; + return this; + } + + public Builder self(String self) { + this.self = self; + return this; + } + + public Builder next(String next) { + this.next = next; + return this; + } + + public ListExportContact200ResponseMetadata build() { + return new ListExportContact200ResponseMetadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListExportContact200ResponseMetadata.class.getSimpleName() + "(", + ")" + ); + if (prev != null) joiner.add("prev=" + prev); + if (self != null) joiner.add("self=" + self); + if (next != null) joiner.add("next=" + next); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact200ResponseResultInner.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact200ResponseResultInner.java new file mode 100644 index 00000000..0f7239fb --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact200ResponseResultInner.java @@ -0,0 +1,218 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ListExportContact200ResponseResultInnerMetadata; +import com.sendgrid.rest.api.v3.mccontacts.models.ListExportContact200ResponseResultInnerSegmentsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListExportContact200ResponseResultInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private String status; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private String createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("completed_at") + @Getter + @Setter + private String completedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("expires_at") + @Getter + @Setter + private String expiresAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("urls") + @Getter + @Setter + private List urls; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("user_id") + @Getter + @Setter + private String userId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("export_type") + @Getter + @Setter + private String exportType; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("segments") + @Getter + @Setter + private List segments; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("lists") + @Getter + @Setter + private List lists; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private ListExportContact200ResponseResultInnerMetadata metadata; + + public ListExportContact200ResponseResultInner() {} + + private ListExportContact200ResponseResultInner(Builder builder) { + this.id = builder.id; + this.status = builder.status; + this.createdAt = builder.createdAt; + this.completedAt = builder.completedAt; + this.expiresAt = builder.expiresAt; + this.urls = builder.urls; + this.userId = builder.userId; + this.exportType = builder.exportType; + this.segments = builder.segments; + this.lists = builder.lists; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private String id; + private String status; + private String createdAt; + private String completedAt; + private String expiresAt; + private List urls; + private String userId; + private String exportType; + private List< + ListExportContact200ResponseResultInnerSegmentsInner + > segments; + private List< + ListExportContact200ResponseResultInnerSegmentsInner + > lists; + private ListExportContact200ResponseResultInnerMetadata metadata; + + public Builder() {} + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder status(String status) { + this.status = status; + return this; + } + + public Builder createdAt(String createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder completedAt(String completedAt) { + this.completedAt = completedAt; + return this; + } + + public Builder expiresAt(String expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + public Builder urls(List urls) { + this.urls = urls; + return this; + } + + public Builder userId(String userId) { + this.userId = userId; + return this; + } + + public Builder exportType(String exportType) { + this.exportType = exportType; + return this; + } + + public Builder segments( + List segments + ) { + this.segments = segments; + return this; + } + + public Builder lists( + List lists + ) { + this.lists = lists; + return this; + } + + public Builder metadata( + ListExportContact200ResponseResultInnerMetadata metadata + ) { + this.metadata = metadata; + return this; + } + + public ListExportContact200ResponseResultInner build() { + return new ListExportContact200ResponseResultInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListExportContact200ResponseResultInner.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (status != null) joiner.add("status=" + status); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (completedAt != null) joiner.add("completedAt=" + completedAt); + if (expiresAt != null) joiner.add("expiresAt=" + expiresAt); + if (urls != null) joiner.add("urls=" + urls); + if (userId != null) joiner.add("userId=" + userId); + if (exportType != null) joiner.add("exportType=" + exportType); + if (segments != null) joiner.add("segments=" + segments); + if (lists != null) joiner.add("lists=" + lists); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact200ResponseResultInnerMetadata.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact200ResponseResultInnerMetadata.java new file mode 100644 index 00000000..52d25af1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact200ResponseResultInnerMetadata.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListExportContact200ResponseResultInnerMetadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("prev") + @Getter + @Setter + private String prev; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("self") + @Getter + @Setter + private String self; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next") + @Getter + @Setter + private String next; + + public ListExportContact200ResponseResultInnerMetadata() {} + + private ListExportContact200ResponseResultInnerMetadata(Builder builder) { + this.prev = builder.prev; + this.self = builder.self; + this.next = builder.next; + } + + // Builder class for constructing object + public static class Builder { + + private String prev; + private String self; + private String next; + + public Builder() {} + + public Builder prev(String prev) { + this.prev = prev; + return this; + } + + public Builder self(String self) { + this.self = self; + return this; + } + + public Builder next(String next) { + this.next = next; + return this; + } + + public ListExportContact200ResponseResultInnerMetadata build() { + return new ListExportContact200ResponseResultInnerMetadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListExportContact200ResponseResultInnerMetadata.class.getSimpleName() + + "(", + ")" + ); + if (prev != null) joiner.add("prev=" + prev); + if (self != null) joiner.add("self=" + self); + if (next != null) joiner.add("next=" + next); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact200ResponseResultInnerSegmentsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact200ResponseResultInnerSegmentsInner.java new file mode 100644 index 00000000..d86a49f8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact200ResponseResultInnerSegmentsInner.java @@ -0,0 +1,84 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListExportContact200ResponseResultInnerSegmentsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ID") + @Getter + @Setter + private String ID; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("Name") + @Getter + @Setter + private String name; + + public ListExportContact200ResponseResultInnerSegmentsInner() {} + + private ListExportContact200ResponseResultInnerSegmentsInner( + Builder builder + ) { + this.ID = builder.ID; + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String ID; + private String name; + + public Builder() {} + + public Builder ID(String ID) { + this.ID = ID; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public ListExportContact200ResponseResultInnerSegmentsInner build() { + return new ListExportContact200ResponseResultInnerSegmentsInner( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListExportContact200ResponseResultInnerSegmentsInner.class.getSimpleName() + + "(", + ")" + ); + if (ID != null) joiner.add("ID=" + ID); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact400Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact400Response.java new file mode 100644 index 00000000..c7de30e1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact400Response.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ListExportContact400ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListExportContact400Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ListExportContact400Response() {} + + private ListExportContact400Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors( + List errors + ) { + this.errors = errors; + return this; + } + + public ListExportContact400Response build() { + return new ListExportContact400Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListExportContact400Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact400ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact400ResponseErrorsInner.java new file mode 100644 index 00000000..f0685e7e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/ListExportContact400ResponseErrorsInner.java @@ -0,0 +1,76 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListExportContact400ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_id") + @Getter + @Setter + private String errorId; + + public ListExportContact400ResponseErrorsInner() {} + + private ListExportContact400ResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.errorId = builder.errorId; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String errorId; + + public Builder(String message) { + this.message = message; + } + + public Builder errorId(String errorId) { + this.errorId = errorId; + return this; + } + + public ListExportContact400ResponseErrorsInner build() { + return new ListExportContact400ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListExportContact400ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (errorId != null) joiner.add("errorId=" + errorId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/Metadata.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/Metadata.java new file mode 100644 index 00000000..a6ec11a0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/Metadata.java @@ -0,0 +1,109 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.net.URI; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Metadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("prev") + @Getter + @Setter + private URI prev; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("self") + @Getter + @Setter + private URI self; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next") + @Getter + @Setter + private URI next; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("count") + @Getter + @Setter + private BigDecimal count; + + public Metadata() {} + + private Metadata(Builder builder) { + this.prev = builder.prev; + this.self = builder.self; + this.next = builder.next; + this.count = builder.count; + } + + // Builder class for constructing object + public static class Builder { + + private URI prev; + private URI self; + private URI next; + private BigDecimal count; + + public Builder() {} + + public Builder prev(URI prev) { + this.prev = prev; + return this; + } + + public Builder self(URI self) { + this.self = self; + return this; + } + + public Builder next(URI next) { + this.next = next; + return this; + } + + public Builder count(BigDecimal count) { + this.count = count; + return this; + } + + public Metadata build() { + return new Metadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Metadata.class.getSimpleName() + "(", + ")" + ); + if (prev != null) joiner.add("prev=" + prev); + if (self != null) joiner.add("self=" + self); + if (next != null) joiner.add("next=" + next); + if (count != null) joiner.add("count=" + count); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContact200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContact200Response.java new file mode 100644 index 00000000..db7d169d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContact200Response.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ContactDetails3; +import com.sendgrid.rest.api.v3.mccontacts.models.SelfMetadata; +import java.math.BigDecimal; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SearchContact200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private SelfMetadata metadata; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("contact_count") + @Getter + @Setter + private BigDecimal contactCount; + + public SearchContact200Response() {} + + private SearchContact200Response(Builder builder) { + this.result = builder.result; + this.metadata = builder.metadata; + this.contactCount = builder.contactCount; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + private SelfMetadata metadata; + private BigDecimal contactCount; + + public Builder(BigDecimal contactCount) { + this.contactCount = contactCount; + } + + public Builder result(List result) { + this.result = result; + return this; + } + + public Builder metadata(SelfMetadata metadata) { + this.metadata = metadata; + return this; + } + + public SearchContact200Response build() { + return new SearchContact200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SearchContact200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + if (metadata != null) joiner.add("metadata=" + metadata); + if (contactCount != null) joiner.add("contactCount=" + contactCount); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContact400Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContact400Response.java new file mode 100644 index 00000000..78fc238b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContact400Response.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact400ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SearchContact400Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public SearchContact400Response() {} + + private SearchContact400Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors( + List errors + ) { + this.errors = errors; + return this; + } + + public SearchContact400Response build() { + return new SearchContact400Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SearchContact400Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContact400ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContact400ResponseErrorsInner.java new file mode 100644 index 00000000..f0d7f7c3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContact400ResponseErrorsInner.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SearchContact400ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public SearchContact400ResponseErrorsInner() {} + + private SearchContact400ResponseErrorsInner(Builder builder) { + this.field = builder.field; + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String field; + private String message; + + public Builder() {} + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public SearchContact400ResponseErrorsInner build() { + return new SearchContact400ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SearchContact400ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (field != null) joiner.add("field=" + field); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContact500Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContact500Response.java new file mode 100644 index 00000000..06a30497 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContact500Response.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.SearchContact500ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SearchContact500Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public SearchContact500Response() {} + + private SearchContact500Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors( + List errors + ) { + this.errors = errors; + return this; + } + + public SearchContact500Response build() { + return new SearchContact500Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SearchContact500Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContact500ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContact500ResponseErrorsInner.java new file mode 100644 index 00000000..e5724ff9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContact500ResponseErrorsInner.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SearchContact500ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public SearchContact500ResponseErrorsInner() {} + + private SearchContact500ResponseErrorsInner(Builder builder) { + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public SearchContact500ResponseErrorsInner build() { + return new SearchContact500ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SearchContact500ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContactRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContactRequest.java new file mode 100644 index 00000000..7483ecc4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SearchContactRequest.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SearchContactRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("query") + @Getter + @Setter + private String query; + + public SearchContactRequest() {} + + private SearchContactRequest(Builder builder) { + this.query = builder.query; + } + + // Builder class for constructing object + public static class Builder { + + private String query; + + public Builder(String query) { + this.query = query; + } + + public SearchContactRequest build() { + return new SearchContactRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SearchContactRequest.class.getSimpleName() + "(", + ")" + ); + if (query != null) joiner.add("query=" + query); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SelfMetadata.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SelfMetadata.java new file mode 100644 index 00000000..ea7b6a3a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/SelfMetadata.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SelfMetadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("self") + @Getter + @Setter + private String self; + + public SelfMetadata() {} + + private SelfMetadata(Builder builder) { + this.self = builder.self; + } + + // Builder class for constructing object + public static class Builder { + + private String self; + + public Builder() {} + + public Builder self(String self) { + this.self = self; + return this; + } + + public SelfMetadata build() { + return new SelfMetadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SelfMetadata.class.getSimpleName() + "(", + ")" + ); + if (self != null) joiner.add("self=" + self); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/Status.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/Status.java new file mode 100644 index 00000000..a084034b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/Status.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Status { + PENDING("pending"), + + READY("ready"), + + FAILURE("failure"); + + private final String value; + + private Status(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Status forValue(final String value) { + return Promoter.enumFromString(value, Status.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/UpdateContact202Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/UpdateContact202Response.java new file mode 100644 index 00000000..8d82ce2f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/UpdateContact202Response.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateContact202Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("job_id") + @Getter + @Setter + private String jobId; + + public UpdateContact202Response() {} + + private UpdateContact202Response(Builder builder) { + this.jobId = builder.jobId; + } + + // Builder class for constructing object + public static class Builder { + + private String jobId; + + public Builder() {} + + public Builder jobId(String jobId) { + this.jobId = jobId; + return this; + } + + public UpdateContact202Response build() { + return new UpdateContact202Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateContact202Response.class.getSimpleName() + "(", + ")" + ); + if (jobId != null) joiner.add("jobId=" + jobId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/UpdateContactRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/UpdateContactRequest.java new file mode 100644 index 00000000..baffc242 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccontacts/models/UpdateContactRequest.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Contacts API + * The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + * + * 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.mccontacts.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccontacts.models.ContactRequest; +import java.util.List; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateContactRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list_ids") + @Getter + @Setter + private List listIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("contacts") + @Getter + @Setter + private List contacts; + + public UpdateContactRequest() {} + + private UpdateContactRequest(Builder builder) { + this.listIds = builder.listIds; + this.contacts = builder.contacts; + } + + // Builder class for constructing object + public static class Builder { + + private List listIds; + private List contacts; + + public Builder(List contacts) { + this.contacts = contacts; + } + + public Builder listIds(List listIds) { + this.listIds = listIds; + return this; + } + + public UpdateContactRequest build() { + return new UpdateContactRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateContactRequest.class.getSimpleName() + "(", + ")" + ); + if (listIds != null) joiner.add("listIds=" + listIds); + if (contacts != null) joiner.add("contacts=" + contacts); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/CreateFieldDefinition.java b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/CreateFieldDefinition.java new file mode 100644 index 00000000..4dc6271d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/CreateFieldDefinition.java @@ -0,0 +1,101 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Custom Fields API + * The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + * + * 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.mccustomfields; + +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.mccustomfields.models.CreateFieldDefinition200Response; +import com.sendgrid.rest.api.v3.mccustomfields.models.CreateFieldDefinition400Response; +import com.sendgrid.rest.api.v3.mccustomfields.models.CreateFieldDefinitionRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateFieldDefinition extends ApiKeyBase { + + @Setter + private CreateFieldDefinitionRequest createFieldDefinitionRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/field_definitions"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "CreateFieldDefinition 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")) { + CreateFieldDefinition400Response error = JsonUtil.fromJson( + response.getStream(), + CreateFieldDefinition400Response.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(), + CreateFieldDefinition200Response.class + ), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (createFieldDefinitionRequest != null) { + request.addBody(JsonUtil.toJson(createFieldDefinitionRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/DeleteFieldDefinition.java b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/DeleteFieldDefinition.java new file mode 100644 index 00000000..b9059863 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/DeleteFieldDefinition.java @@ -0,0 +1,88 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Custom Fields API + * The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + * + * 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.mccustomfields; + +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.mccustomfields.models.CreateFieldDefinition400Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DeleteFieldDefinition extends ApiKeyBase { + + private final String customFieldId; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/field_definitions/{custom_field_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteFieldDefinition creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + CreateFieldDefinition400Response error = JsonUtil.fromJson( + response.getStream(), + CreateFieldDefinition400Response.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 (customFieldId != null) { + request.addPathParam("custom_field_id", customFieldId.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/ListFieldDefinition.java b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/ListFieldDefinition.java new file mode 100644 index 00000000..4e55cc9a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/ListFieldDefinition.java @@ -0,0 +1,74 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Custom Fields API + * The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + * + * 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.mccustomfields; + +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.mccustomfields.models.ListFieldDefinition200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListFieldDefinition extends ApiKeyBase { + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/field_definitions"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListFieldDefinition creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + ListFieldDefinition200Response.class + ), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/UpdateFieldDefinition.java b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/UpdateFieldDefinition.java new file mode 100644 index 00000000..93d5f34d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/UpdateFieldDefinition.java @@ -0,0 +1,123 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Custom Fields API + * The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + * + * 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.mccustomfields; + +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.mccustomfields.models.CreateFieldDefinition200Response; +import com.sendgrid.rest.api.v3.mccustomfields.models.CreateFieldDefinition400Response; +import com.sendgrid.rest.api.v3.mccustomfields.models.UpdateFieldDefinitionRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateFieldDefinition extends ApiKeyBase { + + private final String customFieldId; + + @Setter + private UpdateFieldDefinitionRequest updateFieldDefinitionRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/field_definitions/{custom_field_id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateFieldDefinition 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")) { + CreateFieldDefinition400Response error = JsonUtil.fromJson( + response.getStream(), + CreateFieldDefinition400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + CreateFieldDefinition400Response error = JsonUtil.fromJson( + response.getStream(), + CreateFieldDefinition400Response.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(), + CreateFieldDefinition200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (customFieldId != null) { + request.addPathParam("custom_field_id", customFieldId.toString()); + } + } + + private void addBody(final Request request) { + if (updateFieldDefinitionRequest != null) { + request.addBody(JsonUtil.toJson(updateFieldDefinitionRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/CreateFieldDefinition200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/CreateFieldDefinition200Response.java new file mode 100644 index 00000000..90c4a7e8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/CreateFieldDefinition200Response.java @@ -0,0 +1,98 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Custom Fields API + * The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + * + * 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.mccustomfields.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccustomfields.models.FieldType2; +import com.sendgrid.rest.api.v3.mccustomfields.models.Metadata; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateFieldDefinition200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field_type") + @Getter + @Setter + private FieldType2 fieldType; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private Metadata metadata; + + public CreateFieldDefinition200Response() {} + + private CreateFieldDefinition200Response(Builder builder) { + this.id = builder.id; + this.name = builder.name; + this.fieldType = builder.fieldType; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private String id; + private String name; + private FieldType2 fieldType; + private Metadata metadata; + + public Builder(String id, String name, FieldType2 fieldType) { + this.id = id; + this.name = name; + this.fieldType = fieldType; + } + + public Builder metadata(Metadata metadata) { + this.metadata = metadata; + return this; + } + + public CreateFieldDefinition200Response build() { + return new CreateFieldDefinition200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateFieldDefinition200Response.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (name != null) joiner.add("name=" + name); + if (fieldType != null) joiner.add("fieldType=" + fieldType); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/CreateFieldDefinition400Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/CreateFieldDefinition400Response.java new file mode 100644 index 00000000..9ec81014 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/CreateFieldDefinition400Response.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Custom Fields API + * The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + * + * 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.mccustomfields.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccustomfields.models.CustomFieldsError; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateFieldDefinition400Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public CreateFieldDefinition400Response() {} + + private CreateFieldDefinition400Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder(List errors) { + this.errors = errors; + } + + public CreateFieldDefinition400Response build() { + return new CreateFieldDefinition400Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateFieldDefinition400Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/CreateFieldDefinitionRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/CreateFieldDefinitionRequest.java new file mode 100644 index 00000000..7859b743 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/CreateFieldDefinitionRequest.java @@ -0,0 +1,73 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Custom Fields API + * The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + * + * 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.mccustomfields.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccustomfields.models.FieldType; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateFieldDefinitionRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field_type") + @Getter + @Setter + private FieldType fieldType; + + public CreateFieldDefinitionRequest() {} + + private CreateFieldDefinitionRequest(Builder builder) { + this.name = builder.name; + this.fieldType = builder.fieldType; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private FieldType fieldType; + + public Builder(String name, FieldType fieldType) { + this.name = name; + this.fieldType = fieldType; + } + + public CreateFieldDefinitionRequest build() { + return new CreateFieldDefinitionRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateFieldDefinitionRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (fieldType != null) joiner.add("fieldType=" + fieldType); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/CustomFieldDefinitionsResponse.java b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/CustomFieldDefinitionsResponse.java new file mode 100644 index 00000000..4b9dad09 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/CustomFieldDefinitionsResponse.java @@ -0,0 +1,83 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Custom Fields API + * The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + * + * 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.mccustomfields.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccustomfields.models.FieldType2; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CustomFieldDefinitionsResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field_type") + @Getter + @Setter + private FieldType2 fieldType; + + public CustomFieldDefinitionsResponse() {} + + private CustomFieldDefinitionsResponse(Builder builder) { + this.id = builder.id; + this.name = builder.name; + this.fieldType = builder.fieldType; + } + + // Builder class for constructing object + public static class Builder { + + private String id; + private String name; + private FieldType2 fieldType; + + public Builder(String id, String name, FieldType2 fieldType) { + this.id = id; + this.name = name; + this.fieldType = fieldType; + } + + public CustomFieldDefinitionsResponse build() { + return new CustomFieldDefinitionsResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CustomFieldDefinitionsResponse.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (name != null) joiner.add("name=" + name); + if (fieldType != null) joiner.add("fieldType=" + fieldType); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/CustomFieldsError.java b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/CustomFieldsError.java new file mode 100644 index 00000000..9b9dd261 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/CustomFieldsError.java @@ -0,0 +1,104 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Custom Fields API + * The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + * + * 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.mccustomfields.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CustomFieldsError { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_id") + @Getter + @Setter + private String errorId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("parameter") + @Getter + @Setter + private String parameter; + + public CustomFieldsError() {} + + private CustomFieldsError(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.errorId = builder.errorId; + this.parameter = builder.parameter; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private String errorId; + private String parameter; + + public Builder(String message) { + this.message = message; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder errorId(String errorId) { + this.errorId = errorId; + return this; + } + + public Builder parameter(String parameter) { + this.parameter = parameter; + return this; + } + + public CustomFieldsError build() { + return new CustomFieldsError(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CustomFieldsError.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (errorId != null) joiner.add("errorId=" + errorId); + if (parameter != null) joiner.add("parameter=" + parameter); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/FieldType.java b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/FieldType.java new file mode 100644 index 00000000..91530c98 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/FieldType.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Custom Fields API + * The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + * + * 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.mccustomfields.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum FieldType { + TEXT("Text"), + + NUMBER("Number"), + + DATE("Date"); + + private final String value; + + private FieldType(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static FieldType forValue(final String value) { + return Promoter.enumFromString(value, FieldType.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/FieldType1.java b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/FieldType1.java new file mode 100644 index 00000000..696f5290 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/FieldType1.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Custom Fields API + * The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + * + * 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.mccustomfields.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum FieldType1 { + TEXT("Text"), + + NUMBER("Number"), + + DATE("Date"); + + private final String value; + + private FieldType1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static FieldType1 forValue(final String value) { + return Promoter.enumFromString(value, FieldType1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/FieldType2.java b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/FieldType2.java new file mode 100644 index 00000000..6d3603ff --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/FieldType2.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Custom Fields API + * The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + * + * 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.mccustomfields.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum FieldType2 { + TEXT("Text"), + + NUMBER("Number"), + + DATE("Date"); + + private final String value; + + private FieldType2(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static FieldType2 forValue(final String value) { + return Promoter.enumFromString(value, FieldType2.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/ListFieldDefinition200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/ListFieldDefinition200Response.java new file mode 100644 index 00000000..2453b92b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/ListFieldDefinition200Response.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Custom Fields API + * The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + * + * 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.mccustomfields.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccustomfields.models.CustomFieldDefinitionsResponse; +import com.sendgrid.rest.api.v3.mccustomfields.models.Metadata; +import com.sendgrid.rest.api.v3.mccustomfields.models.ReservedFieldDefinitionsResponseInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListFieldDefinition200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_fields") + @Getter + @Setter + private List customFields; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reserved_fields") + @Getter + @Setter + private List reservedFields; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private Metadata metadata; + + public ListFieldDefinition200Response() {} + + private ListFieldDefinition200Response(Builder builder) { + this.customFields = builder.customFields; + this.reservedFields = builder.reservedFields; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private List customFields; + private List reservedFields; + private Metadata metadata; + + public Builder( + List customFields, + List reservedFields + ) { + this.customFields = customFields; + this.reservedFields = reservedFields; + } + + public Builder metadata(Metadata metadata) { + this.metadata = metadata; + return this; + } + + public ListFieldDefinition200Response build() { + return new ListFieldDefinition200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListFieldDefinition200Response.class.getSimpleName() + "(", + ")" + ); + if (customFields != null) joiner.add("customFields=" + customFields); + if (reservedFields != null) joiner.add( + "reservedFields=" + reservedFields + ); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/Metadata.java b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/Metadata.java new file mode 100644 index 00000000..0e5ffbfc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/Metadata.java @@ -0,0 +1,108 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Custom Fields API + * The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + * + * 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.mccustomfields.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.net.URI; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Metadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("prev") + @Getter + @Setter + private URI prev; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("self") + @Getter + @Setter + private URI self; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next") + @Getter + @Setter + private URI next; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("count") + @Getter + @Setter + private Integer count; + + public Metadata() {} + + private Metadata(Builder builder) { + this.prev = builder.prev; + this.self = builder.self; + this.next = builder.next; + this.count = builder.count; + } + + // Builder class for constructing object + public static class Builder { + + private URI prev; + private URI self; + private URI next; + private Integer count; + + public Builder() {} + + public Builder prev(URI prev) { + this.prev = prev; + return this; + } + + public Builder self(URI self) { + this.self = self; + return this; + } + + public Builder next(URI next) { + this.next = next; + return this; + } + + public Builder count(Integer count) { + this.count = count; + return this; + } + + public Metadata build() { + return new Metadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Metadata.class.getSimpleName() + "(", + ")" + ); + if (prev != null) joiner.add("prev=" + prev); + if (self != null) joiner.add("self=" + self); + if (next != null) joiner.add("next=" + next); + if (count != null) joiner.add("count=" + count); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/ReservedFieldDefinitionsResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/ReservedFieldDefinitionsResponseInner.java new file mode 100644 index 00000000..81d61d45 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/ReservedFieldDefinitionsResponseInner.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Custom Fields API + * The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + * + * 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.mccustomfields.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mccustomfields.models.FieldType1; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ReservedFieldDefinitionsResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field_type") + @Getter + @Setter + private FieldType1 fieldType; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("read_only") + @Getter + @Setter + private Boolean readOnly; + + public ReservedFieldDefinitionsResponseInner() {} + + private ReservedFieldDefinitionsResponseInner(Builder builder) { + this.name = builder.name; + this.fieldType = builder.fieldType; + this.readOnly = builder.readOnly; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private FieldType1 fieldType; + private Boolean readOnly; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder fieldType(FieldType1 fieldType) { + this.fieldType = fieldType; + return this; + } + + public Builder readOnly(Boolean readOnly) { + this.readOnly = readOnly; + return this; + } + + public ReservedFieldDefinitionsResponseInner build() { + return new ReservedFieldDefinitionsResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ReservedFieldDefinitionsResponseInner.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (fieldType != null) joiner.add("fieldType=" + fieldType); + if (readOnly != null) joiner.add("readOnly=" + readOnly); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/UpdateFieldDefinitionRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/UpdateFieldDefinitionRequest.java new file mode 100644 index 00000000..9fdd3801 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mccustomfields/models/UpdateFieldDefinitionRequest.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Custom Fields API + * The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + * + * 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.mccustomfields.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateFieldDefinitionRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public UpdateFieldDefinitionRequest() {} + + private UpdateFieldDefinitionRequest(Builder builder) { + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + + public Builder(String name) { + this.name = name; + } + + public UpdateFieldDefinitionRequest build() { + return new UpdateFieldDefinitionRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateFieldDefinitionRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/CreateDesign.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/CreateDesign.java new file mode 100644 index 00000000..6de35321 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/CreateDesign.java @@ -0,0 +1,96 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns; + +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.mcdesigns.models.ApiErrors; +import com.sendgrid.rest.api.v3.mcdesigns.models.DesignInput; +import com.sendgrid.rest.api.v3.mcdesigns.models.DesignOutput; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateDesign extends ApiKeyBase { + + @Setter + private DesignInput designInput; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/designs"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "CreateDesign 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")) { + ApiErrors error = JsonUtil.fromJson( + response.getStream(), + ApiErrors.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(), DesignOutput.class), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (designInput != null) { + request.addBody(JsonUtil.toJson(designInput)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/DeleteDesign.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/DeleteDesign.java new file mode 100644 index 00000000..f6494131 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/DeleteDesign.java @@ -0,0 +1,106 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns; + +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.mcdesigns.models.ApiErrors; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.UUID; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DeleteDesign extends ApiKeyBase { + + private final UUID id; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/designs/{id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteDesign 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")) { + ApiErrors error = JsonUtil.fromJson( + response.getStream(), + ApiErrors.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ApiErrors error = JsonUtil.fromJson( + response.getStream(), + ApiErrors.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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/DuplicateDesign.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/DuplicateDesign.java new file mode 100644 index 00000000..dc337d9e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/DuplicateDesign.java @@ -0,0 +1,120 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns; + +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.mcdesigns.models.ApiError; +import com.sendgrid.rest.api.v3.mcdesigns.models.ApiErrors; +import com.sendgrid.rest.api.v3.mcdesigns.models.DesignDuplicateInput; +import com.sendgrid.rest.api.v3.mcdesigns.models.DesignOutput; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.UUID; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DuplicateDesign extends ApiKeyBase { + + private final UUID id; + + @Setter + private DesignDuplicateInput designDuplicateInput; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/designs/{id}"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DuplicateDesign 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")) { + ApiError error = JsonUtil.fromJson( + response.getStream(), + ApiError.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ApiErrors error = JsonUtil.fromJson( + response.getStream(), + ApiErrors.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(), DesignOutput.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addBody(final Request request) { + if (designDuplicateInput != null) { + request.addBody(JsonUtil.toJson(designDuplicateInput)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/DuplicatePreBuiltDesign.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/DuplicatePreBuiltDesign.java new file mode 100644 index 00000000..b6332611 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/DuplicatePreBuiltDesign.java @@ -0,0 +1,119 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns; + +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.mcdesigns.models.ApiErrors; +import com.sendgrid.rest.api.v3.mcdesigns.models.DesignDuplicateInput; +import com.sendgrid.rest.api.v3.mcdesigns.models.DesignOutput; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.UUID; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DuplicatePreBuiltDesign extends ApiKeyBase { + + private final UUID id; + + @Setter + private DesignDuplicateInput designDuplicateInput; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/designs/pre-builts/{id}"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DuplicatePreBuiltDesign 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")) { + ApiErrors error = JsonUtil.fromJson( + response.getStream(), + ApiErrors.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ApiErrors error = JsonUtil.fromJson( + response.getStream(), + ApiErrors.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(), DesignOutput.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addBody(final Request request) { + if (designDuplicateInput != null) { + request.addBody(JsonUtil.toJson(designDuplicateInput)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/GetDesign.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/GetDesign.java new file mode 100644 index 00000000..34db1018 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/GetDesign.java @@ -0,0 +1,107 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns; + +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.mcdesigns.models.ApiErrors; +import com.sendgrid.rest.api.v3.mcdesigns.models.DesignOutput; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.UUID; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class GetDesign extends ApiKeyBase { + + private final UUID id; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/designs/{id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetDesign 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")) { + ApiErrors error = JsonUtil.fromJson( + response.getStream(), + ApiErrors.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ApiErrors error = JsonUtil.fromJson( + response.getStream(), + ApiErrors.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(), DesignOutput.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/GetPreBuiltDesign.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/GetPreBuiltDesign.java new file mode 100644 index 00000000..04bd69c0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/GetPreBuiltDesign.java @@ -0,0 +1,107 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns; + +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.mcdesigns.models.ApiErrors; +import com.sendgrid.rest.api.v3.mcdesigns.models.DesignOutput; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.UUID; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class GetPreBuiltDesign extends ApiKeyBase { + + private final UUID id; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/designs/pre-builts/{id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetPreBuiltDesign 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")) { + ApiErrors error = JsonUtil.fromJson( + response.getStream(), + ApiErrors.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ApiErrors error = JsonUtil.fromJson( + response.getStream(), + ApiErrors.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(), DesignOutput.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/ListDesign.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/ListDesign.java new file mode 100644 index 00000000..da2f468b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/ListDesign.java @@ -0,0 +1,97 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns; + +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.mcdesigns.models.ListDesign200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListDesign extends ApiKeyBase { + + @Setter + private Integer pageSize; + + @Setter + private String pageToken; + + @Setter + private Boolean summary; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/designs"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListDesign creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + ListDesign200Response.class + ), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (pageSize != null) { + request.addQueryParam("page_size", pageSize.toString()); + } + if (pageToken != null) { + request.addQueryParam("page_token", pageToken.toString()); + } + if (summary != null) { + request.addQueryParam("summary", summary.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/ListPreBuiltDesign.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/ListPreBuiltDesign.java new file mode 100644 index 00000000..f7b036ab --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/ListPreBuiltDesign.java @@ -0,0 +1,97 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns; + +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.mcdesigns.models.ListDesign200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListPreBuiltDesign extends ApiKeyBase { + + @Setter + private Integer pageSize; + + @Setter + private String pageToken; + + @Setter + private Boolean summary; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/designs/pre-builts"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListPreBuiltDesign creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + ListDesign200Response.class + ), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (pageSize != null) { + request.addQueryParam("page_size", pageSize.toString()); + } + if (pageToken != null) { + request.addQueryParam("page_token", pageToken.toString()); + } + if (summary != null) { + request.addQueryParam("summary", summary.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/UpdateDesign.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/UpdateDesign.java new file mode 100644 index 00000000..6698f043 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/UpdateDesign.java @@ -0,0 +1,119 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns; + +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.mcdesigns.models.ApiErrors; +import com.sendgrid.rest.api.v3.mcdesigns.models.DesignOutput; +import com.sendgrid.rest.api.v3.mcdesigns.models.UpdateDesignRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.UUID; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateDesign extends ApiKeyBase { + + private final UUID id; + + @Setter + private UpdateDesignRequest updateDesignRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/designs/{id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateDesign 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")) { + ApiErrors error = JsonUtil.fromJson( + response.getStream(), + ApiErrors.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ApiErrors error = JsonUtil.fromJson( + response.getStream(), + ApiErrors.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(), DesignOutput.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addBody(final Request request) { + if (updateDesignRequest != null) { + request.addBody(JsonUtil.toJson(updateDesignRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/ApiError.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/ApiError.java new file mode 100644 index 00000000..f0054586 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/ApiError.java @@ -0,0 +1,82 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ApiError { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_id") + @Getter + @Setter + private String errorId; + + public ApiError() {} + + private ApiError(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.errorId = builder.errorId; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private String errorId; + + public Builder(String message, String field, String errorId) { + this.message = message; + this.field = field; + this.errorId = errorId; + } + + public ApiError build() { + return new ApiError(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ApiError.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (errorId != null) joiner.add("errorId=" + errorId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/ApiErrors.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/ApiErrors.java new file mode 100644 index 00000000..9c1cfc1c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/ApiErrors.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcdesigns.models.ApiError; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ApiErrors { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ApiErrors() {} + + private ApiErrors(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public ApiErrors build() { + return new ApiErrors(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ApiErrors.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/DesignCommonProperties.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/DesignCommonProperties.java new file mode 100644 index 00000000..baae234e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/DesignCommonProperties.java @@ -0,0 +1,125 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcdesigns.models.Editor; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DesignCommonProperties { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("editor") + @Getter + @Setter + private Editor editor; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("generate_plain_content") + @Getter + @Setter + private Boolean generatePlainContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subject") + @Getter + @Setter + private String subject; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("categories") + @Getter + @Setter + private List categories; + + public DesignCommonProperties() {} + + private DesignCommonProperties(Builder builder) { + this.name = builder.name; + this.editor = builder.editor; + this.generatePlainContent = builder.generatePlainContent; + this.subject = builder.subject; + this.categories = builder.categories; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private Editor editor; + private Boolean generatePlainContent; + private String subject; + private List categories; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder editor(Editor editor) { + this.editor = editor; + return this; + } + + public Builder generatePlainContent(Boolean generatePlainContent) { + this.generatePlainContent = generatePlainContent; + return this; + } + + public Builder subject(String subject) { + this.subject = subject; + return this; + } + + public Builder categories(List categories) { + this.categories = categories; + return this; + } + + public DesignCommonProperties build() { + return new DesignCommonProperties(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DesignCommonProperties.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (editor != null) joiner.add("editor=" + editor); + if (generatePlainContent != null) joiner.add( + "generatePlainContent=" + generatePlainContent + ); + if (subject != null) joiner.add("subject=" + subject); + if (categories != null) joiner.add("categories=" + categories); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/DesignDuplicateInput.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/DesignDuplicateInput.java new file mode 100644 index 00000000..55273620 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/DesignDuplicateInput.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcdesigns.models.Editor; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DesignDuplicateInput { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("editor") + @Getter + @Setter + private Editor editor; + + public DesignDuplicateInput() {} + + private DesignDuplicateInput(Builder builder) { + this.name = builder.name; + this.editor = builder.editor; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private Editor editor; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder editor(Editor editor) { + this.editor = editor; + return this; + } + + public DesignDuplicateInput build() { + return new DesignDuplicateInput(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DesignDuplicateInput.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (editor != null) joiner.add("editor=" + editor); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/DesignInput.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/DesignInput.java new file mode 100644 index 00000000..8f5aed61 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/DesignInput.java @@ -0,0 +1,105 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcdesigns.models.Editor; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DesignInput { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("editor") + @Getter + @Setter + private Editor editor; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html_content") + @Getter + @Setter + private String htmlContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("plain_content") + @Getter + @Setter + private String plainContent; + + public DesignInput() {} + + private DesignInput(Builder builder) { + this.name = builder.name; + this.editor = builder.editor; + this.htmlContent = builder.htmlContent; + this.plainContent = builder.plainContent; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private Editor editor; + private String htmlContent; + private String plainContent; + + public Builder(String htmlContent) { + this.htmlContent = htmlContent; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder editor(Editor editor) { + this.editor = editor; + return this; + } + + public Builder plainContent(String plainContent) { + this.plainContent = plainContent; + return this; + } + + public DesignInput build() { + return new DesignInput(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DesignInput.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (editor != null) joiner.add("editor=" + editor); + if (htmlContent != null) joiner.add("htmlContent=" + htmlContent); + if (plainContent != null) joiner.add("plainContent=" + plainContent); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/DesignOutput.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/DesignOutput.java new file mode 100644 index 00000000..421b63e0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/DesignOutput.java @@ -0,0 +1,105 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcdesigns.models.Editor; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DesignOutput { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("editor") + @Getter + @Setter + private Editor editor; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html_content") + @Getter + @Setter + private String htmlContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("plain_content") + @Getter + @Setter + private String plainContent; + + public DesignOutput() {} + + private DesignOutput(Builder builder) { + this.name = builder.name; + this.editor = builder.editor; + this.htmlContent = builder.htmlContent; + this.plainContent = builder.plainContent; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private Editor editor; + private String htmlContent; + private String plainContent; + + public Builder(String htmlContent) { + this.htmlContent = htmlContent; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder editor(Editor editor) { + this.editor = editor; + return this; + } + + public Builder plainContent(String plainContent) { + this.plainContent = plainContent; + return this; + } + + public DesignOutput build() { + return new DesignOutput(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DesignOutput.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (editor != null) joiner.add("editor=" + editor); + if (htmlContent != null) joiner.add("htmlContent=" + htmlContent); + if (plainContent != null) joiner.add("plainContent=" + plainContent); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/DesignOutputSummary.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/DesignOutputSummary.java new file mode 100644 index 00000000..a6189bd6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/DesignOutputSummary.java @@ -0,0 +1,137 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcdesigns.models.Editor; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DesignOutputSummary { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private UUID id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private String updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private String createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("thumbnail_url") + @Getter + @Setter + private String thumbnailUrl; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("editor") + @Getter + @Setter + private Editor editor; + + public DesignOutputSummary() {} + + private DesignOutputSummary(Builder builder) { + this.id = builder.id; + this.updatedAt = builder.updatedAt; + this.createdAt = builder.createdAt; + this.thumbnailUrl = builder.thumbnailUrl; + this.name = builder.name; + this.editor = builder.editor; + } + + // Builder class for constructing object + public static class Builder { + + private UUID id; + private String updatedAt; + private String createdAt; + private String thumbnailUrl; + private String name; + private Editor editor; + + public Builder() {} + + public Builder id(UUID id) { + this.id = id; + return this; + } + + public Builder updatedAt(String updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder createdAt(String createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder editor(Editor editor) { + this.editor = editor; + return this; + } + + public DesignOutputSummary build() { + return new DesignOutputSummary(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DesignOutputSummary.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (thumbnailUrl != null) joiner.add("thumbnailUrl=" + thumbnailUrl); + if (name != null) joiner.add("name=" + name); + if (editor != null) joiner.add("editor=" + editor); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/Editor.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/Editor.java new file mode 100644 index 00000000..e6ec0c04 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/Editor.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Editor { + CODE("code"), + + DESIGN("design"); + + private final String value; + + private Editor(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Editor forValue(final String value) { + return Promoter.enumFromString(value, Editor.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/ListDesign200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/ListDesign200Response.java new file mode 100644 index 00000000..877cd8c8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/ListDesign200Response.java @@ -0,0 +1,82 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcdesigns.models.DesignOutputSummary; +import com.sendgrid.rest.api.v3.mcdesigns.models.Metadata; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListDesign200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private Metadata metadata; + + public ListDesign200Response() {} + + private ListDesign200Response(Builder builder) { + this.result = builder.result; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + private Metadata metadata; + + public Builder() {} + + public Builder result(List result) { + this.result = result; + return this; + } + + public Builder metadata(Metadata metadata) { + this.metadata = metadata; + return this; + } + + public ListDesign200Response build() { + return new ListDesign200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListDesign200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/Metadata.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/Metadata.java new file mode 100644 index 00000000..4d793bee --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/Metadata.java @@ -0,0 +1,108 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.net.URI; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Metadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("prev") + @Getter + @Setter + private URI prev; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("self") + @Getter + @Setter + private URI self; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next") + @Getter + @Setter + private URI next; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("count") + @Getter + @Setter + private Integer count; + + public Metadata() {} + + private Metadata(Builder builder) { + this.prev = builder.prev; + this.self = builder.self; + this.next = builder.next; + this.count = builder.count; + } + + // Builder class for constructing object + public static class Builder { + + private URI prev; + private URI self; + private URI next; + private Integer count; + + public Builder() {} + + public Builder prev(URI prev) { + this.prev = prev; + return this; + } + + public Builder self(URI self) { + this.self = self; + return this; + } + + public Builder next(URI next) { + this.next = next; + return this; + } + + public Builder count(Integer count) { + this.count = count; + return this; + } + + public Metadata build() { + return new Metadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Metadata.class.getSimpleName() + "(", + ")" + ); + if (prev != null) joiner.add("prev=" + prev); + if (self != null) joiner.add("self=" + self); + if (next != null) joiner.add("next=" + next); + if (count != null) joiner.add("count=" + count); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/UpdateDesignRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/UpdateDesignRequest.java new file mode 100644 index 00000000..760cab6d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcdesigns/models/UpdateDesignRequest.java @@ -0,0 +1,138 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Designs + * The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + * + * 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.mcdesigns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateDesignRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html_content") + @Getter + @Setter + private String htmlContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("plain_content") + @Getter + @Setter + private String plainContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("generate_plain_content") + @Getter + @Setter + private Boolean generatePlainContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subject") + @Getter + @Setter + private String subject; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("categories") + @Getter + @Setter + private List categories; + + public UpdateDesignRequest() {} + + private UpdateDesignRequest(Builder builder) { + this.name = builder.name; + this.htmlContent = builder.htmlContent; + this.plainContent = builder.plainContent; + this.generatePlainContent = builder.generatePlainContent; + this.subject = builder.subject; + this.categories = builder.categories; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private String htmlContent; + private String plainContent; + private Boolean generatePlainContent; + private String subject; + private List categories; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder htmlContent(String htmlContent) { + this.htmlContent = htmlContent; + return this; + } + + public Builder plainContent(String plainContent) { + this.plainContent = plainContent; + return this; + } + + public Builder generatePlainContent(Boolean generatePlainContent) { + this.generatePlainContent = generatePlainContent; + return this; + } + + public Builder subject(String subject) { + this.subject = subject; + return this; + } + + public Builder categories(List categories) { + this.categories = categories; + return this; + } + + public UpdateDesignRequest build() { + return new UpdateDesignRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateDesignRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (htmlContent != null) joiner.add("htmlContent=" + htmlContent); + if (plainContent != null) joiner.add("plainContent=" + plainContent); + if (generatePlainContent != null) joiner.add( + "generatePlainContent=" + generatePlainContent + ); + if (subject != null) joiner.add("subject=" + subject); + if (categories != null) joiner.add("categories=" + categories); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/CreateMarketingList.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/CreateMarketingList.java new file mode 100644 index 00000000..043a10d4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/CreateMarketingList.java @@ -0,0 +1,96 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists; + +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.mclists.models.CreateMarketingList400Response; +import com.sendgrid.rest.api.v3.mclists.models.CreateMarketingListRequest; +import com.sendgrid.rest.api.v3.mclists.models.ModelList; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateMarketingList extends ApiKeyBase { + + @Setter + private CreateMarketingListRequest createMarketingListRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/lists"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "CreateMarketingList 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")) { + CreateMarketingList400Response error = JsonUtil.fromJson( + response.getStream(), + CreateMarketingList400Response.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(), ModelList.class), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (createMarketingListRequest != null) { + request.addBody(JsonUtil.toJson(createMarketingListRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/DeleteContact.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/DeleteContact.java new file mode 100644 index 00000000..15361786 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/DeleteContact.java @@ -0,0 +1,119 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists; + +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.mclists.models.DeleteContact202Response; +import com.sendgrid.rest.api.v3.mclists.models.Error; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DeleteContact extends ApiKeyBase { + + private final String id; + private final String contactIds; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/lists/{id}/contacts"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteContact 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")) { + Error error = JsonUtil.fromJson( + response.getStream(), + Error.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, + JsonUtil.fromJson( + response.getStream(), + DeleteContact202Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addQueryParams(Request request) { + if (contactIds != null) { + request.addQueryParam("contact_ids", contactIds.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/DeleteMarketingList.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/DeleteMarketingList.java new file mode 100644 index 00000000..0fcfb34a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/DeleteMarketingList.java @@ -0,0 +1,103 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists; + +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.mclists.models.DeleteMarketingList404Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteMarketingList extends ApiKeyBase { + + private final String id; + + @Setter + private Boolean deleteContacts; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/lists/{id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteMarketingList creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + DeleteMarketingList404Response error = JsonUtil.fromJson( + response.getStream(), + DeleteMarketingList404Response.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(), String.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addQueryParams(Request request) { + if (deleteContacts != null) { + request.addQueryParam("delete_contacts", deleteContacts.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/GetMarketingList.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/GetMarketingList.java new file mode 100644 index 00000000..c40048d3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/GetMarketingList.java @@ -0,0 +1,114 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists; + +import com.fasterxml.jackson.core.type.TypeReference; +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.mclists.models.Error; +import com.sendgrid.rest.api.v3.mclists.models.GetMarketingList200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetMarketingList extends ApiKeyBase { + + private final String id; + + @Setter + private Boolean contactSample; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/lists/{id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetMarketingList creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + 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(), + GetMarketingList200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addQueryParams(Request request) { + if (contactSample != null) { + request.addQueryParam("contact_sample", contactSample.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/ListContactCount.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/ListContactCount.java new file mode 100644 index 00000000..0b506809 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/ListContactCount.java @@ -0,0 +1,97 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists; + +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.mclists.models.ListContactCount200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListContactCount extends ApiKeyBase { + + private final String id; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/lists/{id}/contacts/count"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListContactCount creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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, + JsonUtil.fromJson( + response.getStream(), + ListContactCount200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/ListMarketingList.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/ListMarketingList.java new file mode 100644 index 00000000..f06003af --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/ListMarketingList.java @@ -0,0 +1,92 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists; + +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.mclists.models.ListMarketingList200Response; +import com.sendgrid.util.JsonUtil; +import java.math.BigDecimal; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListMarketingList extends ApiKeyBase { + + @Setter + private BigDecimal pageSize; + + @Setter + private String pageToken; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/lists"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListMarketingList creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + ListMarketingList200Response.class + ), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (pageSize != null) { + request.addQueryParam("page_size", pageSize.toString()); + } + if (pageToken != null) { + request.addQueryParam("page_token", pageToken.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/UpdateMarketingList.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/UpdateMarketingList.java new file mode 100644 index 00000000..13966cc2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/UpdateMarketingList.java @@ -0,0 +1,118 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists; + +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.mclists.models.CreateMarketingList400Response; +import com.sendgrid.rest.api.v3.mclists.models.ModelList; +import com.sendgrid.rest.api.v3.mclists.models.UpdateMarketingListRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateMarketingList extends ApiKeyBase { + + private final String id; + + @Setter + private UpdateMarketingListRequest updateMarketingListRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/lists/{id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateMarketingList 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")) { + CreateMarketingList400Response error = JsonUtil.fromJson( + response.getStream(), + CreateMarketingList400Response.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, + JsonUtil.fromJson(response.getStream(), ModelList.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addBody(final Request request) { + if (updateMarketingListRequest != null) { + request.addBody(JsonUtil.toJson(updateMarketingListRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/models/ContactDetails.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/ContactDetails.java new file mode 100644 index 00000000..29b0b4aa --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/ContactDetails.java @@ -0,0 +1,399 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mclists.models.SelfMetadata; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactDetails { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private UUID id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unique_name") + @Getter + @Setter + private String uniqueName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("phone_number_id") + @Getter + @Setter + private String phoneNumberId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("external_id") + @Getter + @Setter + private String externalId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("anonymous_id") + @Getter + @Setter + private String anonymousId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("alternate_emails") + @Getter + @Setter + private List alternateEmails; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_line_1") + @Getter + @Setter + private String addressLine1; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_line_2") + @Getter + @Setter + private String addressLine2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city") + @Getter + @Setter + private String city; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state_province_region") + @Getter + @Setter + private String stateProvinceRegion; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country") + @Getter + @Setter + private String country; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("postal_code") + @Getter + @Setter + private String postalCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("phone_number") + @Getter + @Setter + private String phoneNumber; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("whatsapp") + @Getter + @Setter + private String whatsapp; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("line") + @Getter + @Setter + private String line; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("facebook") + @Getter + @Setter + private String facebook; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list_ids") + @Getter + @Setter + private List listIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("segment_ids") + @Getter + @Setter + private List segmentIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_fields") + @Getter + @Setter + private Object customFields; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private OffsetDateTime createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private OffsetDateTime updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private SelfMetadata metadata; + + public ContactDetails() {} + + private ContactDetails(Builder builder) { + this.id = builder.id; + this.firstName = builder.firstName; + this.lastName = builder.lastName; + this.uniqueName = builder.uniqueName; + this.email = builder.email; + this.phoneNumberId = builder.phoneNumberId; + this.externalId = builder.externalId; + this.anonymousId = builder.anonymousId; + this.alternateEmails = builder.alternateEmails; + this.addressLine1 = builder.addressLine1; + this.addressLine2 = builder.addressLine2; + this.city = builder.city; + this.stateProvinceRegion = builder.stateProvinceRegion; + this.country = builder.country; + this.postalCode = builder.postalCode; + this.phoneNumber = builder.phoneNumber; + this.whatsapp = builder.whatsapp; + this.line = builder.line; + this.facebook = builder.facebook; + this.listIds = builder.listIds; + this.segmentIds = builder.segmentIds; + this.customFields = builder.customFields; + this.createdAt = builder.createdAt; + this.updatedAt = builder.updatedAt; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private UUID id; + private String firstName; + private String lastName; + private String uniqueName; + private String email; + private String phoneNumberId; + private String externalId; + private String anonymousId; + private List alternateEmails; + private String addressLine1; + private String addressLine2; + private String city; + private String stateProvinceRegion; + private String country; + private String postalCode; + private String phoneNumber; + private String whatsapp; + private String line; + private String facebook; + private List listIds; + private List segmentIds; + private Object customFields; + private OffsetDateTime createdAt; + private OffsetDateTime updatedAt; + private SelfMetadata metadata; + + public Builder( + UUID id, + List listIds, + OffsetDateTime createdAt, + OffsetDateTime updatedAt + ) { + this.id = id; + this.listIds = listIds; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Builder firstName(String firstName) { + this.firstName = firstName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = lastName; + return this; + } + + public Builder uniqueName(String uniqueName) { + this.uniqueName = uniqueName; + return this; + } + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder phoneNumberId(String phoneNumberId) { + this.phoneNumberId = phoneNumberId; + return this; + } + + public Builder externalId(String externalId) { + this.externalId = externalId; + return this; + } + + public Builder anonymousId(String anonymousId) { + this.anonymousId = anonymousId; + return this; + } + + public Builder alternateEmails(List alternateEmails) { + this.alternateEmails = alternateEmails; + return this; + } + + public Builder addressLine1(String addressLine1) { + this.addressLine1 = addressLine1; + return this; + } + + public Builder addressLine2(String addressLine2) { + this.addressLine2 = addressLine2; + return this; + } + + public Builder city(String city) { + this.city = city; + return this; + } + + public Builder stateProvinceRegion(String stateProvinceRegion) { + this.stateProvinceRegion = stateProvinceRegion; + return this; + } + + public Builder country(String country) { + this.country = country; + return this; + } + + public Builder postalCode(String postalCode) { + this.postalCode = postalCode; + return this; + } + + public Builder phoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + public Builder whatsapp(String whatsapp) { + this.whatsapp = whatsapp; + return this; + } + + public Builder line(String line) { + this.line = line; + return this; + } + + public Builder facebook(String facebook) { + this.facebook = facebook; + return this; + } + + public Builder segmentIds(List segmentIds) { + this.segmentIds = segmentIds; + return this; + } + + public Builder customFields(Object customFields) { + this.customFields = customFields; + return this; + } + + public Builder metadata(SelfMetadata metadata) { + this.metadata = metadata; + return this; + } + + public ContactDetails build() { + return new ContactDetails(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactDetails.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (firstName != null) joiner.add("firstName=" + firstName); + if (lastName != null) joiner.add("lastName=" + lastName); + if (uniqueName != null) joiner.add("uniqueName=" + uniqueName); + if (email != null) joiner.add("email=" + email); + if (phoneNumberId != null) joiner.add("phoneNumberId=" + phoneNumberId); + if (externalId != null) joiner.add("externalId=" + externalId); + if (anonymousId != null) joiner.add("anonymousId=" + anonymousId); + if (alternateEmails != null) joiner.add( + "alternateEmails=" + alternateEmails + ); + if (addressLine1 != null) joiner.add("addressLine1=" + addressLine1); + if (addressLine2 != null) joiner.add("addressLine2=" + addressLine2); + if (city != null) joiner.add("city=" + city); + if (stateProvinceRegion != null) joiner.add( + "stateProvinceRegion=" + stateProvinceRegion + ); + if (country != null) joiner.add("country=" + country); + if (postalCode != null) joiner.add("postalCode=" + postalCode); + if (phoneNumber != null) joiner.add("phoneNumber=" + phoneNumber); + if (whatsapp != null) joiner.add("whatsapp=" + whatsapp); + if (line != null) joiner.add("line=" + line); + if (facebook != null) joiner.add("facebook=" + facebook); + if (listIds != null) joiner.add("listIds=" + listIds); + if (segmentIds != null) joiner.add("segmentIds=" + segmentIds); + if (customFields != null) joiner.add("customFields=" + customFields); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/models/CreateMarketingList400Response.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/CreateMarketingList400Response.java new file mode 100644 index 00000000..5db3b2a9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/CreateMarketingList400Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mclists.models.Error; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateMarketingList400Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public CreateMarketingList400Response() {} + + private CreateMarketingList400Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public CreateMarketingList400Response build() { + return new CreateMarketingList400Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateMarketingList400Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/models/CreateMarketingListRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/CreateMarketingListRequest.java new file mode 100644 index 00000000..6efb1c35 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/CreateMarketingListRequest.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateMarketingListRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public CreateMarketingListRequest() {} + + private CreateMarketingListRequest(Builder builder) { + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + + public Builder(String name) { + this.name = name; + } + + public CreateMarketingListRequest build() { + return new CreateMarketingListRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateMarketingListRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/models/DeleteContact202Response.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/DeleteContact202Response.java new file mode 100644 index 00000000..771c7148 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/DeleteContact202Response.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteContact202Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("job_id") + @Getter + @Setter + private String jobId; + + public DeleteContact202Response() {} + + private DeleteContact202Response(Builder builder) { + this.jobId = builder.jobId; + } + + // Builder class for constructing object + public static class Builder { + + private String jobId; + + public Builder() {} + + public Builder jobId(String jobId) { + this.jobId = jobId; + return this; + } + + public DeleteContact202Response build() { + return new DeleteContact202Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteContact202Response.class.getSimpleName() + "(", + ")" + ); + if (jobId != null) joiner.add("jobId=" + jobId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/models/DeleteMarketingList200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/DeleteMarketingList200Response.java new file mode 100644 index 00000000..39705a64 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/DeleteMarketingList200Response.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteMarketingList200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("job_id") + @Getter + @Setter + private String jobId; + + public DeleteMarketingList200Response() {} + + private DeleteMarketingList200Response(Builder builder) { + this.jobId = builder.jobId; + } + + // Builder class for constructing object + public static class Builder { + + private String jobId; + + public Builder() {} + + public Builder jobId(String jobId) { + this.jobId = jobId; + return this; + } + + public DeleteMarketingList200Response build() { + return new DeleteMarketingList200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteMarketingList200Response.class.getSimpleName() + "(", + ")" + ); + if (jobId != null) joiner.add("jobId=" + jobId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/models/DeleteMarketingList404Response.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/DeleteMarketingList404Response.java new file mode 100644 index 00000000..efe7d5b3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/DeleteMarketingList404Response.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteMarketingList404Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public DeleteMarketingList404Response() {} + + private DeleteMarketingList404Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder(List errors) { + this.errors = errors; + } + + public DeleteMarketingList404Response build() { + return new DeleteMarketingList404Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteMarketingList404Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/models/Error.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/Error.java new file mode 100644 index 00000000..30a47777 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/Error.java @@ -0,0 +1,104 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Error { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_id") + @Getter + @Setter + private String errorId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("parameter") + @Getter + @Setter + private String parameter; + + public Error() {} + + private Error(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.errorId = builder.errorId; + this.parameter = builder.parameter; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private String errorId; + private String parameter; + + public Builder(String message) { + this.message = message; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder errorId(String errorId) { + this.errorId = errorId; + return this; + } + + public Builder parameter(String parameter) { + this.parameter = parameter; + return this; + } + + public Error build() { + return new Error(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Error.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (errorId != null) joiner.add("errorId=" + errorId); + if (parameter != null) joiner.add("parameter=" + parameter); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/models/GetMarketingList200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/GetMarketingList200Response.java new file mode 100644 index 00000000..2617ffb2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/GetMarketingList200Response.java @@ -0,0 +1,123 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mclists.models.ContactDetails; +import com.sendgrid.rest.api.v3.mclists.models.SelfMetadata; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetMarketingList200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("contact_count") + @Getter + @Setter + private Integer contactCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private SelfMetadata metadata; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("contact_sample") + @Getter + @Setter + private ContactDetails contactSample; + + public GetMarketingList200Response() {} + + private GetMarketingList200Response(Builder builder) { + this.id = builder.id; + this.name = builder.name; + this.contactCount = builder.contactCount; + this.metadata = builder.metadata; + this.contactSample = builder.contactSample; + } + + // Builder class for constructing object + public static class Builder { + + private String id; + private String name; + private Integer contactCount; + private SelfMetadata metadata; + private ContactDetails contactSample; + + public Builder() {} + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder contactCount(Integer contactCount) { + this.contactCount = contactCount; + return this; + } + + public Builder metadata(SelfMetadata metadata) { + this.metadata = metadata; + return this; + } + + public Builder contactSample(ContactDetails contactSample) { + this.contactSample = contactSample; + return this; + } + + public GetMarketingList200Response build() { + return new GetMarketingList200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetMarketingList200Response.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (name != null) joiner.add("name=" + name); + if (contactCount != null) joiner.add("contactCount=" + contactCount); + if (metadata != null) joiner.add("metadata=" + metadata); + if (contactSample != null) joiner.add("contactSample=" + contactSample); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/models/ListContactCount200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/ListContactCount200Response.java new file mode 100644 index 00000000..d508e800 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/ListContactCount200Response.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListContactCount200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("contact_count") + @Getter + @Setter + private Integer contactCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("billable_count") + @Getter + @Setter + private Integer billableCount; + + public ListContactCount200Response() {} + + private ListContactCount200Response(Builder builder) { + this.contactCount = builder.contactCount; + this.billableCount = builder.billableCount; + } + + // Builder class for constructing object + public static class Builder { + + private Integer contactCount; + private Integer billableCount; + + public Builder() {} + + public Builder contactCount(Integer contactCount) { + this.contactCount = contactCount; + return this; + } + + public Builder billableCount(Integer billableCount) { + this.billableCount = billableCount; + return this; + } + + public ListContactCount200Response build() { + return new ListContactCount200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListContactCount200Response.class.getSimpleName() + "(", + ")" + ); + if (contactCount != null) joiner.add("contactCount=" + contactCount); + if (billableCount != null) joiner.add("billableCount=" + billableCount); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/models/ListMarketingList200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/ListMarketingList200Response.java new file mode 100644 index 00000000..fb070824 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/ListMarketingList200Response.java @@ -0,0 +1,82 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mclists.models.Metadata; +import com.sendgrid.rest.api.v3.mclists.models.ModelList; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListMarketingList200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private Metadata metadata; + + public ListMarketingList200Response() {} + + private ListMarketingList200Response(Builder builder) { + this.result = builder.result; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + private Metadata metadata; + + public Builder() {} + + public Builder result(List result) { + this.result = result; + return this; + } + + public Builder metadata(Metadata metadata) { + this.metadata = metadata; + return this; + } + + public ListMarketingList200Response build() { + return new ListMarketingList200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListMarketingList200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/models/Metadata.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/Metadata.java new file mode 100644 index 00000000..420b1557 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/Metadata.java @@ -0,0 +1,109 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.net.URI; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Metadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("prev") + @Getter + @Setter + private URI prev; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("self") + @Getter + @Setter + private URI self; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next") + @Getter + @Setter + private URI next; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("count") + @Getter + @Setter + private BigDecimal count; + + public Metadata() {} + + private Metadata(Builder builder) { + this.prev = builder.prev; + this.self = builder.self; + this.next = builder.next; + this.count = builder.count; + } + + // Builder class for constructing object + public static class Builder { + + private URI prev; + private URI self; + private URI next; + private BigDecimal count; + + public Builder() {} + + public Builder prev(URI prev) { + this.prev = prev; + return this; + } + + public Builder self(URI self) { + this.self = self; + return this; + } + + public Builder next(URI next) { + this.next = next; + return this; + } + + public Builder count(BigDecimal count) { + this.count = count; + return this; + } + + public Metadata build() { + return new Metadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Metadata.class.getSimpleName() + "(", + ")" + ); + if (prev != null) joiner.add("prev=" + prev); + if (self != null) joiner.add("self=" + self); + if (next != null) joiner.add("next=" + next); + if (count != null) joiner.add("count=" + count); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/models/ModelList.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/ModelList.java new file mode 100644 index 00000000..0ae2f226 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/ModelList.java @@ -0,0 +1,108 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mclists.models.SelfMetadata; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ModelList { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("contact_count") + @Getter + @Setter + private Integer contactCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private SelfMetadata metadata; + + public ModelList() {} + + private ModelList(Builder builder) { + this.id = builder.id; + this.name = builder.name; + this.contactCount = builder.contactCount; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private String id; + private String name; + private Integer contactCount; + private SelfMetadata metadata; + + public Builder() {} + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder contactCount(Integer contactCount) { + this.contactCount = contactCount; + return this; + } + + public Builder metadata(SelfMetadata metadata) { + this.metadata = metadata; + return this; + } + + public ModelList build() { + return new ModelList(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ModelList.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (name != null) joiner.add("name=" + name); + if (contactCount != null) joiner.add("contactCount=" + contactCount); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/models/SelfMetadata.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/SelfMetadata.java new file mode 100644 index 00000000..25da9f81 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/SelfMetadata.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SelfMetadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("self") + @Getter + @Setter + private String self; + + public SelfMetadata() {} + + private SelfMetadata(Builder builder) { + this.self = builder.self; + } + + // Builder class for constructing object + public static class Builder { + + private String self; + + public Builder() {} + + public Builder self(String self) { + this.self = self; + return this; + } + + public SelfMetadata build() { + return new SelfMetadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SelfMetadata.class.getSimpleName() + "(", + ")" + ); + if (self != null) joiner.add("self=" + self); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mclists/models/UpdateMarketingListRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/UpdateMarketingListRequest.java new file mode 100644 index 00000000..71b5e6eb --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mclists/models/UpdateMarketingListRequest.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Lists API + * The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + * + * 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.mclists.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateMarketingListRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public UpdateMarketingListRequest() {} + + private UpdateMarketingListRequest(Builder builder) { + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public UpdateMarketingListRequest build() { + return new UpdateMarketingListRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateMarketingListRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments/DeleteSegment.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/DeleteSegment.java new file mode 100644 index 00000000..6aa1b079 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/DeleteSegment.java @@ -0,0 +1,147 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments API + * This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + * + * 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.mcsegments; + +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.mcsegments.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mcsegments.models.GetSegment404Response; +import com.sendgrid.rest.api.v3.mcsegments.models.ListSegment500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.UUID; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DeleteSegment extends ApiKeyBase { + + private final UUID segmentId; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/segments/{segment_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSegment 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + GetSegment404Response error = JsonUtil.fromJson( + response.getStream(), + GetSegment404Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ListSegment500Response error = JsonUtil.fromJson( + response.getStream(), + ListSegment500Response.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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (segmentId != null) { + request.addPathParam("segment_id", segmentId.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments/GetSegment.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/GetSegment.java new file mode 100644 index 00000000..655ced9a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/GetSegment.java @@ -0,0 +1,146 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments API + * This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + * + * 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.mcsegments; + +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.mcsegments.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mcsegments.models.FullSegment; +import com.sendgrid.rest.api.v3.mcsegments.models.GetSegment404Response; +import com.sendgrid.rest.api.v3.mcsegments.models.ListSegment500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.UUID; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetSegment extends ApiKeyBase { + + private final UUID segmentId; + + @Setter + private Boolean queryJson; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/segments/{segment_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetSegment 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + GetSegment404Response error = JsonUtil.fromJson( + response.getStream(), + GetSegment404Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ListSegment500Response error = JsonUtil.fromJson( + response.getStream(), + ListSegment500Response.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(), FullSegment.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (segmentId != null) { + request.addPathParam("segment_id", segmentId.toString()); + } + } + + private void addQueryParams(Request request) { + if (queryJson != null) { + request.addQueryParam("query_json", queryJson.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments/ListSegment.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/ListSegment.java new file mode 100644 index 00000000..776014cc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/ListSegment.java @@ -0,0 +1,156 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments API + * This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + * + * 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.mcsegments; + +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.mcsegments.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mcsegments.models.ListSegment200Response; +import com.sendgrid.rest.api.v3.mcsegments.models.ListSegment500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSegment extends ApiKeyBase { + + @Setter + private List ids; + + @Setter + private String parentListIds; + + @Setter + private Boolean noParentListId; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/segments"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSegment 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ListSegment500Response error = JsonUtil.fromJson( + response.getStream(), + ListSegment500Response.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(), + ListSegment200Response.class + ), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (ids != null) { + request.addQueryParam("ids", ids.toString()); + } + if (parentListIds != null) { + request.addQueryParam("parent_list_ids", parentListIds.toString()); + } + if (noParentListId != null) { + request.addQueryParam( + "no_parent_list_id", + noParentListId.toString() + ); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ContactResponse.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ContactResponse.java new file mode 100644 index 00000000..8c1cc7f1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ContactResponse.java @@ -0,0 +1,265 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments API + * This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + * + * 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.mcsegments.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsegments.models.ContactResponseCustomFields; +import java.util.List; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private UUID id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("phone_number_id") + @Getter + @Setter + private String phoneNumberId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("external_id") + @Getter + @Setter + private String externalId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("anonymous_id") + @Getter + @Setter + private String anonymousId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("alternate_emails") + @Getter + @Setter + private List alternateEmails; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_line_1") + @Getter + @Setter + private String addressLine1; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_line_2") + @Getter + @Setter + private String addressLine2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city") + @Getter + @Setter + private String city; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state_province_region") + @Getter + @Setter + private String stateProvinceRegion; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("postal_code") + @Getter + @Setter + private Integer postalCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country") + @Getter + @Setter + private String country; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list_ids") + @Getter + @Setter + private List listIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_fields") + @Getter + @Setter + private ContactResponseCustomFields customFields; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("segment_ids") + @Getter + @Setter + private List segmentIds; + + public ContactResponse() {} + + private ContactResponse(Builder builder) { + this.id = builder.id; + this.email = builder.email; + this.phoneNumberId = builder.phoneNumberId; + this.externalId = builder.externalId; + this.anonymousId = builder.anonymousId; + this.alternateEmails = builder.alternateEmails; + this.firstName = builder.firstName; + this.lastName = builder.lastName; + this.addressLine1 = builder.addressLine1; + this.addressLine2 = builder.addressLine2; + this.city = builder.city; + this.stateProvinceRegion = builder.stateProvinceRegion; + this.postalCode = builder.postalCode; + this.country = builder.country; + this.listIds = builder.listIds; + this.customFields = builder.customFields; + this.segmentIds = builder.segmentIds; + } + + // Builder class for constructing object + public static class Builder { + + private UUID id; + private String email; + private String phoneNumberId; + private String externalId; + private String anonymousId; + private List alternateEmails; + private String firstName; + private String lastName; + private String addressLine1; + private String addressLine2; + private String city; + private String stateProvinceRegion; + private Integer postalCode; + private String country; + private List listIds; + private ContactResponseCustomFields customFields; + private List segmentIds; + + public Builder( + UUID id, + List alternateEmails, + String firstName, + String lastName, + String addressLine1, + String addressLine2, + String city, + String stateProvinceRegion, + Integer postalCode, + String country, + ContactResponseCustomFields customFields + ) { + this.id = id; + this.alternateEmails = alternateEmails; + this.firstName = firstName; + this.lastName = lastName; + this.addressLine1 = addressLine1; + this.addressLine2 = addressLine2; + this.city = city; + this.stateProvinceRegion = stateProvinceRegion; + this.postalCode = postalCode; + this.country = country; + this.customFields = customFields; + } + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder phoneNumberId(String phoneNumberId) { + this.phoneNumberId = phoneNumberId; + return this; + } + + public Builder externalId(String externalId) { + this.externalId = externalId; + return this; + } + + public Builder anonymousId(String anonymousId) { + this.anonymousId = anonymousId; + return this; + } + + public Builder listIds(List listIds) { + this.listIds = listIds; + return this; + } + + public Builder segmentIds(List segmentIds) { + this.segmentIds = segmentIds; + return this; + } + + public ContactResponse build() { + return new ContactResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactResponse.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (email != null) joiner.add("email=" + email); + if (phoneNumberId != null) joiner.add("phoneNumberId=" + phoneNumberId); + if (externalId != null) joiner.add("externalId=" + externalId); + if (anonymousId != null) joiner.add("anonymousId=" + anonymousId); + if (alternateEmails != null) joiner.add( + "alternateEmails=" + alternateEmails + ); + if (firstName != null) joiner.add("firstName=" + firstName); + if (lastName != null) joiner.add("lastName=" + lastName); + if (addressLine1 != null) joiner.add("addressLine1=" + addressLine1); + if (addressLine2 != null) joiner.add("addressLine2=" + addressLine2); + if (city != null) joiner.add("city=" + city); + if (stateProvinceRegion != null) joiner.add( + "stateProvinceRegion=" + stateProvinceRegion + ); + if (postalCode != null) joiner.add("postalCode=" + postalCode); + if (country != null) joiner.add("country=" + country); + if (listIds != null) joiner.add("listIds=" + listIds); + if (customFields != null) joiner.add("customFields=" + customFields); + if (segmentIds != null) joiner.add("segmentIds=" + segmentIds); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ContactResponseCustomFields.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ContactResponseCustomFields.java new file mode 100644 index 00000000..99f20b36 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ContactResponseCustomFields.java @@ -0,0 +1,83 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments API + * This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + * + * 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.mcsegments.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactResponseCustomFields { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_field_name1") + @Getter + @Setter + private String customFieldName1; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_field_name2") + @Getter + @Setter + private String customFieldName2; + + public ContactResponseCustomFields() {} + + private ContactResponseCustomFields(Builder builder) { + this.customFieldName1 = builder.customFieldName1; + this.customFieldName2 = builder.customFieldName2; + } + + // Builder class for constructing object + public static class Builder { + + private String customFieldName1; + private String customFieldName2; + + public Builder() {} + + public Builder customFieldName1(String customFieldName1) { + this.customFieldName1 = customFieldName1; + return this; + } + + public Builder customFieldName2(String customFieldName2) { + this.customFieldName2 = customFieldName2; + return this; + } + + public ContactResponseCustomFields build() { + return new ContactResponseCustomFields(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactResponseCustomFields.class.getSimpleName() + "(", + ")" + ); + if (customFieldName1 != null) joiner.add( + "customFieldName1=" + customFieldName1 + ); + if (customFieldName2 != null) joiner.add( + "customFieldName2=" + customFieldName2 + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ErrorResponse.java new file mode 100644 index 00000000..81b59095 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments API + * This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + * + * 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.mcsegments.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsegments.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..c130a430 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments API + * This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + * + * 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.mcsegments.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/FullSegment.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/FullSegment.java new file mode 100644 index 00000000..412c1bea --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/FullSegment.java @@ -0,0 +1,207 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments API + * This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + * + * 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.mcsegments.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsegments.models.ContactResponse; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class FullSegment { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private UUID id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("contacts_count") + @Getter + @Setter + private Integer contactsCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private OffsetDateTime createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("parent_list_id") + @Getter + @Setter + private UUID parentListId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sample_updated_at") + @Getter + @Setter + private OffsetDateTime sampleUpdatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private OffsetDateTime updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next_sample_update") + @Getter + @Setter + private String nextSampleUpdate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("contacts_sample") + @Getter + @Setter + private List contactsSample; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("query_json") + @Getter + @Setter + private Object queryJson; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("parent_list_ids") + @Getter + @Setter + private List parentListIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("query_dsl") + @Getter + @Setter + private String queryDsl; + + public FullSegment() {} + + private FullSegment(Builder builder) { + this.id = builder.id; + this.contactsCount = builder.contactsCount; + this.createdAt = builder.createdAt; + this.name = builder.name; + this.parentListId = builder.parentListId; + this.sampleUpdatedAt = builder.sampleUpdatedAt; + this.updatedAt = builder.updatedAt; + this.nextSampleUpdate = builder.nextSampleUpdate; + this.contactsSample = builder.contactsSample; + this.queryJson = builder.queryJson; + this.parentListIds = builder.parentListIds; + this.queryDsl = builder.queryDsl; + } + + // Builder class for constructing object + public static class Builder { + + private UUID id; + private Integer contactsCount; + private OffsetDateTime createdAt; + private String name; + private UUID parentListId; + private OffsetDateTime sampleUpdatedAt; + private OffsetDateTime updatedAt; + private String nextSampleUpdate; + private List contactsSample; + private Object queryJson; + private List parentListIds; + private String queryDsl; + + public Builder( + UUID id, + Integer contactsCount, + OffsetDateTime createdAt, + String name, + OffsetDateTime sampleUpdatedAt, + OffsetDateTime updatedAt, + List contactsSample, + String queryDsl + ) { + this.id = id; + this.contactsCount = contactsCount; + this.createdAt = createdAt; + this.name = name; + this.sampleUpdatedAt = sampleUpdatedAt; + this.updatedAt = updatedAt; + this.contactsSample = contactsSample; + this.queryDsl = queryDsl; + } + + public Builder parentListId(UUID parentListId) { + this.parentListId = parentListId; + return this; + } + + public Builder nextSampleUpdate(String nextSampleUpdate) { + this.nextSampleUpdate = nextSampleUpdate; + return this; + } + + public Builder queryJson(Object queryJson) { + this.queryJson = queryJson; + return this; + } + + public Builder parentListIds(List parentListIds) { + this.parentListIds = parentListIds; + return this; + } + + public FullSegment build() { + return new FullSegment(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + FullSegment.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (contactsCount != null) joiner.add("contactsCount=" + contactsCount); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (name != null) joiner.add("name=" + name); + if (parentListId != null) joiner.add("parentListId=" + parentListId); + if (sampleUpdatedAt != null) joiner.add( + "sampleUpdatedAt=" + sampleUpdatedAt + ); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (nextSampleUpdate != null) joiner.add( + "nextSampleUpdate=" + nextSampleUpdate + ); + if (contactsSample != null) joiner.add( + "contactsSample=" + contactsSample + ); + if (queryJson != null) joiner.add("queryJson=" + queryJson); + if (parentListIds != null) joiner.add("parentListIds=" + parentListIds); + if (queryDsl != null) joiner.add("queryDsl=" + queryDsl); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/GetSegment404Response.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/GetSegment404Response.java new file mode 100644 index 00000000..663fd61c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/GetSegment404Response.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments API + * This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + * + * 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.mcsegments.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsegments.models.GetSegment404ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetSegment404Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public GetSegment404Response() {} + + private GetSegment404Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder(List errors) { + this.errors = errors; + } + + public GetSegment404Response build() { + return new GetSegment404Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetSegment404Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/GetSegment404ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/GetSegment404ResponseErrorsInner.java new file mode 100644 index 00000000..df7fdebf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/GetSegment404ResponseErrorsInner.java @@ -0,0 +1,72 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments API + * This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + * + * 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.mcsegments.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetSegment404ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + public GetSegment404ResponseErrorsInner() {} + + private GetSegment404ResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + + public Builder(String message, String field) { + this.message = message; + this.field = field; + } + + public GetSegment404ResponseErrorsInner build() { + return new GetSegment404ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetSegment404ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ListSegment200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ListSegment200Response.java new file mode 100644 index 00000000..c84df2c9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ListSegment200Response.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments API + * This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + * + * 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.mcsegments.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsegments.models.SegmentSummary; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListSegment200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("results") + @Getter + @Setter + private List results; + + public ListSegment200Response() {} + + private ListSegment200Response(Builder builder) { + this.results = builder.results; + } + + // Builder class for constructing object + public static class Builder { + + private List results; + + public Builder(List results) { + this.results = results; + } + + public ListSegment200Response build() { + return new ListSegment200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListSegment200Response.class.getSimpleName() + "(", + ")" + ); + if (results != null) joiner.add("results=" + results); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ListSegment500Response.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ListSegment500Response.java new file mode 100644 index 00000000..cef63b1c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ListSegment500Response.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments API + * This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + * + * 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.mcsegments.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsegments.models.ListSegment500ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListSegment500Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ListSegment500Response() {} + + private ListSegment500Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder(List errors) { + this.errors = errors; + } + + public ListSegment500Response build() { + return new ListSegment500Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListSegment500Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ListSegment500ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ListSegment500ResponseErrorsInner.java new file mode 100644 index 00000000..fca28e5f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/ListSegment500ResponseErrorsInner.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments API + * This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + * + * 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.mcsegments.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListSegment500ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public ListSegment500ResponseErrorsInner() {} + + private ListSegment500ResponseErrorsInner(Builder builder) { + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + + public Builder(String message) { + this.message = message; + } + + public ListSegment500ResponseErrorsInner build() { + return new ListSegment500ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListSegment500ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/SegmentSummary.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/SegmentSummary.java new file mode 100644 index 00000000..30da4ae9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/SegmentSummary.java @@ -0,0 +1,156 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments API + * This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + * + * 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.mcsegments.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SegmentSummary { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private UUID id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("contacts_count") + @Getter + @Setter + private Integer contactsCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private OffsetDateTime createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("parent_list_id") + @Getter + @Setter + private UUID parentListId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sample_updated_at") + @Getter + @Setter + private OffsetDateTime sampleUpdatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private OffsetDateTime updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next_sample_update") + @Getter + @Setter + private String nextSampleUpdate; + + public SegmentSummary() {} + + private SegmentSummary(Builder builder) { + this.id = builder.id; + this.contactsCount = builder.contactsCount; + this.createdAt = builder.createdAt; + this.name = builder.name; + this.parentListId = builder.parentListId; + this.sampleUpdatedAt = builder.sampleUpdatedAt; + this.updatedAt = builder.updatedAt; + this.nextSampleUpdate = builder.nextSampleUpdate; + } + + // Builder class for constructing object + public static class Builder { + + private UUID id; + private Integer contactsCount; + private OffsetDateTime createdAt; + private String name; + private UUID parentListId; + private OffsetDateTime sampleUpdatedAt; + private OffsetDateTime updatedAt; + private String nextSampleUpdate; + + public Builder( + UUID id, + Integer contactsCount, + OffsetDateTime createdAt, + OffsetDateTime sampleUpdatedAt, + OffsetDateTime updatedAt + ) { + this.id = id; + this.contactsCount = contactsCount; + this.createdAt = createdAt; + this.sampleUpdatedAt = sampleUpdatedAt; + this.updatedAt = updatedAt; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder parentListId(UUID parentListId) { + this.parentListId = parentListId; + return this; + } + + public Builder nextSampleUpdate(String nextSampleUpdate) { + this.nextSampleUpdate = nextSampleUpdate; + return this; + } + + public SegmentSummary build() { + return new SegmentSummary(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SegmentSummary.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (contactsCount != null) joiner.add("contactsCount=" + contactsCount); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (name != null) joiner.add("name=" + name); + if (parentListId != null) joiner.add("parentListId=" + parentListId); + if (sampleUpdatedAt != null) joiner.add( + "sampleUpdatedAt=" + sampleUpdatedAt + ); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (nextSampleUpdate != null) joiner.add( + "nextSampleUpdate=" + nextSampleUpdate + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/SegmentWriteV2.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/SegmentWriteV2.java new file mode 100644 index 00000000..7e1f6492 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments/models/SegmentWriteV2.java @@ -0,0 +1,87 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments API + * This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + * + * 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.mcsegments.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SegmentWriteV2 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("parent_list_ids") + @Getter + @Setter + private List parentListIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("query_dsl") + @Getter + @Setter + private String queryDsl; + + public SegmentWriteV2() {} + + private SegmentWriteV2(Builder builder) { + this.name = builder.name; + this.parentListIds = builder.parentListIds; + this.queryDsl = builder.queryDsl; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private List parentListIds; + private String queryDsl; + + public Builder(String name, String queryDsl) { + this.name = name; + this.queryDsl = queryDsl; + } + + public Builder parentListIds(List parentListIds) { + this.parentListIds = parentListIds; + return this; + } + + public SegmentWriteV2 build() { + return new SegmentWriteV2(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SegmentWriteV2.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (parentListIds != null) joiner.add("parentListIds=" + parentListIds); + if (queryDsl != null) joiner.add("queryDsl=" + queryDsl); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/CreateSegment.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/CreateSegment.java new file mode 100644 index 00000000..96d3fab7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/CreateSegment.java @@ -0,0 +1,105 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2; + +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.mcsegments2.models.ErrorsSegmentV2; +import com.sendgrid.rest.api.v3.mcsegments2.models.Segment2xx; +import com.sendgrid.rest.api.v3.mcsegments2.models.SegmentWriteV2; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateSegment extends ApiKeyBase { + + @Setter + private SegmentWriteV2 segmentWriteV2; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/segments/2.0"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "CreateSegment 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")) { + ErrorsSegmentV2 error = JsonUtil.fromJson( + response.getStream(), + ErrorsSegmentV2.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ErrorsSegmentV2 error = JsonUtil.fromJson( + response.getStream(), + ErrorsSegmentV2.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 addBody(final Request request) { + if (segmentWriteV2 != null) { + request.addBody(JsonUtil.toJson(segmentWriteV2)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/DeleteSegment.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/DeleteSegment.java new file mode 100644 index 00000000..8149224b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/DeleteSegment.java @@ -0,0 +1,101 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2; + +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.mcsegments2.models.ErrorsSegmentV2; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DeleteSegment extends ApiKeyBase { + + private final String segmentId; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/segments/2.0/{segment_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSegment 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")) { + ErrorsSegmentV2 error = JsonUtil.fromJson( + response.getStream(), + ErrorsSegmentV2.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ErrorsSegmentV2 error = JsonUtil.fromJson( + response.getStream(), + ErrorsSegmentV2.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 (segmentId != null) { + request.addPathParam("segment_id", segmentId.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/GetSegment.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/GetSegment.java new file mode 100644 index 00000000..cbd40e75 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/GetSegment.java @@ -0,0 +1,117 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2; + +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.mcsegments2.models.ErrorsSegmentV2; +import com.sendgrid.rest.api.v3.mcsegments2.models.Segment2xx; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetSegment extends ApiKeyBase { + + private final String segmentId; + + @Setter + private Boolean contactsSample; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/segments/2.0/{segment_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetSegment 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")) { + ErrorsSegmentV2 error = JsonUtil.fromJson( + response.getStream(), + ErrorsSegmentV2.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ErrorsSegmentV2 error = JsonUtil.fromJson( + response.getStream(), + ErrorsSegmentV2.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(), Segment2xx.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (segmentId != null) { + request.addPathParam("segment_id", segmentId.toString()); + } + } + + private void addQueryParams(Request request) { + if (contactsSample != null) { + request.addQueryParam("contacts_sample", contactsSample.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/ListSegment.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/ListSegment.java new file mode 100644 index 00000000..4c7cc4cb --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/ListSegment.java @@ -0,0 +1,120 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2; + +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.mcsegments2.models.AllSegments200; +import com.sendgrid.rest.api.v3.mcsegments2.models.ErrorsSegmentV2; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSegment extends ApiKeyBase { + + @Setter + private List ids; + + @Setter + private String parentListIds; + + @Setter + private Boolean noParentListId; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/segments/2.0"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSegment 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")) { + ErrorsSegmentV2 error = JsonUtil.fromJson( + response.getStream(), + ErrorsSegmentV2.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ErrorsSegmentV2 error = JsonUtil.fromJson( + response.getStream(), + ErrorsSegmentV2.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 addQueryParams(Request request) { + if (ids != null) { + request.addQueryParam("ids", ids.toString()); + } + if (parentListIds != null) { + request.addQueryParam("parent_list_ids", parentListIds.toString()); + } + if (noParentListId != null) { + request.addQueryParam( + "no_parent_list_id", + noParentListId.toString() + ); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/RefreshSegment.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/RefreshSegment.java new file mode 100644 index 00000000..da08d047 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/RefreshSegment.java @@ -0,0 +1,116 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2; + +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.mcsegments2.models.SegmentError; +import com.sendgrid.rest.api.v3.mcsegments2.models.SegmentRefresh202; +import com.sendgrid.rest.api.v3.mcsegments2.models.SegmentRefreshRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.UUID; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class RefreshSegment extends ApiKeyBase { + + private final UUID segmentId; + + @Setter + private SegmentRefreshRequest segmentRefreshRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/segments/2.0/refresh/{segment_id}"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "RefreshSegment creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + SegmentError error = JsonUtil.fromJson( + response.getStream(), + SegmentError.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + SegmentError error = JsonUtil.fromJson( + response.getStream(), + SegmentError.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 (segmentId != null) { + request.addPathParam("segment_id", segmentId.toString()); + } + } + + private void addBody(final Request request) { + if (segmentRefreshRequest != null) { + request.addBody(JsonUtil.toJson(segmentRefreshRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/UpdateSegment.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/UpdateSegment.java new file mode 100644 index 00000000..d5b89f4b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/UpdateSegment.java @@ -0,0 +1,114 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2; + +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.mcsegments2.models.ErrorsSegmentV2; +import com.sendgrid.rest.api.v3.mcsegments2.models.Segment2xx; +import com.sendgrid.rest.api.v3.mcsegments2.models.SegmentUpdate; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateSegment extends ApiKeyBase { + + private final String segmentId; + + @Setter + private SegmentUpdate segmentUpdate; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/segments/2.0/{segment_id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateSegment 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")) { + ErrorsSegmentV2 error = JsonUtil.fromJson( + response.getStream(), + ErrorsSegmentV2.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ErrorsSegmentV2 error = JsonUtil.fromJson( + response.getStream(), + ErrorsSegmentV2.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 (segmentId != null) { + request.addPathParam("segment_id", segmentId.toString()); + } + } + + private void addBody(final Request request) { + if (segmentUpdate != null) { + request.addBody(JsonUtil.toJson(segmentUpdate)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/AllSegments200.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/AllSegments200.java new file mode 100644 index 00000000..77ffadce --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/AllSegments200.java @@ -0,0 +1,185 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsegments2.models.Metadata; +import com.sendgrid.rest.api.v3.mcsegments2.models.SegmentStatusResponse; +import java.util.List; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AllSegments200 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private UUID id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("contacts_count") + @Getter + @Setter + private Integer contactsCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private String createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private String updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sample_updated_at") + @Getter + @Setter + private String sampleUpdatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next_sample_update") + @Getter + @Setter + private String nextSampleUpdate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("parent_list_ids") + @Getter + @Setter + private List parentListIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("query_version") + @Getter + @Setter + private String queryVersion; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private Metadata metadata; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private SegmentStatusResponse status; + + public AllSegments200() {} + + private AllSegments200(Builder builder) { + this.id = builder.id; + this.name = builder.name; + this.contactsCount = builder.contactsCount; + this.createdAt = builder.createdAt; + this.updatedAt = builder.updatedAt; + this.sampleUpdatedAt = builder.sampleUpdatedAt; + this.nextSampleUpdate = builder.nextSampleUpdate; + this.parentListIds = builder.parentListIds; + this.queryVersion = builder.queryVersion; + this.metadata = builder.metadata; + this.status = builder.status; + } + + // Builder class for constructing object + public static class Builder { + + private UUID id; + private String name; + private Integer contactsCount; + private String createdAt; + private String updatedAt; + private String sampleUpdatedAt; + private String nextSampleUpdate; + private List parentListIds; + private String queryVersion; + private Metadata metadata; + private SegmentStatusResponse status; + + public Builder( + UUID id, + String name, + Integer contactsCount, + String createdAt, + String updatedAt, + String sampleUpdatedAt, + String nextSampleUpdate, + List parentListIds, + String queryVersion, + SegmentStatusResponse status + ) { + this.id = id; + this.name = name; + this.contactsCount = contactsCount; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.sampleUpdatedAt = sampleUpdatedAt; + this.nextSampleUpdate = nextSampleUpdate; + this.parentListIds = parentListIds; + this.queryVersion = queryVersion; + this.status = status; + } + + public Builder metadata(Metadata metadata) { + this.metadata = metadata; + return this; + } + + public AllSegments200 build() { + return new AllSegments200(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AllSegments200.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (name != null) joiner.add("name=" + name); + if (contactsCount != null) joiner.add("contactsCount=" + contactsCount); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (sampleUpdatedAt != null) joiner.add( + "sampleUpdatedAt=" + sampleUpdatedAt + ); + if (nextSampleUpdate != null) joiner.add( + "nextSampleUpdate=" + nextSampleUpdate + ); + if (parentListIds != null) joiner.add("parentListIds=" + parentListIds); + if (queryVersion != null) joiner.add("queryVersion=" + queryVersion); + if (metadata != null) joiner.add("metadata=" + metadata); + if (status != null) joiner.add("status=" + status); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/ContactResponse.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/ContactResponse.java new file mode 100644 index 00000000..bd08df9f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/ContactResponse.java @@ -0,0 +1,265 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsegments2.models.ContactResponseCustomFields; +import java.util.List; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private UUID id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("phone_number_id") + @Getter + @Setter + private String phoneNumberId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("external_id") + @Getter + @Setter + private String externalId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("anonymous_id") + @Getter + @Setter + private String anonymousId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("alternate_emails") + @Getter + @Setter + private List alternateEmails; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_line_1") + @Getter + @Setter + private String addressLine1; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_line_2") + @Getter + @Setter + private String addressLine2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city") + @Getter + @Setter + private String city; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state_province_region") + @Getter + @Setter + private String stateProvinceRegion; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("postal_code") + @Getter + @Setter + private Integer postalCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country") + @Getter + @Setter + private String country; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list_ids") + @Getter + @Setter + private List listIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_fields") + @Getter + @Setter + private ContactResponseCustomFields customFields; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("segment_ids") + @Getter + @Setter + private List segmentIds; + + public ContactResponse() {} + + private ContactResponse(Builder builder) { + this.id = builder.id; + this.email = builder.email; + this.phoneNumberId = builder.phoneNumberId; + this.externalId = builder.externalId; + this.anonymousId = builder.anonymousId; + this.alternateEmails = builder.alternateEmails; + this.firstName = builder.firstName; + this.lastName = builder.lastName; + this.addressLine1 = builder.addressLine1; + this.addressLine2 = builder.addressLine2; + this.city = builder.city; + this.stateProvinceRegion = builder.stateProvinceRegion; + this.postalCode = builder.postalCode; + this.country = builder.country; + this.listIds = builder.listIds; + this.customFields = builder.customFields; + this.segmentIds = builder.segmentIds; + } + + // Builder class for constructing object + public static class Builder { + + private UUID id; + private String email; + private String phoneNumberId; + private String externalId; + private String anonymousId; + private List alternateEmails; + private String firstName; + private String lastName; + private String addressLine1; + private String addressLine2; + private String city; + private String stateProvinceRegion; + private Integer postalCode; + private String country; + private List listIds; + private ContactResponseCustomFields customFields; + private List segmentIds; + + public Builder( + UUID id, + List alternateEmails, + String firstName, + String lastName, + String addressLine1, + String addressLine2, + String city, + String stateProvinceRegion, + Integer postalCode, + String country, + ContactResponseCustomFields customFields + ) { + this.id = id; + this.alternateEmails = alternateEmails; + this.firstName = firstName; + this.lastName = lastName; + this.addressLine1 = addressLine1; + this.addressLine2 = addressLine2; + this.city = city; + this.stateProvinceRegion = stateProvinceRegion; + this.postalCode = postalCode; + this.country = country; + this.customFields = customFields; + } + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder phoneNumberId(String phoneNumberId) { + this.phoneNumberId = phoneNumberId; + return this; + } + + public Builder externalId(String externalId) { + this.externalId = externalId; + return this; + } + + public Builder anonymousId(String anonymousId) { + this.anonymousId = anonymousId; + return this; + } + + public Builder listIds(List listIds) { + this.listIds = listIds; + return this; + } + + public Builder segmentIds(List segmentIds) { + this.segmentIds = segmentIds; + return this; + } + + public ContactResponse build() { + return new ContactResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactResponse.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (email != null) joiner.add("email=" + email); + if (phoneNumberId != null) joiner.add("phoneNumberId=" + phoneNumberId); + if (externalId != null) joiner.add("externalId=" + externalId); + if (anonymousId != null) joiner.add("anonymousId=" + anonymousId); + if (alternateEmails != null) joiner.add( + "alternateEmails=" + alternateEmails + ); + if (firstName != null) joiner.add("firstName=" + firstName); + if (lastName != null) joiner.add("lastName=" + lastName); + if (addressLine1 != null) joiner.add("addressLine1=" + addressLine1); + if (addressLine2 != null) joiner.add("addressLine2=" + addressLine2); + if (city != null) joiner.add("city=" + city); + if (stateProvinceRegion != null) joiner.add( + "stateProvinceRegion=" + stateProvinceRegion + ); + if (postalCode != null) joiner.add("postalCode=" + postalCode); + if (country != null) joiner.add("country=" + country); + if (listIds != null) joiner.add("listIds=" + listIds); + if (customFields != null) joiner.add("customFields=" + customFields); + if (segmentIds != null) joiner.add("segmentIds=" + segmentIds); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/ContactResponseCustomFields.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/ContactResponseCustomFields.java new file mode 100644 index 00000000..b61015c6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/ContactResponseCustomFields.java @@ -0,0 +1,83 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ContactResponseCustomFields { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_field_name1") + @Getter + @Setter + private String customFieldName1; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_field_name2") + @Getter + @Setter + private String customFieldName2; + + public ContactResponseCustomFields() {} + + private ContactResponseCustomFields(Builder builder) { + this.customFieldName1 = builder.customFieldName1; + this.customFieldName2 = builder.customFieldName2; + } + + // Builder class for constructing object + public static class Builder { + + private String customFieldName1; + private String customFieldName2; + + public Builder() {} + + public Builder customFieldName1(String customFieldName1) { + this.customFieldName1 = customFieldName1; + return this; + } + + public Builder customFieldName2(String customFieldName2) { + this.customFieldName2 = customFieldName2; + return this; + } + + public ContactResponseCustomFields build() { + return new ContactResponseCustomFields(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ContactResponseCustomFields.class.getSimpleName() + "(", + ")" + ); + if (customFieldName1 != null) joiner.add( + "customFieldName1=" + customFieldName1 + ); + if (customFieldName2 != null) joiner.add( + "customFieldName2=" + customFieldName2 + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/ErrorsSegmentV2.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/ErrorsSegmentV2.java new file mode 100644 index 00000000..c535eafd --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/ErrorsSegmentV2.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsegments2.models.ErrorsSegmentV2ErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorsSegmentV2 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ErrorsSegmentV2() {} + + private ErrorsSegmentV2(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder(List errors) { + this.errors = errors; + } + + public ErrorsSegmentV2 build() { + return new ErrorsSegmentV2(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorsSegmentV2.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/ErrorsSegmentV2ErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/ErrorsSegmentV2ErrorsInner.java new file mode 100644 index 00000000..1eedc37f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/ErrorsSegmentV2ErrorsInner.java @@ -0,0 +1,72 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorsSegmentV2ErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public ErrorsSegmentV2ErrorsInner() {} + + private ErrorsSegmentV2ErrorsInner(Builder builder) { + this.field = builder.field; + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String field; + private String message; + + public Builder(String field, String message) { + this.field = field; + this.message = message; + } + + public ErrorsSegmentV2ErrorsInner build() { + return new ErrorsSegmentV2ErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorsSegmentV2ErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (field != null) joiner.add("field=" + field); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/Metadata.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/Metadata.java new file mode 100644 index 00000000..24d9127f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/Metadata.java @@ -0,0 +1,108 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.net.URI; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Metadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("prev") + @Getter + @Setter + private URI prev; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("self") + @Getter + @Setter + private URI self; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next") + @Getter + @Setter + private URI next; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("count") + @Getter + @Setter + private Integer count; + + public Metadata() {} + + private Metadata(Builder builder) { + this.prev = builder.prev; + this.self = builder.self; + this.next = builder.next; + this.count = builder.count; + } + + // Builder class for constructing object + public static class Builder { + + private URI prev; + private URI self; + private URI next; + private Integer count; + + public Builder() {} + + public Builder prev(URI prev) { + this.prev = prev; + return this; + } + + public Builder self(URI self) { + this.self = self; + return this; + } + + public Builder next(URI next) { + this.next = next; + return this; + } + + public Builder count(Integer count) { + this.count = count; + return this; + } + + public Metadata build() { + return new Metadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Metadata.class.getSimpleName() + "(", + ")" + ); + if (prev != null) joiner.add("prev=" + prev); + if (self != null) joiner.add("self=" + self); + if (next != null) joiner.add("next=" + next); + if (count != null) joiner.add("count=" + count); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/Segment2xx.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/Segment2xx.java new file mode 100644 index 00000000..b49a7855 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/Segment2xx.java @@ -0,0 +1,239 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsegments2.models.ContactResponse; +import com.sendgrid.rest.api.v3.mcsegments2.models.SegmentStatusResponse; +import java.util.List; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Segment2xx { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private UUID id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("query_dsl") + @Getter + @Setter + private String queryDsl; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("contacts_count") + @Getter + @Setter + private Integer contactsCount; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("contacts_sample") + @Getter + @Setter + private List contactsSample; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private String createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private String updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sample_updated_at") + @Getter + @Setter + private String sampleUpdatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next_sample_update") + @Getter + @Setter + private String nextSampleUpdate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("parent_list_ids") + @Getter + @Setter + private List parentListIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("query_version") + @Getter + @Setter + private String queryVersion; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private SegmentStatusResponse status; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("refreshes_used") + @Getter + @Setter + private Integer refreshesUsed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("max_refreshes") + @Getter + @Setter + private Integer maxRefreshes; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_refreshed_at") + @Getter + @Setter + private String lastRefreshedAt; + + public Segment2xx() {} + + private Segment2xx(Builder builder) { + this.id = builder.id; + this.name = builder.name; + this.queryDsl = builder.queryDsl; + this.contactsCount = builder.contactsCount; + this.contactsSample = builder.contactsSample; + this.createdAt = builder.createdAt; + this.updatedAt = builder.updatedAt; + this.sampleUpdatedAt = builder.sampleUpdatedAt; + this.nextSampleUpdate = builder.nextSampleUpdate; + this.parentListIds = builder.parentListIds; + this.queryVersion = builder.queryVersion; + this.status = builder.status; + this.refreshesUsed = builder.refreshesUsed; + this.maxRefreshes = builder.maxRefreshes; + this.lastRefreshedAt = builder.lastRefreshedAt; + } + + // Builder class for constructing object + public static class Builder { + + private UUID id; + private String name; + private String queryDsl; + private Integer contactsCount; + private List contactsSample; + private String createdAt; + private String updatedAt; + private String sampleUpdatedAt; + private String nextSampleUpdate; + private List parentListIds; + private String queryVersion; + private SegmentStatusResponse status; + private Integer refreshesUsed; + private Integer maxRefreshes; + private String lastRefreshedAt; + + public Builder( + UUID id, + String name, + String queryDsl, + Integer contactsCount, + List contactsSample, + String createdAt, + String updatedAt, + String sampleUpdatedAt, + String nextSampleUpdate, + List parentListIds, + String queryVersion, + SegmentStatusResponse status + ) { + this.id = id; + this.name = name; + this.queryDsl = queryDsl; + this.contactsCount = contactsCount; + this.contactsSample = contactsSample; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.sampleUpdatedAt = sampleUpdatedAt; + this.nextSampleUpdate = nextSampleUpdate; + this.parentListIds = parentListIds; + this.queryVersion = queryVersion; + this.status = status; + } + + public Builder refreshesUsed(Integer refreshesUsed) { + this.refreshesUsed = refreshesUsed; + return this; + } + + public Builder maxRefreshes(Integer maxRefreshes) { + this.maxRefreshes = maxRefreshes; + return this; + } + + public Builder lastRefreshedAt(String lastRefreshedAt) { + this.lastRefreshedAt = lastRefreshedAt; + return this; + } + + public Segment2xx build() { + return new Segment2xx(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Segment2xx.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (name != null) joiner.add("name=" + name); + if (queryDsl != null) joiner.add("queryDsl=" + queryDsl); + if (contactsCount != null) joiner.add("contactsCount=" + contactsCount); + if (contactsSample != null) joiner.add( + "contactsSample=" + contactsSample + ); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (sampleUpdatedAt != null) joiner.add( + "sampleUpdatedAt=" + sampleUpdatedAt + ); + if (nextSampleUpdate != null) joiner.add( + "nextSampleUpdate=" + nextSampleUpdate + ); + if (parentListIds != null) joiner.add("parentListIds=" + parentListIds); + if (queryVersion != null) joiner.add("queryVersion=" + queryVersion); + if (status != null) joiner.add("status=" + status); + if (refreshesUsed != null) joiner.add("refreshesUsed=" + refreshesUsed); + if (maxRefreshes != null) joiner.add("maxRefreshes=" + maxRefreshes); + if (lastRefreshedAt != null) joiner.add( + "lastRefreshedAt=" + lastRefreshedAt + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentError.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentError.java new file mode 100644 index 00000000..c20e16c7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentError.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SegmentError { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error") + @Getter + @Setter + private String error; + + public SegmentError() {} + + private SegmentError(Builder builder) { + this.error = builder.error; + } + + // Builder class for constructing object + public static class Builder { + + private String error; + + public Builder(String error) { + this.error = error; + } + + public SegmentError build() { + return new SegmentError(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SegmentError.class.getSimpleName() + "(", + ")" + ); + if (error != null) joiner.add("error=" + error); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentRefresh202.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentRefresh202.java new file mode 100644 index 00000000..7c8c3e74 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentRefresh202.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SegmentRefresh202 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("job_id") + @Getter + @Setter + private String jobId; + + public SegmentRefresh202() {} + + private SegmentRefresh202(Builder builder) { + this.jobId = builder.jobId; + } + + // Builder class for constructing object + public static class Builder { + + private String jobId; + + public Builder() {} + + public Builder jobId(String jobId) { + this.jobId = jobId; + return this; + } + + public SegmentRefresh202 build() { + return new SegmentRefresh202(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SegmentRefresh202.class.getSimpleName() + "(", + ")" + ); + if (jobId != null) joiner.add("jobId=" + jobId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentRefreshRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentRefreshRequest.java new file mode 100644 index 00000000..1342e359 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentRefreshRequest.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SegmentRefreshRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("user_time_zone") + @Getter + @Setter + private String userTimeZone; + + public SegmentRefreshRequest() {} + + private SegmentRefreshRequest(Builder builder) { + this.userTimeZone = builder.userTimeZone; + } + + // Builder class for constructing object + public static class Builder { + + private String userTimeZone; + + public Builder(String userTimeZone) { + this.userTimeZone = userTimeZone; + } + + public SegmentRefreshRequest build() { + return new SegmentRefreshRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SegmentRefreshRequest.class.getSimpleName() + "(", + ")" + ); + if (userTimeZone != null) joiner.add("userTimeZone=" + userTimeZone); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentStatusResponse.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentStatusResponse.java new file mode 100644 index 00000000..67073ad5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentStatusResponse.java @@ -0,0 +1,78 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SegmentStatusResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("query_validation") + @Getter + @Setter + private String queryValidation; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_message") + @Getter + @Setter + private String errorMessage; + + public SegmentStatusResponse() {} + + private SegmentStatusResponse(Builder builder) { + this.queryValidation = builder.queryValidation; + this.errorMessage = builder.errorMessage; + } + + // Builder class for constructing object + public static class Builder { + + private String queryValidation; + private String errorMessage; + + public Builder(String queryValidation) { + this.queryValidation = queryValidation; + } + + public Builder errorMessage(String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + public SegmentStatusResponse build() { + return new SegmentStatusResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SegmentStatusResponse.class.getSimpleName() + "(", + ")" + ); + if (queryValidation != null) joiner.add( + "queryValidation=" + queryValidation + ); + if (errorMessage != null) joiner.add("errorMessage=" + errorMessage); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentUpdate.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentUpdate.java new file mode 100644 index 00000000..fbb5a9fd --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentUpdate.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SegmentUpdate { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("query_dsl") + @Getter + @Setter + private String queryDsl; + + public SegmentUpdate() {} + + private SegmentUpdate(Builder builder) { + this.name = builder.name; + this.queryDsl = builder.queryDsl; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private String queryDsl; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder queryDsl(String queryDsl) { + this.queryDsl = queryDsl; + return this; + } + + public SegmentUpdate build() { + return new SegmentUpdate(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SegmentUpdate.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (queryDsl != null) joiner.add("queryDsl=" + queryDsl); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentWriteV2.java b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentWriteV2.java new file mode 100644 index 00000000..ac7885a8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsegments2/models/SegmentWriteV2.java @@ -0,0 +1,87 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Segments 2.0 API + * The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + * + * 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.mcsegments2.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SegmentWriteV2 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("parent_list_ids") + @Getter + @Setter + private List parentListIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("query_dsl") + @Getter + @Setter + private String queryDsl; + + public SegmentWriteV2() {} + + private SegmentWriteV2(Builder builder) { + this.name = builder.name; + this.parentListIds = builder.parentListIds; + this.queryDsl = builder.queryDsl; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private List parentListIds; + private String queryDsl; + + public Builder(String name, String queryDsl) { + this.name = name; + this.queryDsl = queryDsl; + } + + public Builder parentListIds(List parentListIds) { + this.parentListIds = parentListIds; + return this; + } + + public SegmentWriteV2 build() { + return new SegmentWriteV2(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SegmentWriteV2.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (parentListIds != null) joiner.add("parentListIds=" + parentListIds); + if (queryDsl != null) joiner.add("queryDsl=" + queryDsl); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsenders/CreateSender.java b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/CreateSender.java new file mode 100644 index 00000000..2642ded3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/CreateSender.java @@ -0,0 +1,145 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Senders API + * The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + * + * 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.mcsenders; + +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.mcsenders.models.CreateSenderRequest; +import com.sendgrid.rest.api.v3.mcsenders.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mcsenders.models.Sender; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateSender extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private CreateSenderRequest createSenderRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/senders"; + 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( + "CreateSender 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), Sender.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (createSenderRequest != null) { + request.addBody(JsonUtil.toJson(createSenderRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsenders/DeleteSender.java b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/DeleteSender.java new file mode 100644 index 00000000..605e1e56 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/DeleteSender.java @@ -0,0 +1,112 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Senders API + * The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + * + * 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.mcsenders; + +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.mcsenders.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteSender extends ApiKeyBase { + + private final Integer id; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/senders/{id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSender creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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 (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsenders/GetSender.java b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/GetSender.java new file mode 100644 index 00000000..8d155013 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/GetSender.java @@ -0,0 +1,104 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Senders API + * The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + * + * 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.mcsenders; + +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.mcsenders.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mcsenders.models.Sender; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetSender extends ApiKeyBase { + + private final Integer id; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/senders/{id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetSender creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), Sender.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsenders/ListSender.java b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/ListSender.java new file mode 100644 index 00000000..caf8b287 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/ListSender.java @@ -0,0 +1,100 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Senders API + * The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + * + * 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.mcsenders; + +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.mcsenders.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mcsenders.models.ListSender200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSender extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/senders"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSender creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + ListSender200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsenders/ResetSenderVerification.java b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/ResetSenderVerification.java new file mode 100644 index 00000000..b807d88b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/ResetSenderVerification.java @@ -0,0 +1,112 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Senders API + * The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + * + * 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.mcsenders; + +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.mcsenders.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ResetSenderVerification extends ApiKeyBase { + + private final Integer id; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/senders/{id}/resend_verification"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ResetSenderVerification 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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 (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsenders/UpdateSender.java b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/UpdateSender.java new file mode 100644 index 00000000..aed31f9a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/UpdateSender.java @@ -0,0 +1,141 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Senders API + * The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + * + * 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.mcsenders; + +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.mcsenders.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mcsenders.models.Sender; +import com.sendgrid.rest.api.v3.mcsenders.models.SenderRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateSender extends ApiKeyBase { + + private final Integer id; + + @Setter + private String onBehalfOf; + + @Setter + private SenderRequest senderRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/senders/{id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateSender 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), Sender.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (senderRequest != null) { + request.addBody(JsonUtil.toJson(senderRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/CreateSenderRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/CreateSenderRequest.java new file mode 100644 index 00000000..9ba10ff6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/CreateSenderRequest.java @@ -0,0 +1,163 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Senders API + * The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + * + * 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.mcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsenders.models.CreateSenderRequestFrom; +import com.sendgrid.rest.api.v3.mcsenders.models.CreateSenderRequestReplyTo; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateSenderRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("nickname") + @Getter + @Setter + private String nickname; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("from") + @Getter + @Setter + private CreateSenderRequestFrom from; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reply_to") + @Getter + @Setter + private CreateSenderRequestReplyTo replyTo; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address") + @Getter + @Setter + private String address; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_2") + @Getter + @Setter + private String address2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city") + @Getter + @Setter + private String city; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state") + @Getter + @Setter + private String state; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("zip") + @Getter + @Setter + private String zip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country") + @Getter + @Setter + private String country; + + public CreateSenderRequest() {} + + private CreateSenderRequest(Builder builder) { + this.nickname = builder.nickname; + this.from = builder.from; + this.replyTo = builder.replyTo; + this.address = builder.address; + this.address2 = builder.address2; + this.city = builder.city; + this.state = builder.state; + this.zip = builder.zip; + this.country = builder.country; + } + + // Builder class for constructing object + public static class Builder { + + private String nickname; + private CreateSenderRequestFrom from; + private CreateSenderRequestReplyTo replyTo; + private String address; + private String address2; + private String city; + private String state; + private String zip; + private String country; + + public Builder( + String nickname, + CreateSenderRequestFrom from, + CreateSenderRequestReplyTo replyTo, + String address, + String city, + String country + ) { + this.nickname = nickname; + this.from = from; + this.replyTo = replyTo; + this.address = address; + this.city = city; + this.country = country; + } + + public Builder address2(String address2) { + this.address2 = address2; + return this; + } + + public Builder state(String state) { + this.state = state; + return this; + } + + public Builder zip(String zip) { + this.zip = zip; + return this; + } + + public CreateSenderRequest build() { + return new CreateSenderRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateSenderRequest.class.getSimpleName() + "(", + ")" + ); + if (nickname != null) joiner.add("nickname=" + nickname); + if (from != null) joiner.add("from=" + from); + if (replyTo != null) joiner.add("replyTo=" + replyTo); + if (address != null) joiner.add("address=" + address); + if (address2 != null) joiner.add("address2=" + address2); + if (city != null) joiner.add("city=" + city); + if (state != null) joiner.add("state=" + state); + if (zip != null) joiner.add("zip=" + zip); + if (country != null) joiner.add("country=" + country); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/CreateSenderRequestFrom.java b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/CreateSenderRequestFrom.java new file mode 100644 index 00000000..ccfa3463 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/CreateSenderRequestFrom.java @@ -0,0 +1,72 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Senders API + * The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + * + * 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.mcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateSenderRequestFrom { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public CreateSenderRequestFrom() {} + + private CreateSenderRequestFrom(Builder builder) { + this.email = builder.email; + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + private String name; + + public Builder(String email, String name) { + this.email = email; + this.name = name; + } + + public CreateSenderRequestFrom build() { + return new CreateSenderRequestFrom(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateSenderRequestFrom.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/CreateSenderRequestReplyTo.java b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/CreateSenderRequestReplyTo.java new file mode 100644 index 00000000..8354ea02 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/CreateSenderRequestReplyTo.java @@ -0,0 +1,76 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Senders API + * The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + * + * 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.mcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateSenderRequestReplyTo { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public CreateSenderRequestReplyTo() {} + + private CreateSenderRequestReplyTo(Builder builder) { + this.email = builder.email; + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + private String name; + + public Builder(String email) { + this.email = email; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public CreateSenderRequestReplyTo build() { + return new CreateSenderRequestReplyTo(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateSenderRequestReplyTo.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/ErrorResponse.java new file mode 100644 index 00000000..5886dc86 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Senders API + * The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + * + * 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.mcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsenders.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..6b3bb7df --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Senders API + * The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + * + * 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.mcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/ListSender200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/ListSender200Response.java new file mode 100644 index 00000000..3340b5db --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/ListSender200Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Senders API + * The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + * + * 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.mcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsenders.models.Sender; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListSender200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("results") + @Getter + @Setter + private List results; + + public ListSender200Response() {} + + private ListSender200Response(Builder builder) { + this.results = builder.results; + } + + // Builder class for constructing object + public static class Builder { + + private List results; + + public Builder() {} + + public Builder results(List results) { + this.results = results; + return this; + } + + public ListSender200Response build() { + return new ListSender200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListSender200Response.class.getSimpleName() + "(", + ")" + ); + if (results != null) joiner.add("results=" + results); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/Sender.java b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/Sender.java new file mode 100644 index 00000000..aa3939f5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/Sender.java @@ -0,0 +1,218 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Senders API + * The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + * + * 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.mcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsenders.models.CreateSenderRequestFrom; +import com.sendgrid.rest.api.v3.mcsenders.models.CreateSenderRequestReplyTo; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Sender { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("nickname") + @Getter + @Setter + private String nickname; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("from") + @Getter + @Setter + private CreateSenderRequestFrom from; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reply_to") + @Getter + @Setter + private CreateSenderRequestReplyTo replyTo; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address") + @Getter + @Setter + private String address; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_2") + @Getter + @Setter + private String address2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city") + @Getter + @Setter + private String city; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state") + @Getter + @Setter + private String state; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("zip") + @Getter + @Setter + private String zip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country") + @Getter + @Setter + private String country; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("verified") + @Getter + @Setter + private Boolean verified; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("locked") + @Getter + @Setter + private Boolean locked; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private Integer updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private Integer createdAt; + + public Sender() {} + + private Sender(Builder builder) { + this.id = builder.id; + this.nickname = builder.nickname; + this.from = builder.from; + this.replyTo = builder.replyTo; + this.address = builder.address; + this.address2 = builder.address2; + this.city = builder.city; + this.state = builder.state; + this.zip = builder.zip; + this.country = builder.country; + this.verified = builder.verified; + this.locked = builder.locked; + this.updatedAt = builder.updatedAt; + this.createdAt = builder.createdAt; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private String nickname; + private CreateSenderRequestFrom from; + private CreateSenderRequestReplyTo replyTo; + private String address; + private String address2; + private String city; + private String state; + private String zip; + private String country; + private Boolean verified; + private Boolean locked; + private Integer updatedAt; + private Integer createdAt; + + public Builder( + Integer id, + String nickname, + CreateSenderRequestFrom from, + CreateSenderRequestReplyTo replyTo, + String address, + String city, + String country, + Boolean verified, + Boolean locked, + Integer updatedAt, + Integer createdAt + ) { + this.id = id; + this.nickname = nickname; + this.from = from; + this.replyTo = replyTo; + this.address = address; + this.city = city; + this.country = country; + this.verified = verified; + this.locked = locked; + this.updatedAt = updatedAt; + this.createdAt = createdAt; + } + + public Builder address2(String address2) { + this.address2 = address2; + return this; + } + + public Builder state(String state) { + this.state = state; + return this; + } + + public Builder zip(String zip) { + this.zip = zip; + return this; + } + + public Sender build() { + return new Sender(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Sender.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (nickname != null) joiner.add("nickname=" + nickname); + if (from != null) joiner.add("from=" + from); + if (replyTo != null) joiner.add("replyTo=" + replyTo); + if (address != null) joiner.add("address=" + address); + if (address2 != null) joiner.add("address2=" + address2); + if (city != null) joiner.add("city=" + city); + if (state != null) joiner.add("state=" + state); + if (zip != null) joiner.add("zip=" + zip); + if (country != null) joiner.add("country=" + country); + if (verified != null) joiner.add("verified=" + verified); + if (locked != null) joiner.add("locked=" + locked); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/SenderRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/SenderRequest.java new file mode 100644 index 00000000..d6add534 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/SenderRequest.java @@ -0,0 +1,179 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Senders API + * The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + * + * 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.mcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsenders.models.SenderRequestFrom; +import com.sendgrid.rest.api.v3.mcsenders.models.SenderRequestReplyTo; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SenderRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("nickname") + @Getter + @Setter + private String nickname; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("from") + @Getter + @Setter + private SenderRequestFrom from; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reply_to") + @Getter + @Setter + private SenderRequestReplyTo replyTo; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address") + @Getter + @Setter + private String address; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_2") + @Getter + @Setter + private String address2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city") + @Getter + @Setter + private String city; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state") + @Getter + @Setter + private String state; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("zip") + @Getter + @Setter + private String zip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country") + @Getter + @Setter + private String country; + + public SenderRequest() {} + + private SenderRequest(Builder builder) { + this.nickname = builder.nickname; + this.from = builder.from; + this.replyTo = builder.replyTo; + this.address = builder.address; + this.address2 = builder.address2; + this.city = builder.city; + this.state = builder.state; + this.zip = builder.zip; + this.country = builder.country; + } + + // Builder class for constructing object + public static class Builder { + + private String nickname; + private SenderRequestFrom from; + private SenderRequestReplyTo replyTo; + private String address; + private String address2; + private String city; + private String state; + private String zip; + private String country; + + public Builder() {} + + public Builder nickname(String nickname) { + this.nickname = nickname; + return this; + } + + public Builder from(SenderRequestFrom from) { + this.from = from; + return this; + } + + public Builder replyTo(SenderRequestReplyTo replyTo) { + this.replyTo = replyTo; + return this; + } + + public Builder address(String address) { + this.address = address; + return this; + } + + public Builder address2(String address2) { + this.address2 = address2; + return this; + } + + public Builder city(String city) { + this.city = city; + return this; + } + + public Builder state(String state) { + this.state = state; + return this; + } + + public Builder zip(String zip) { + this.zip = zip; + return this; + } + + public Builder country(String country) { + this.country = country; + return this; + } + + public SenderRequest build() { + return new SenderRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SenderRequest.class.getSimpleName() + "(", + ")" + ); + if (nickname != null) joiner.add("nickname=" + nickname); + if (from != null) joiner.add("from=" + from); + if (replyTo != null) joiner.add("replyTo=" + replyTo); + if (address != null) joiner.add("address=" + address); + if (address2 != null) joiner.add("address2=" + address2); + if (city != null) joiner.add("city=" + city); + if (state != null) joiner.add("state=" + state); + if (zip != null) joiner.add("zip=" + zip); + if (country != null) joiner.add("country=" + country); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/SenderRequestFrom.java b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/SenderRequestFrom.java new file mode 100644 index 00000000..7ffce0aa --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/SenderRequestFrom.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Senders API + * The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + * + * 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.mcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SenderRequestFrom { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public SenderRequestFrom() {} + + private SenderRequestFrom(Builder builder) { + this.email = builder.email; + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + private String name; + + public Builder() {} + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public SenderRequestFrom build() { + return new SenderRequestFrom(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SenderRequestFrom.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/SenderRequestReplyTo.java b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/SenderRequestReplyTo.java new file mode 100644 index 00000000..0a01b38b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsenders/models/SenderRequestReplyTo.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Senders API + * The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + * + * 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.mcsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SenderRequestReplyTo { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public SenderRequestReplyTo() {} + + private SenderRequestReplyTo(Builder builder) { + this.email = builder.email; + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + private String name; + + public Builder() {} + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public SenderRequestReplyTo build() { + return new SenderRequestReplyTo(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SenderRequestReplyTo.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/CreateSingleSend.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/CreateSingleSend.java new file mode 100644 index 00000000..86ec1dc1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/CreateSingleSend.java @@ -0,0 +1,109 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends; + +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.mcsinglesends.models.ListSingleSend500Response; +import com.sendgrid.rest.api.v3.mcsinglesends.models.SinglesendRequest; +import com.sendgrid.rest.api.v3.mcsinglesends.models.SinglesendResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateSingleSend extends ApiKeyBase { + + @Setter + private SinglesendRequest singlesendRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/singlesends"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "CreateSingleSend 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")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.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(), SinglesendResponse.class), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (singlesendRequest != null) { + request.addBody(JsonUtil.toJson(singlesendRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/DeleteScheduledSingleSend.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/DeleteScheduledSingleSend.java new file mode 100644 index 00000000..b7a81e46 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/DeleteScheduledSingleSend.java @@ -0,0 +1,106 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends; + +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.mcsinglesends.models.ListSingleSend500Response; +import com.sendgrid.rest.api.v3.mcsinglesends.models.SinglesendSchedule; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DeleteScheduledSingleSend extends ApiKeyBase { + + private final String id; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/singlesends/{id}/schedule"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteScheduledSingleSend creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.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(), SinglesendSchedule.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/DeleteSingleSend.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/DeleteSingleSend.java new file mode 100644 index 00000000..a397fa74 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/DeleteSingleSend.java @@ -0,0 +1,101 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends; + +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.mcsinglesends.models.ListSingleSend500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DeleteSingleSend extends ApiKeyBase { + + private final String id; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/singlesends/{id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSingleSend creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.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 (id != null) { + request.addPathParam("id", id.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/DeleteSingleSends.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/DeleteSingleSends.java new file mode 100644 index 00000000..62d029af --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/DeleteSingleSends.java @@ -0,0 +1,104 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends; + +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.mcsinglesends.models.ListSingleSend500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteSingleSends extends ApiKeyBase { + + @Setter + private List ids; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/singlesends"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSingleSends creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.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 addQueryParams(Request request) { + if (ids != null) { + request.addQueryParam("ids", ids.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/DuplicateSingleSend.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/DuplicateSingleSend.java new file mode 100644 index 00000000..efd322bd --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/DuplicateSingleSend.java @@ -0,0 +1,118 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends; + +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.mcsinglesends.models.DuplicateSingleSendRequest; +import com.sendgrid.rest.api.v3.mcsinglesends.models.ListSingleSend500Response; +import com.sendgrid.rest.api.v3.mcsinglesends.models.SinglesendResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DuplicateSingleSend extends ApiKeyBase { + + private final String id; + + @Setter + private DuplicateSingleSendRequest duplicateSingleSendRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/singlesends/{id}"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DuplicateSingleSend creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.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(), SinglesendResponse.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addBody(final Request request) { + if (duplicateSingleSendRequest != null) { + request.addBody(JsonUtil.toJson(duplicateSingleSendRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/GetSingleSend.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/GetSingleSend.java new file mode 100644 index 00000000..4b1391d1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/GetSingleSend.java @@ -0,0 +1,106 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends; + +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.mcsinglesends.models.ListSingleSend500Response; +import com.sendgrid.rest.api.v3.mcsinglesends.models.SinglesendResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class GetSingleSend extends ApiKeyBase { + + private final String id; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/singlesends/{id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetSingleSend creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.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(), SinglesendResponse.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/ListCategory.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/ListCategory.java new file mode 100644 index 00000000..6cb66648 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/ListCategory.java @@ -0,0 +1,89 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends; + +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.mcsinglesends.models.ListCategory200Response; +import com.sendgrid.rest.api.v3.mcsinglesends.models.ListSingleSend500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListCategory extends ApiKeyBase { + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/singlesends/categories"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListCategory creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.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(), + ListCategory200Response.class + ), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/ListSingleSend.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/ListSingleSend.java new file mode 100644 index 00000000..bca78a9c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/ListSingleSend.java @@ -0,0 +1,106 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends; + +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.mcsinglesends.models.ListSingleSend200Response; +import com.sendgrid.rest.api.v3.mcsinglesends.models.ListSingleSend500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSingleSend extends ApiKeyBase { + + @Setter + private Integer pageSize; + + @Setter + private String pageToken; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/singlesends"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSingleSend creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.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(), + ListSingleSend200Response.class + ), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (pageSize != null) { + request.addQueryParam("page_size", pageSize.toString()); + } + if (pageToken != null) { + request.addQueryParam("page_token", pageToken.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/ScheduleSingleSend.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/ScheduleSingleSend.java new file mode 100644 index 00000000..5d34220b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/ScheduleSingleSend.java @@ -0,0 +1,123 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends; + +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.mcsinglesends.models.ListSingleSend500Response; +import com.sendgrid.rest.api.v3.mcsinglesends.models.ScheduleSingleSend201Response; +import com.sendgrid.rest.api.v3.mcsinglesends.models.ScheduleSingleSendRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ScheduleSingleSend extends ApiKeyBase { + + private final String id; + + @Setter + private ScheduleSingleSendRequest scheduleSingleSendRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/singlesends/{id}/schedule"; + Request request = new Request( + HttpMethod.PUT, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ScheduleSingleSend creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.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(), + ScheduleSingleSend201Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addBody(final Request request) { + if (scheduleSingleSendRequest != null) { + request.addBody(JsonUtil.toJson(scheduleSingleSendRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/SearchSingleSend.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/SearchSingleSend.java new file mode 100644 index 00000000..c3b3817c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/SearchSingleSend.java @@ -0,0 +1,117 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends; + +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.mcsinglesends.models.ListSingleSend200Response; +import com.sendgrid.rest.api.v3.mcsinglesends.models.ListSingleSend500Response; +import com.sendgrid.rest.api.v3.mcsinglesends.models.SinglesendSearch; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class SearchSingleSend extends ApiKeyBase { + + @Setter + private Integer pageSize; + + @Setter + private String pageToken; + + @Setter + private SinglesendSearch singlesendSearch; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/singlesends/search"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addQueryParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "SearchSingleSend creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.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(), + ListSingleSend200Response.class + ), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (pageSize != null) { + request.addQueryParam("page_size", pageSize.toString()); + } + if (pageToken != null) { + request.addQueryParam("page_token", pageToken.toString()); + } + } + + private void addBody(final Request request) { + if (singlesendSearch != null) { + request.addBody(JsonUtil.toJson(singlesendSearch)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/UpdateSingleSend.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/UpdateSingleSend.java new file mode 100644 index 00000000..f0eccf6d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/UpdateSingleSend.java @@ -0,0 +1,131 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends; + +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.mcsinglesends.models.ListSingleSend500Response; +import com.sendgrid.rest.api.v3.mcsinglesends.models.SinglesendRequest; +import com.sendgrid.rest.api.v3.mcsinglesends.models.SinglesendResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateSingleSend extends ApiKeyBase { + + private final String id; + + @Setter + private SinglesendRequest singlesendRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/singlesends/{id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateSingleSend 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")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ListSingleSend500Response error = JsonUtil.fromJson( + response.getStream(), + ListSingleSend500Response.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(), SinglesendResponse.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addBody(final Request request) { + if (singlesendRequest != null) { + request.addBody(JsonUtil.toJson(singlesendRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/AbTestSummary.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/AbTestSummary.java new file mode 100644 index 00000000..333e06b6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/AbTestSummary.java @@ -0,0 +1,142 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsinglesends.models.Type; +import com.sendgrid.rest.api.v3.mcsinglesends.models.WinnerCriteria; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AbTestSummary { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private Type type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("winner_criteria") + @Getter + @Setter + private WinnerCriteria winnerCriteria; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("test_percentage") + @Getter + @Setter + private Integer testPercentage; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("duration") + @Getter + @Setter + private String duration; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("winning_template_id") + @Getter + @Setter + private String winningTemplateId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("winner_selected_at") + @Getter + @Setter + private String winnerSelectedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("expiration_date") + @Getter + @Setter + private String expirationDate; + + public AbTestSummary() {} + + private AbTestSummary(Builder builder) { + this.type = builder.type; + this.winnerCriteria = builder.winnerCriteria; + this.testPercentage = builder.testPercentage; + this.duration = builder.duration; + this.winningTemplateId = builder.winningTemplateId; + this.winnerSelectedAt = builder.winnerSelectedAt; + this.expirationDate = builder.expirationDate; + } + + // Builder class for constructing object + public static class Builder { + + private Type type; + private WinnerCriteria winnerCriteria; + private Integer testPercentage; + private String duration; + private String winningTemplateId; + private String winnerSelectedAt; + private String expirationDate; + + public Builder( + Type type, + WinnerCriteria winnerCriteria, + Integer testPercentage, + String duration, + String winningTemplateId, + String winnerSelectedAt, + String expirationDate + ) { + this.type = type; + this.winnerCriteria = winnerCriteria; + this.testPercentage = testPercentage; + this.duration = duration; + this.winningTemplateId = winningTemplateId; + this.winnerSelectedAt = winnerSelectedAt; + this.expirationDate = expirationDate; + } + + public AbTestSummary build() { + return new AbTestSummary(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AbTestSummary.class.getSimpleName() + "(", + ")" + ); + if (type != null) joiner.add("type=" + type); + if (winnerCriteria != null) joiner.add( + "winnerCriteria=" + winnerCriteria + ); + if (testPercentage != null) joiner.add( + "testPercentage=" + testPercentage + ); + if (duration != null) joiner.add("duration=" + duration); + if (winningTemplateId != null) joiner.add( + "winningTemplateId=" + winningTemplateId + ); + if (winnerSelectedAt != null) joiner.add( + "winnerSelectedAt=" + winnerSelectedAt + ); + if (expirationDate != null) joiner.add( + "expirationDate=" + expirationDate + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/DuplicateSingleSendRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/DuplicateSingleSendRequest.java new file mode 100644 index 00000000..fa4956d8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/DuplicateSingleSendRequest.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DuplicateSingleSendRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public DuplicateSingleSendRequest() {} + + private DuplicateSingleSendRequest(Builder builder) { + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public DuplicateSingleSendRequest build() { + return new DuplicateSingleSendRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DuplicateSingleSendRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Editor.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Editor.java new file mode 100644 index 00000000..46d5aae0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Editor.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Editor { + CODE("code"), + + DESIGN("design"); + + private final String value; + + private Editor(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Editor forValue(final String value) { + return Promoter.enumFromString(value, Editor.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Editor1.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Editor1.java new file mode 100644 index 00000000..33d57f6b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Editor1.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Editor1 { + CODE("code"), + + DESIGN("design"); + + private final String value; + + private Editor1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Editor1 forValue(final String value) { + return Promoter.enumFromString(value, Editor1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Items.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Items.java new file mode 100644 index 00000000..7560a54b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Items.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Items { + DRAFT("draft"), + + SCHEDULED("scheduled"), + + TRIGGERED("triggered"); + + private final String value; + + private Items(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Items forValue(final String value) { + return Promoter.enumFromString(value, Items.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ListCategory200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ListCategory200Response.java new file mode 100644 index 00000000..d9bdf596 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ListCategory200Response.java @@ -0,0 +1,66 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListCategory200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("categories") + @Getter + @Setter + private List categories; + + public ListCategory200Response() {} + + private ListCategory200Response(Builder builder) { + this.categories = builder.categories; + } + + // Builder class for constructing object + public static class Builder { + + private List categories; + + public Builder() {} + + public Builder categories(List categories) { + this.categories = categories; + return this; + } + + public ListCategory200Response build() { + return new ListCategory200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListCategory200Response.class.getSimpleName() + "(", + ")" + ); + if (categories != null) joiner.add("categories=" + categories); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ListSingleSend200Response.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ListSingleSend200Response.java new file mode 100644 index 00000000..974043d0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ListSingleSend200Response.java @@ -0,0 +1,82 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsinglesends.models.Metadata; +import com.sendgrid.rest.api.v3.mcsinglesends.models.SinglesendResponseShort; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListSingleSend200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private Metadata metadata; + + public ListSingleSend200Response() {} + + private ListSingleSend200Response(Builder builder) { + this.result = builder.result; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + private Metadata metadata; + + public Builder() {} + + public Builder result(List result) { + this.result = result; + return this; + } + + public Builder metadata(Metadata metadata) { + this.metadata = metadata; + return this; + } + + public ListSingleSend200Response build() { + return new ListSingleSend200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListSingleSend200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ListSingleSend500Response.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ListSingleSend500Response.java new file mode 100644 index 00000000..fd95a5f0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ListSingleSend500Response.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsinglesends.models.ListSingleSend500ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListSingleSend500Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ListSingleSend500Response() {} + + private ListSingleSend500Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors( + List errors + ) { + this.errors = errors; + return this; + } + + public ListSingleSend500Response build() { + return new ListSingleSend500Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListSingleSend500Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ListSingleSend500ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ListSingleSend500ResponseErrorsInner.java new file mode 100644 index 00000000..4a80310d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ListSingleSend500ResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListSingleSend500ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_id") + @Getter + @Setter + private String errorId; + + public ListSingleSend500ResponseErrorsInner() {} + + private ListSingleSend500ResponseErrorsInner(Builder builder) { + this.field = builder.field; + this.message = builder.message; + this.errorId = builder.errorId; + } + + // Builder class for constructing object + public static class Builder { + + private String field; + private String message; + private String errorId; + + public Builder() {} + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder errorId(String errorId) { + this.errorId = errorId; + return this; + } + + public ListSingleSend500ResponseErrorsInner build() { + return new ListSingleSend500ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListSingleSend500ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (field != null) joiner.add("field=" + field); + if (message != null) joiner.add("message=" + message); + if (errorId != null) joiner.add("errorId=" + errorId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Metadata.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Metadata.java new file mode 100644 index 00000000..c5ca38e8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Metadata.java @@ -0,0 +1,108 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.net.URI; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Metadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("prev") + @Getter + @Setter + private URI prev; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("self") + @Getter + @Setter + private URI self; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next") + @Getter + @Setter + private URI next; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("count") + @Getter + @Setter + private Integer count; + + public Metadata() {} + + private Metadata(Builder builder) { + this.prev = builder.prev; + this.self = builder.self; + this.next = builder.next; + this.count = builder.count; + } + + // Builder class for constructing object + public static class Builder { + + private URI prev; + private URI self; + private URI next; + private Integer count; + + public Builder() {} + + public Builder prev(URI prev) { + this.prev = prev; + return this; + } + + public Builder self(URI self) { + this.self = self; + return this; + } + + public Builder next(URI next) { + this.next = next; + return this; + } + + public Builder count(Integer count) { + this.count = count; + return this; + } + + public Metadata build() { + return new Metadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Metadata.class.getSimpleName() + "(", + ")" + ); + if (prev != null) joiner.add("prev=" + prev); + if (self != null) joiner.add("self=" + self); + if (next != null) joiner.add("next=" + next); + if (count != null) joiner.add("count=" + count); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ScheduleSingleSend201Response.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ScheduleSingleSend201Response.java new file mode 100644 index 00000000..7a0df5d4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ScheduleSingleSend201Response.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsinglesends.models.Status; +import java.time.OffsetDateTime; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ScheduleSingleSend201Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("send_at") + @Getter + @Setter + private OffsetDateTime sendAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private Status status; + + public ScheduleSingleSend201Response() {} + + private ScheduleSingleSend201Response(Builder builder) { + this.sendAt = builder.sendAt; + this.status = builder.status; + } + + // Builder class for constructing object + public static class Builder { + + private OffsetDateTime sendAt; + private Status status; + + public Builder() {} + + public Builder sendAt(OffsetDateTime sendAt) { + this.sendAt = sendAt; + return this; + } + + public Builder status(Status status) { + this.status = status; + return this; + } + + public ScheduleSingleSend201Response build() { + return new ScheduleSingleSend201Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ScheduleSingleSend201Response.class.getSimpleName() + "(", + ")" + ); + if (sendAt != null) joiner.add("sendAt=" + sendAt); + if (status != null) joiner.add("status=" + status); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ScheduleSingleSendRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ScheduleSingleSendRequest.java new file mode 100644 index 00000000..6ace6701 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/ScheduleSingleSendRequest.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ScheduleSingleSendRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("send_at") + @Getter + @Setter + private OffsetDateTime sendAt; + + public ScheduleSingleSendRequest() {} + + private ScheduleSingleSendRequest(Builder builder) { + this.sendAt = builder.sendAt; + } + + // Builder class for constructing object + public static class Builder { + + private OffsetDateTime sendAt; + + public Builder(OffsetDateTime sendAt) { + this.sendAt = sendAt; + } + + public ScheduleSingleSendRequest build() { + return new ScheduleSingleSendRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ScheduleSingleSendRequest.class.getSimpleName() + "(", + ")" + ); + if (sendAt != null) joiner.add("sendAt=" + sendAt); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendRequest.java new file mode 100644 index 00000000..906145be --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendRequest.java @@ -0,0 +1,122 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsinglesends.models.SinglesendRequestEmailConfig; +import com.sendgrid.rest.api.v3.mcsinglesends.models.SinglesendRequestSendTo; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SinglesendRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("categories") + @Getter + @Setter + private List categories; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("send_at") + @Getter + @Setter + private OffsetDateTime sendAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("send_to") + @Getter + @Setter + private SinglesendRequestSendTo sendTo; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email_config") + @Getter + @Setter + private SinglesendRequestEmailConfig emailConfig; + + public SinglesendRequest() {} + + private SinglesendRequest(Builder builder) { + this.name = builder.name; + this.categories = builder.categories; + this.sendAt = builder.sendAt; + this.sendTo = builder.sendTo; + this.emailConfig = builder.emailConfig; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private List categories; + private OffsetDateTime sendAt; + private SinglesendRequestSendTo sendTo; + private SinglesendRequestEmailConfig emailConfig; + + public Builder(String name) { + this.name = name; + } + + public Builder categories(List categories) { + this.categories = categories; + return this; + } + + public Builder sendAt(OffsetDateTime sendAt) { + this.sendAt = sendAt; + return this; + } + + public Builder sendTo(SinglesendRequestSendTo sendTo) { + this.sendTo = sendTo; + return this; + } + + public Builder emailConfig(SinglesendRequestEmailConfig emailConfig) { + this.emailConfig = emailConfig; + return this; + } + + public SinglesendRequest build() { + return new SinglesendRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SinglesendRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (categories != null) joiner.add("categories=" + categories); + if (sendAt != null) joiner.add("sendAt=" + sendAt); + if (sendTo != null) joiner.add("sendTo=" + sendTo); + if (emailConfig != null) joiner.add("emailConfig=" + emailConfig); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendRequestEmailConfig.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendRequestEmailConfig.java new file mode 100644 index 00000000..c1708cb3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendRequestEmailConfig.java @@ -0,0 +1,199 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsinglesends.models.Editor; +import java.net.URI; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SinglesendRequestEmailConfig { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subject") + @Getter + @Setter + private String subject; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html_content") + @Getter + @Setter + private String htmlContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("plain_content") + @Getter + @Setter + private String plainContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("generate_plain_content") + @Getter + @Setter + private Boolean generatePlainContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("design_id") + @Getter + @Setter + private String designId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("editor") + @Getter + @Setter + private Editor editor; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("suppression_group_id") + @Getter + @Setter + private Integer suppressionGroupId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_unsubscribe_url") + @Getter + @Setter + private URI customUnsubscribeUrl; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sender_id") + @Getter + @Setter + private Integer senderId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip_pool") + @Getter + @Setter + private String ipPool; + + public SinglesendRequestEmailConfig() {} + + private SinglesendRequestEmailConfig(Builder builder) { + this.subject = builder.subject; + this.htmlContent = builder.htmlContent; + this.plainContent = builder.plainContent; + this.generatePlainContent = builder.generatePlainContent; + this.designId = builder.designId; + this.editor = builder.editor; + this.suppressionGroupId = builder.suppressionGroupId; + this.customUnsubscribeUrl = builder.customUnsubscribeUrl; + this.senderId = builder.senderId; + this.ipPool = builder.ipPool; + } + + // Builder class for constructing object + public static class Builder { + + private String subject; + private String htmlContent; + private String plainContent; + private Boolean generatePlainContent; + private String designId; + private Editor editor; + private Integer suppressionGroupId; + private URI customUnsubscribeUrl; + private Integer senderId; + private String ipPool; + + public Builder() {} + + public Builder subject(String subject) { + this.subject = subject; + return this; + } + + public Builder htmlContent(String htmlContent) { + this.htmlContent = htmlContent; + return this; + } + + public Builder plainContent(String plainContent) { + this.plainContent = plainContent; + return this; + } + + public Builder generatePlainContent(Boolean generatePlainContent) { + this.generatePlainContent = generatePlainContent; + return this; + } + + public Builder designId(String designId) { + this.designId = designId; + return this; + } + + public Builder editor(Editor editor) { + this.editor = editor; + return this; + } + + public Builder suppressionGroupId(Integer suppressionGroupId) { + this.suppressionGroupId = suppressionGroupId; + return this; + } + + public Builder customUnsubscribeUrl(URI customUnsubscribeUrl) { + this.customUnsubscribeUrl = customUnsubscribeUrl; + return this; + } + + public Builder senderId(Integer senderId) { + this.senderId = senderId; + return this; + } + + public Builder ipPool(String ipPool) { + this.ipPool = ipPool; + return this; + } + + public SinglesendRequestEmailConfig build() { + return new SinglesendRequestEmailConfig(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SinglesendRequestEmailConfig.class.getSimpleName() + "(", + ")" + ); + if (subject != null) joiner.add("subject=" + subject); + if (htmlContent != null) joiner.add("htmlContent=" + htmlContent); + if (plainContent != null) joiner.add("plainContent=" + plainContent); + if (generatePlainContent != null) joiner.add( + "generatePlainContent=" + generatePlainContent + ); + if (designId != null) joiner.add("designId=" + designId); + if (editor != null) joiner.add("editor=" + editor); + if (suppressionGroupId != null) joiner.add( + "suppressionGroupId=" + suppressionGroupId + ); + if (customUnsubscribeUrl != null) joiner.add( + "customUnsubscribeUrl=" + customUnsubscribeUrl + ); + if (senderId != null) joiner.add("senderId=" + senderId); + if (ipPool != null) joiner.add("ipPool=" + ipPool); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendRequestSendTo.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendRequestSendTo.java new file mode 100644 index 00000000..5c9fae04 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendRequestSendTo.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SinglesendRequestSendTo { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list_ids") + @Getter + @Setter + private List listIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("segment_ids") + @Getter + @Setter + private List segmentIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("all") + @Getter + @Setter + private Boolean all; + + public SinglesendRequestSendTo() {} + + private SinglesendRequestSendTo(Builder builder) { + this.listIds = builder.listIds; + this.segmentIds = builder.segmentIds; + this.all = builder.all; + } + + // Builder class for constructing object + public static class Builder { + + private List listIds; + private List segmentIds; + private Boolean all; + + public Builder() {} + + public Builder listIds(List listIds) { + this.listIds = listIds; + return this; + } + + public Builder segmentIds(List segmentIds) { + this.segmentIds = segmentIds; + return this; + } + + public Builder all(Boolean all) { + this.all = all; + return this; + } + + public SinglesendRequestSendTo build() { + return new SinglesendRequestSendTo(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SinglesendRequestSendTo.class.getSimpleName() + "(", + ")" + ); + if (listIds != null) joiner.add("listIds=" + listIds); + if (segmentIds != null) joiner.add("segmentIds=" + segmentIds); + if (all != null) joiner.add("all=" + all); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendResponse.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendResponse.java new file mode 100644 index 00000000..83e70c0c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendResponse.java @@ -0,0 +1,200 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsinglesends.models.SinglesendResponseEmailConfig; +import com.sendgrid.rest.api.v3.mcsinglesends.models.SinglesendResponseSendTo; +import com.sendgrid.rest.api.v3.mcsinglesends.models.SinglesendResponseWarningsInner; +import com.sendgrid.rest.api.v3.mcsinglesends.models.Status2; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SinglesendResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private UUID id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private Status2 status; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("categories") + @Getter + @Setter + private List categories; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("send_at") + @Getter + @Setter + private OffsetDateTime sendAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("send_to") + @Getter + @Setter + private SinglesendResponseSendTo sendTo; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private OffsetDateTime updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private OffsetDateTime createdAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email_config") + @Getter + @Setter + private SinglesendResponseEmailConfig emailConfig; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("warnings") + @Getter + @Setter + private List warnings; + + public SinglesendResponse() {} + + private SinglesendResponse(Builder builder) { + this.id = builder.id; + this.name = builder.name; + this.status = builder.status; + this.categories = builder.categories; + this.sendAt = builder.sendAt; + this.sendTo = builder.sendTo; + this.updatedAt = builder.updatedAt; + this.createdAt = builder.createdAt; + this.emailConfig = builder.emailConfig; + this.warnings = builder.warnings; + } + + // Builder class for constructing object + public static class Builder { + + private UUID id; + private String name; + private Status2 status; + private List categories; + private OffsetDateTime sendAt; + private SinglesendResponseSendTo sendTo; + private OffsetDateTime updatedAt; + private OffsetDateTime createdAt; + private SinglesendResponseEmailConfig emailConfig; + private List warnings; + + public Builder() {} + + public Builder id(UUID id) { + this.id = id; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder status(Status2 status) { + this.status = status; + return this; + } + + public Builder categories(List categories) { + this.categories = categories; + return this; + } + + public Builder sendAt(OffsetDateTime sendAt) { + this.sendAt = sendAt; + return this; + } + + public Builder sendTo(SinglesendResponseSendTo sendTo) { + this.sendTo = sendTo; + return this; + } + + public Builder updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder emailConfig(SinglesendResponseEmailConfig emailConfig) { + this.emailConfig = emailConfig; + return this; + } + + public Builder warnings( + List warnings + ) { + this.warnings = warnings; + return this; + } + + public SinglesendResponse build() { + return new SinglesendResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SinglesendResponse.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (name != null) joiner.add("name=" + name); + if (status != null) joiner.add("status=" + status); + if (categories != null) joiner.add("categories=" + categories); + if (sendAt != null) joiner.add("sendAt=" + sendAt); + if (sendTo != null) joiner.add("sendTo=" + sendTo); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + if (emailConfig != null) joiner.add("emailConfig=" + emailConfig); + if (warnings != null) joiner.add("warnings=" + warnings); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendResponseEmailConfig.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendResponseEmailConfig.java new file mode 100644 index 00000000..00f0b4ed --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendResponseEmailConfig.java @@ -0,0 +1,199 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsinglesends.models.Editor1; +import java.net.URI; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SinglesendResponseEmailConfig { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subject") + @Getter + @Setter + private String subject; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html_content") + @Getter + @Setter + private String htmlContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("plain_content") + @Getter + @Setter + private String plainContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("generate_plain_content") + @Getter + @Setter + private Boolean generatePlainContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("design_id") + @Getter + @Setter + private String designId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("editor") + @Getter + @Setter + private Editor1 editor; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("suppression_group_id") + @Getter + @Setter + private Integer suppressionGroupId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_unsubscribe_url") + @Getter + @Setter + private URI customUnsubscribeUrl; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sender_id") + @Getter + @Setter + private Integer senderId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip_pool") + @Getter + @Setter + private String ipPool; + + public SinglesendResponseEmailConfig() {} + + private SinglesendResponseEmailConfig(Builder builder) { + this.subject = builder.subject; + this.htmlContent = builder.htmlContent; + this.plainContent = builder.plainContent; + this.generatePlainContent = builder.generatePlainContent; + this.designId = builder.designId; + this.editor = builder.editor; + this.suppressionGroupId = builder.suppressionGroupId; + this.customUnsubscribeUrl = builder.customUnsubscribeUrl; + this.senderId = builder.senderId; + this.ipPool = builder.ipPool; + } + + // Builder class for constructing object + public static class Builder { + + private String subject; + private String htmlContent; + private String plainContent; + private Boolean generatePlainContent; + private String designId; + private Editor1 editor; + private Integer suppressionGroupId; + private URI customUnsubscribeUrl; + private Integer senderId; + private String ipPool; + + public Builder() {} + + public Builder subject(String subject) { + this.subject = subject; + return this; + } + + public Builder htmlContent(String htmlContent) { + this.htmlContent = htmlContent; + return this; + } + + public Builder plainContent(String plainContent) { + this.plainContent = plainContent; + return this; + } + + public Builder generatePlainContent(Boolean generatePlainContent) { + this.generatePlainContent = generatePlainContent; + return this; + } + + public Builder designId(String designId) { + this.designId = designId; + return this; + } + + public Builder editor(Editor1 editor) { + this.editor = editor; + return this; + } + + public Builder suppressionGroupId(Integer suppressionGroupId) { + this.suppressionGroupId = suppressionGroupId; + return this; + } + + public Builder customUnsubscribeUrl(URI customUnsubscribeUrl) { + this.customUnsubscribeUrl = customUnsubscribeUrl; + return this; + } + + public Builder senderId(Integer senderId) { + this.senderId = senderId; + return this; + } + + public Builder ipPool(String ipPool) { + this.ipPool = ipPool; + return this; + } + + public SinglesendResponseEmailConfig build() { + return new SinglesendResponseEmailConfig(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SinglesendResponseEmailConfig.class.getSimpleName() + "(", + ")" + ); + if (subject != null) joiner.add("subject=" + subject); + if (htmlContent != null) joiner.add("htmlContent=" + htmlContent); + if (plainContent != null) joiner.add("plainContent=" + plainContent); + if (generatePlainContent != null) joiner.add( + "generatePlainContent=" + generatePlainContent + ); + if (designId != null) joiner.add("designId=" + designId); + if (editor != null) joiner.add("editor=" + editor); + if (suppressionGroupId != null) joiner.add( + "suppressionGroupId=" + suppressionGroupId + ); + if (customUnsubscribeUrl != null) joiner.add( + "customUnsubscribeUrl=" + customUnsubscribeUrl + ); + if (senderId != null) joiner.add("senderId=" + senderId); + if (ipPool != null) joiner.add("ipPool=" + ipPool); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendResponseSendTo.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendResponseSendTo.java new file mode 100644 index 00000000..f20e6779 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendResponseSendTo.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SinglesendResponseSendTo { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("list_ids") + @Getter + @Setter + private List listIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("segment_ids") + @Getter + @Setter + private List segmentIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("all") + @Getter + @Setter + private Boolean all; + + public SinglesendResponseSendTo() {} + + private SinglesendResponseSendTo(Builder builder) { + this.listIds = builder.listIds; + this.segmentIds = builder.segmentIds; + this.all = builder.all; + } + + // Builder class for constructing object + public static class Builder { + + private List listIds; + private List segmentIds; + private Boolean all; + + public Builder() {} + + public Builder listIds(List listIds) { + this.listIds = listIds; + return this; + } + + public Builder segmentIds(List segmentIds) { + this.segmentIds = segmentIds; + return this; + } + + public Builder all(Boolean all) { + this.all = all; + return this; + } + + public SinglesendResponseSendTo build() { + return new SinglesendResponseSendTo(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SinglesendResponseSendTo.class.getSimpleName() + "(", + ")" + ); + if (listIds != null) joiner.add("listIds=" + listIds); + if (segmentIds != null) joiner.add("segmentIds=" + segmentIds); + if (all != null) joiner.add("all=" + all); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendResponseShort.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendResponseShort.java new file mode 100644 index 00000000..db0e87f8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendResponseShort.java @@ -0,0 +1,160 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsinglesends.models.AbTestSummary; +import com.sendgrid.rest.api.v3.mcsinglesends.models.Status3; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SinglesendResponseShort { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private UUID id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("abtest") + @Getter + @Setter + private AbTestSummary abtest; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private Status3 status; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("categories") + @Getter + @Setter + private List categories; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("send_at") + @Getter + @Setter + private OffsetDateTime sendAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_abtest") + @Getter + @Setter + private Boolean isAbtest; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private OffsetDateTime updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private OffsetDateTime createdAt; + + public SinglesendResponseShort() {} + + private SinglesendResponseShort(Builder builder) { + this.id = builder.id; + this.name = builder.name; + this.abtest = builder.abtest; + this.status = builder.status; + this.categories = builder.categories; + this.sendAt = builder.sendAt; + this.isAbtest = builder.isAbtest; + this.updatedAt = builder.updatedAt; + this.createdAt = builder.createdAt; + } + + // Builder class for constructing object + public static class Builder { + + private UUID id; + private String name; + private AbTestSummary abtest; + private Status3 status; + private List categories; + private OffsetDateTime sendAt; + private Boolean isAbtest; + private OffsetDateTime updatedAt; + private OffsetDateTime createdAt; + + public Builder( + UUID id, + String name, + AbTestSummary abtest, + Status3 status, + List categories, + Boolean isAbtest, + OffsetDateTime updatedAt, + OffsetDateTime createdAt + ) { + this.id = id; + this.name = name; + this.abtest = abtest; + this.status = status; + this.categories = categories; + this.isAbtest = isAbtest; + this.updatedAt = updatedAt; + this.createdAt = createdAt; + } + + public Builder sendAt(OffsetDateTime sendAt) { + this.sendAt = sendAt; + return this; + } + + public SinglesendResponseShort build() { + return new SinglesendResponseShort(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SinglesendResponseShort.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (name != null) joiner.add("name=" + name); + if (abtest != null) joiner.add("abtest=" + abtest); + if (status != null) joiner.add("status=" + status); + if (categories != null) joiner.add("categories=" + categories); + if (sendAt != null) joiner.add("sendAt=" + sendAt); + if (isAbtest != null) joiner.add("isAbtest=" + isAbtest); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendResponseWarningsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendResponseWarningsInner.java new file mode 100644 index 00000000..e389b832 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendResponseWarningsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SinglesendResponseWarningsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("warning_id") + @Getter + @Setter + private String warningId; + + public SinglesendResponseWarningsInner() {} + + private SinglesendResponseWarningsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.warningId = builder.warningId; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private String warningId; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder warningId(String warningId) { + this.warningId = warningId; + return this; + } + + public SinglesendResponseWarningsInner build() { + return new SinglesendResponseWarningsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SinglesendResponseWarningsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (warningId != null) joiner.add("warningId=" + warningId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendSchedule.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendSchedule.java new file mode 100644 index 00000000..2a9ef816 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendSchedule.java @@ -0,0 +1,78 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsinglesends.models.Status1; +import java.time.OffsetDateTime; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SinglesendSchedule { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("send_at") + @Getter + @Setter + private OffsetDateTime sendAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private Status1 status; + + public SinglesendSchedule() {} + + private SinglesendSchedule(Builder builder) { + this.sendAt = builder.sendAt; + this.status = builder.status; + } + + // Builder class for constructing object + public static class Builder { + + private OffsetDateTime sendAt; + private Status1 status; + + public Builder(OffsetDateTime sendAt) { + this.sendAt = sendAt; + } + + public Builder status(Status1 status) { + this.status = status; + return this; + } + + public SinglesendSchedule build() { + return new SinglesendSchedule(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SinglesendSchedule.class.getSimpleName() + "(", + ")" + ); + if (sendAt != null) joiner.add("sendAt=" + sendAt); + if (status != null) joiner.add("status=" + status); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendSearch.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendSearch.java new file mode 100644 index 00000000..942c1722 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/SinglesendSearch.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcsinglesends.models.Items; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SinglesendSearch { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private List status; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("categories") + @Getter + @Setter + private List categories; + + public SinglesendSearch() {} + + private SinglesendSearch(Builder builder) { + this.name = builder.name; + this.status = builder.status; + this.categories = builder.categories; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private List status; + private List categories; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder status(List status) { + this.status = status; + return this; + } + + public Builder categories(List categories) { + this.categories = categories; + return this; + } + + public SinglesendSearch build() { + return new SinglesendSearch(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SinglesendSearch.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (status != null) joiner.add("status=" + status); + if (categories != null) joiner.add("categories=" + categories); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Status.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Status.java new file mode 100644 index 00000000..0eff9f55 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Status.java @@ -0,0 +1,40 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Status { + SCHEDULED("scheduled"); + + private final String value; + + private Status(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Status forValue(final String value) { + return Promoter.enumFromString(value, Status.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Status1.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Status1.java new file mode 100644 index 00000000..7889d9ff --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Status1.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Status1 { + DRAFT("draft"), + + SCHEDULED("scheduled"), + + TRIGGERED("triggered"); + + private final String value; + + private Status1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Status1 forValue(final String value) { + return Promoter.enumFromString(value, Status1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Status2.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Status2.java new file mode 100644 index 00000000..3091dd56 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Status2.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Status2 { + DRAFT("draft"), + + SCHEDULED("scheduled"), + + TRIGGERED("triggered"); + + private final String value; + + private Status2(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Status2 forValue(final String value) { + return Promoter.enumFromString(value, Status2.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Status3.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Status3.java new file mode 100644 index 00000000..a2c76d07 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Status3.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Status3 { + DRAFT("draft"), + + SCHEDULED("scheduled"), + + TRIGGERED("triggered"); + + private final String value; + + private Status3(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Status3 forValue(final String value) { + return Promoter.enumFromString(value, Status3.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Type.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Type.java new file mode 100644 index 00000000..2f790663 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/Type.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Type { + SUBJECT("subject"), + + CONTENT("content"); + + private final String value; + + private Type(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Type forValue(final String value) { + return Promoter.enumFromString(value, Type.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/WinnerCriteria.java b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/WinnerCriteria.java new file mode 100644 index 00000000..66950fba --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcsinglesends/models/WinnerCriteria.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Single Sends API + * The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + * + * 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.mcsinglesends.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum WinnerCriteria { + OPEN("open"), + + CLICK("click"), + + MANUAL("manual"); + + private final String value; + + private WinnerCriteria(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static WinnerCriteria forValue(final String value) { + return Promoter.enumFromString(value, WinnerCriteria.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/ExportAutomationStat.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/ExportAutomationStat.java new file mode 100644 index 00000000..993c28e2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/ExportAutomationStat.java @@ -0,0 +1,83 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats; + +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 java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ExportAutomationStat extends ApiKeyBase { + + @Setter + private List ids; + + @Setter + private String timezone; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/stats/automations/export"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ExportAutomationStat creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + + 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 addQueryParams(Request request) { + if (ids != null) { + request.addQueryParam("ids", ids.toString()); + } + if (timezone != null) { + request.addQueryParam("timezone", timezone.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/ExportSingleSendStat.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/ExportSingleSendStat.java new file mode 100644 index 00000000..c537649f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/ExportSingleSendStat.java @@ -0,0 +1,83 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats; + +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 java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ExportSingleSendStat extends ApiKeyBase { + + @Setter + private List ids; + + @Setter + private String timezone; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/stats/singlesends/export"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ExportSingleSendStat creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + + 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 addQueryParams(Request request) { + if (ids != null) { + request.addQueryParam("ids", ids.toString()); + } + if (timezone != null) { + request.addQueryParam("timezone", timezone.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/GetAutomationStat.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/GetAutomationStat.java new file mode 100644 index 00000000..57df7023 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/GetAutomationStat.java @@ -0,0 +1,149 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats; + +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.mcstats.models.AggregatedBy; +import com.sendgrid.rest.api.v3.mcstats.models.AutomationsResponse; +import com.sendgrid.rest.api.v3.mcstats.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mcstats.models.Items; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.time.LocalDate; +import java.util.List; +import java.util.UUID; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetAutomationStat extends ApiKeyBase { + + private final String id; + + @Setter + private List groupBy; + + @Setter + private List stepIds; + + @Setter + private AggregatedBy aggregatedBy; + + @Setter + private LocalDate startDate; + + @Setter + private LocalDate endDate; + + @Setter + private String timezone; + + @Setter + private Integer pageSize; + + @Setter + private String pageToken; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/stats/automations/{id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetAutomationStat 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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 (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addQueryParams(Request request) { + if (groupBy != null) { + request.addQueryParam("group_by", groupBy.toString()); + } + if (stepIds != null) { + request.addQueryParam("step_ids", stepIds.toString()); + } + if (aggregatedBy != null) { + request.addQueryParam("aggregated_by", aggregatedBy.toString()); + } + if (startDate != null) { + request.addQueryParam("start_date", startDate.toString()); + } + if (endDate != null) { + request.addQueryParam("end_date", endDate.toString()); + } + if (timezone != null) { + request.addQueryParam("timezone", timezone.toString()); + } + if (pageSize != null) { + request.addQueryParam("page_size", pageSize.toString()); + } + if (pageToken != null) { + request.addQueryParam("page_token", pageToken.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/GetSingleSendStat.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/GetSingleSendStat.java new file mode 100644 index 00000000..8b59eccf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/GetSingleSendStat.java @@ -0,0 +1,142 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats; + +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.mcstats.models.AggregatedBy; +import com.sendgrid.rest.api.v3.mcstats.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mcstats.models.Items1; +import com.sendgrid.rest.api.v3.mcstats.models.SinglesendsResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.time.LocalDate; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetSingleSendStat extends ApiKeyBase { + + private final String id; + + @Setter + private AggregatedBy aggregatedBy; + + @Setter + private LocalDate startDate; + + @Setter + private LocalDate endDate; + + @Setter + private String timezone; + + @Setter + private Integer pageSize; + + @Setter + private String pageToken; + + @Setter + private List groupBy; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/stats/singlesends/{id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetSingleSendStat 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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 (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addQueryParams(Request request) { + if (aggregatedBy != null) { + request.addQueryParam("aggregated_by", aggregatedBy.toString()); + } + if (startDate != null) { + request.addQueryParam("start_date", startDate.toString()); + } + if (endDate != null) { + request.addQueryParam("end_date", endDate.toString()); + } + if (timezone != null) { + request.addQueryParam("timezone", timezone.toString()); + } + if (pageSize != null) { + request.addQueryParam("page_size", pageSize.toString()); + } + if (pageToken != null) { + request.addQueryParam("page_token", pageToken.toString()); + } + if (groupBy != null) { + request.addQueryParam("group_by", groupBy.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/ListAutomationStat.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/ListAutomationStat.java new file mode 100644 index 00000000..9b1c50da --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/ListAutomationStat.java @@ -0,0 +1,110 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats; + +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.mcstats.models.AutomationsResponse; +import com.sendgrid.rest.api.v3.mcstats.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListAutomationStat extends ApiKeyBase { + + @Setter + private List automationIds; + + @Setter + private Integer pageSize; + + @Setter + private String pageToken; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/stats/automations"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListAutomationStat 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), AutomationsResponse.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (automationIds != null) { + request.addQueryParam("automation_ids", automationIds.toString()); + } + if (pageSize != null) { + request.addQueryParam("page_size", pageSize.toString()); + } + if (pageToken != null) { + request.addQueryParam("page_token", pageToken.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/ListClickTrackingStat.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/ListClickTrackingStat.java new file mode 100644 index 00000000..1bdf40e1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/ListClickTrackingStat.java @@ -0,0 +1,143 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats; + +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.mcstats.models.AutmoationsLinkStatsResponse; +import com.sendgrid.rest.api.v3.mcstats.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mcstats.models.Items; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import java.util.UUID; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListClickTrackingStat extends ApiKeyBase { + + private final UUID id; + + @Setter + private List groupBy; + + @Setter + private List stepIds; + + @Setter + private Integer pageSize; + + @Setter + private String pageToken; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/stats/automations/{id}/links"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListClickTrackingStat 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + AutmoationsLinkStatsResponse.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addQueryParams(Request request) { + if (groupBy != null) { + request.addQueryParam("group_by", groupBy.toString()); + } + if (stepIds != null) { + request.addQueryParam("step_ids", stepIds.toString()); + } + if (pageSize != null) { + request.addQueryParam("page_size", pageSize.toString()); + } + if (pageToken != null) { + request.addQueryParam("page_token", pageToken.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/ListSingleSendStat.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/ListSingleSendStat.java new file mode 100644 index 00000000..a6c0dc06 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/ListSingleSendStat.java @@ -0,0 +1,110 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats; + +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.mcstats.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mcstats.models.SinglesendsResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSingleSendStat extends ApiKeyBase { + + @Setter + private List singlesendIds; + + @Setter + private Integer pageSize; + + @Setter + private String pageToken; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/stats/singlesends"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSingleSendStat 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), SinglesendsResponse.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (singlesendIds != null) { + request.addQueryParam("singlesend_ids", singlesendIds.toString()); + } + if (pageSize != null) { + request.addQueryParam("page_size", pageSize.toString()); + } + if (pageToken != null) { + request.addQueryParam("page_token", pageToken.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/ListSingleSendTrackingStat.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/ListSingleSendTrackingStat.java new file mode 100644 index 00000000..f1d9a8a8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/ListSingleSendTrackingStat.java @@ -0,0 +1,150 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats; + +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.mcstats.models.AbPhaseId; +import com.sendgrid.rest.api.v3.mcstats.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mcstats.models.Items2; +import com.sendgrid.rest.api.v3.mcstats.models.SinglesendsLinkStatsResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import java.util.UUID; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSingleSendTrackingStat extends ApiKeyBase { + + private final String id; + + @Setter + private Integer pageSize; + + @Setter + private String pageToken; + + @Setter + private List groupBy; + + @Setter + private UUID abVariationId; + + @Setter + private AbPhaseId abPhaseId; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/marketing/stats/singlesends/{id}/links"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSingleSendTrackingStat 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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, + JsonUtil.fromJson( + response.getStream(), + SinglesendsLinkStatsResponse.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addQueryParams(Request request) { + if (pageSize != null) { + request.addQueryParam("page_size", pageSize.toString()); + } + if (pageToken != null) { + request.addQueryParam("page_token", pageToken.toString()); + } + if (groupBy != null) { + request.addQueryParam("group_by", groupBy.toString()); + } + if (abVariationId != null) { + request.addQueryParam("ab_variation_id", abVariationId.toString()); + } + if (abPhaseId != null) { + request.addQueryParam("ab_phase_id", abPhaseId.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AbPhase.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AbPhase.java new file mode 100644 index 00000000..c928b926 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AbPhase.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum AbPhase { + SEND("send"), + + TEST("test"), + + ALL("all"); + + private final String value; + + private AbPhase(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static AbPhase forValue(final String value) { + return Promoter.enumFromString(value, AbPhase.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AbPhase1.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AbPhase1.java new file mode 100644 index 00000000..009bd9a5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AbPhase1.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum AbPhase1 { + SEND("send"), + + TEST("test"), + + ALL("all"); + + private final String value; + + private AbPhase1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static AbPhase1 forValue(final String value) { + return Promoter.enumFromString(value, AbPhase1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AbPhaseId.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AbPhaseId.java new file mode 100644 index 00000000..20a6daf0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AbPhaseId.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum AbPhaseId { + TEST("test"), + + SEND("send"); + + private final String value; + + private AbPhaseId(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static AbPhaseId forValue(final String value) { + return Promoter.enumFromString(value, AbPhaseId.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AggregatedBy.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AggregatedBy.java new file mode 100644 index 00000000..4caabc0d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AggregatedBy.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum AggregatedBy { + DAY("day"), + + TOTAL("total"); + + private final String value; + + private AggregatedBy(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static AggregatedBy forValue(final String value) { + return Promoter.enumFromString(value, AggregatedBy.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AutmoationsLinkStatsResponse.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AutmoationsLinkStatsResponse.java new file mode 100644 index 00000000..72a7b51f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AutmoationsLinkStatsResponse.java @@ -0,0 +1,89 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcstats.models.AutmoationsLinkStatsResponseResultsInner; +import com.sendgrid.rest.api.v3.mcstats.models.LinkTrackingMetadata; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AutmoationsLinkStatsResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("results") + @Getter + @Setter + private List results; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("total_clicks") + @Getter + @Setter + private Integer totalClicks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private LinkTrackingMetadata metadata; + + public AutmoationsLinkStatsResponse() {} + + private AutmoationsLinkStatsResponse(Builder builder) { + this.results = builder.results; + this.totalClicks = builder.totalClicks; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private List results; + private Integer totalClicks; + private LinkTrackingMetadata metadata; + + public Builder( + List results, + Integer totalClicks, + LinkTrackingMetadata metadata + ) { + this.results = results; + this.totalClicks = totalClicks; + this.metadata = metadata; + } + + public AutmoationsLinkStatsResponse build() { + return new AutmoationsLinkStatsResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AutmoationsLinkStatsResponse.class.getSimpleName() + "(", + ")" + ); + if (results != null) joiner.add("results=" + results); + if (totalClicks != null) joiner.add("totalClicks=" + totalClicks); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AutmoationsLinkStatsResponseResultsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AutmoationsLinkStatsResponseResultsInner.java new file mode 100644 index 00000000..f219bdfe --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AutmoationsLinkStatsResponseResultsInner.java @@ -0,0 +1,99 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.net.URI; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AutmoationsLinkStatsResponseResultsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("url") + @Getter + @Setter + private URI url; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("url_location") + @Getter + @Setter + private Integer urlLocation; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("step_id") + @Getter + @Setter + private UUID stepId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("clicks") + @Getter + @Setter + private Integer clicks; + + public AutmoationsLinkStatsResponseResultsInner() {} + + private AutmoationsLinkStatsResponseResultsInner(Builder builder) { + this.url = builder.url; + this.urlLocation = builder.urlLocation; + this.stepId = builder.stepId; + this.clicks = builder.clicks; + } + + // Builder class for constructing object + public static class Builder { + + private URI url; + private Integer urlLocation; + private UUID stepId; + private Integer clicks; + + public Builder(URI url, UUID stepId, Integer clicks) { + this.url = url; + this.stepId = stepId; + this.clicks = clicks; + } + + public Builder urlLocation(Integer urlLocation) { + this.urlLocation = urlLocation; + return this; + } + + public AutmoationsLinkStatsResponseResultsInner build() { + return new AutmoationsLinkStatsResponseResultsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AutmoationsLinkStatsResponseResultsInner.class.getSimpleName() + + "(", + ")" + ); + if (url != null) joiner.add("url=" + url); + if (urlLocation != null) joiner.add("urlLocation=" + urlLocation); + if (stepId != null) joiner.add("stepId=" + stepId); + if (clicks != null) joiner.add("clicks=" + clicks); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AutomationsResponse.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AutomationsResponse.java new file mode 100644 index 00000000..52c345f9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AutomationsResponse.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcstats.models.AutomationsResponseResultsInner; +import com.sendgrid.rest.api.v3.mcstats.models.Metadata; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AutomationsResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("results") + @Getter + @Setter + private List results; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private Metadata metadata; + + public AutomationsResponse() {} + + private AutomationsResponse(Builder builder) { + this.results = builder.results; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private List results; + private Metadata metadata; + + public Builder(List results) { + this.results = results; + } + + public Builder metadata(Metadata metadata) { + this.metadata = metadata; + return this; + } + + public AutomationsResponse build() { + return new AutomationsResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AutomationsResponse.class.getSimpleName() + "(", + ")" + ); + if (results != null) joiner.add("results=" + results); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AutomationsResponseResultsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AutomationsResponseResultsInner.java new file mode 100644 index 00000000..db2f8992 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/AutomationsResponseResultsInner.java @@ -0,0 +1,98 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcstats.models.Metrics; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AutomationsResponseResultsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private UUID id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("aggregation") + @Getter + @Setter + private String aggregation; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("step_id") + @Getter + @Setter + private String stepId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("stats") + @Getter + @Setter + private Metrics stats; + + public AutomationsResponseResultsInner() {} + + private AutomationsResponseResultsInner(Builder builder) { + this.id = builder.id; + this.aggregation = builder.aggregation; + this.stepId = builder.stepId; + this.stats = builder.stats; + } + + // Builder class for constructing object + public static class Builder { + + private UUID id; + private String aggregation; + private String stepId; + private Metrics stats; + + public Builder(UUID id, String aggregation, String stepId) { + this.id = id; + this.aggregation = aggregation; + this.stepId = stepId; + } + + public Builder stats(Metrics stats) { + this.stats = stats; + return this; + } + + public AutomationsResponseResultsInner build() { + return new AutomationsResponseResultsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AutomationsResponseResultsInner.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (aggregation != null) joiner.add("aggregation=" + aggregation); + if (stepId != null) joiner.add("stepId=" + stepId); + if (stats != null) joiner.add("stats=" + stats); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/ErrorResponse.java new file mode 100644 index 00000000..cbb8c63c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcstats.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..ea505f5d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/Items.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/Items.java new file mode 100644 index 00000000..921c0750 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/Items.java @@ -0,0 +1,40 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Items { + STEP_ID("step_id"); + + private final String value; + + private Items(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Items forValue(final String value) { + return Promoter.enumFromString(value, Items.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/Items1.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/Items1.java new file mode 100644 index 00000000..5781db58 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/Items1.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Items1 { + VARIATION("ab_variation"), + + PHASE("ab_phase"); + + private final String value; + + private Items1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Items1 forValue(final String value) { + return Promoter.enumFromString(value, Items1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/Items2.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/Items2.java new file mode 100644 index 00000000..2da3a455 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/Items2.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Items2 { + VARIATION("ab_variation"), + + PHASE("ab_phase"); + + private final String value; + + private Items2(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Items2 forValue(final String value) { + return Promoter.enumFromString(value, Items2.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/LinkTrackingMetadata.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/LinkTrackingMetadata.java new file mode 100644 index 00000000..6afe3b5d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/LinkTrackingMetadata.java @@ -0,0 +1,109 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.net.URI; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class LinkTrackingMetadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("prev") + @Getter + @Setter + private URI prev; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("self") + @Getter + @Setter + private URI self; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next") + @Getter + @Setter + private URI next; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("count") + @Getter + @Setter + private BigDecimal count; + + public LinkTrackingMetadata() {} + + private LinkTrackingMetadata(Builder builder) { + this.prev = builder.prev; + this.self = builder.self; + this.next = builder.next; + this.count = builder.count; + } + + // Builder class for constructing object + public static class Builder { + + private URI prev; + private URI self; + private URI next; + private BigDecimal count; + + public Builder() {} + + public Builder prev(URI prev) { + this.prev = prev; + return this; + } + + public Builder self(URI self) { + this.self = self; + return this; + } + + public Builder next(URI next) { + this.next = next; + return this; + } + + public Builder count(BigDecimal count) { + this.count = count; + return this; + } + + public LinkTrackingMetadata build() { + return new LinkTrackingMetadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + LinkTrackingMetadata.class.getSimpleName() + "(", + ")" + ); + if (prev != null) joiner.add("prev=" + prev); + if (self != null) joiner.add("self=" + self); + if (next != null) joiner.add("next=" + next); + if (count != null) joiner.add("count=" + count); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/Metadata.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/Metadata.java new file mode 100644 index 00000000..a8d8f01f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/Metadata.java @@ -0,0 +1,109 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.net.URI; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Metadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("prev") + @Getter + @Setter + private URI prev; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("self") + @Getter + @Setter + private URI self; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next") + @Getter + @Setter + private URI next; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("count") + @Getter + @Setter + private BigDecimal count; + + public Metadata() {} + + private Metadata(Builder builder) { + this.prev = builder.prev; + this.self = builder.self; + this.next = builder.next; + this.count = builder.count; + } + + // Builder class for constructing object + public static class Builder { + + private URI prev; + private URI self; + private URI next; + private BigDecimal count; + + public Builder() {} + + public Builder prev(URI prev) { + this.prev = prev; + return this; + } + + public Builder self(URI self) { + this.self = self; + return this; + } + + public Builder next(URI next) { + this.next = next; + return this; + } + + public Builder count(BigDecimal count) { + this.count = count; + return this; + } + + public Metadata build() { + return new Metadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Metadata.class.getSimpleName() + "(", + ")" + ); + if (prev != null) joiner.add("prev=" + prev); + if (self != null) joiner.add("self=" + self); + if (next != null) joiner.add("next=" + next); + if (count != null) joiner.add("count=" + count); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/Metrics.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/Metrics.java new file mode 100644 index 00000000..266da048 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/Metrics.java @@ -0,0 +1,187 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Metrics { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounce_drops") + @Getter + @Setter + private Integer bounceDrops; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounces") + @Getter + @Setter + private Integer bounces; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("clicks") + @Getter + @Setter + private Integer clicks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("delivered") + @Getter + @Setter + private Integer delivered; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("invalid_emails") + @Getter + @Setter + private Integer invalidEmails; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("opens") + @Getter + @Setter + private Integer opens; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("requests") + @Getter + @Setter + private Integer requests; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_report_drops") + @Getter + @Setter + private Integer spamReportDrops; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_reports") + @Getter + @Setter + private Integer spamReports; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unique_clicks") + @Getter + @Setter + private Integer uniqueClicks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unique_opens") + @Getter + @Setter + private Integer uniqueOpens; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unsubscribes") + @Getter + @Setter + private Integer unsubscribes; + + public Metrics() {} + + private Metrics(Builder builder) { + this.bounceDrops = builder.bounceDrops; + this.bounces = builder.bounces; + this.clicks = builder.clicks; + this.delivered = builder.delivered; + this.invalidEmails = builder.invalidEmails; + this.opens = builder.opens; + this.requests = builder.requests; + this.spamReportDrops = builder.spamReportDrops; + this.spamReports = builder.spamReports; + this.uniqueClicks = builder.uniqueClicks; + this.uniqueOpens = builder.uniqueOpens; + this.unsubscribes = builder.unsubscribes; + } + + // Builder class for constructing object + public static class Builder { + + private Integer bounceDrops; + private Integer bounces; + private Integer clicks; + private Integer delivered; + private Integer invalidEmails; + private Integer opens; + private Integer requests; + private Integer spamReportDrops; + private Integer spamReports; + private Integer uniqueClicks; + private Integer uniqueOpens; + private Integer unsubscribes; + + public Builder( + Integer bounceDrops, + Integer bounces, + Integer clicks, + Integer delivered, + Integer invalidEmails, + Integer opens, + Integer requests, + Integer spamReportDrops, + Integer spamReports, + Integer uniqueClicks, + Integer uniqueOpens, + Integer unsubscribes + ) { + this.bounceDrops = bounceDrops; + this.bounces = bounces; + this.clicks = clicks; + this.delivered = delivered; + this.invalidEmails = invalidEmails; + this.opens = opens; + this.requests = requests; + this.spamReportDrops = spamReportDrops; + this.spamReports = spamReports; + this.uniqueClicks = uniqueClicks; + this.uniqueOpens = uniqueOpens; + this.unsubscribes = unsubscribes; + } + + public Metrics build() { + return new Metrics(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Metrics.class.getSimpleName() + "(", + ")" + ); + if (bounceDrops != null) joiner.add("bounceDrops=" + bounceDrops); + if (bounces != null) joiner.add("bounces=" + bounces); + if (clicks != null) joiner.add("clicks=" + clicks); + if (delivered != null) joiner.add("delivered=" + delivered); + if (invalidEmails != null) joiner.add("invalidEmails=" + invalidEmails); + if (opens != null) joiner.add("opens=" + opens); + if (requests != null) joiner.add("requests=" + requests); + if (spamReportDrops != null) joiner.add( + "spamReportDrops=" + spamReportDrops + ); + if (spamReports != null) joiner.add("spamReports=" + spamReports); + if (uniqueClicks != null) joiner.add("uniqueClicks=" + uniqueClicks); + if (uniqueOpens != null) joiner.add("uniqueOpens=" + uniqueOpens); + if (unsubscribes != null) joiner.add("unsubscribes=" + unsubscribes); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/SinglesendsLinkStatsResponse.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/SinglesendsLinkStatsResponse.java new file mode 100644 index 00000000..8cf70dfe --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/SinglesendsLinkStatsResponse.java @@ -0,0 +1,92 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcstats.models.LinkTrackingMetadata; +import com.sendgrid.rest.api.v3.mcstats.models.SinglesendsLinkStatsResponseResultsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SinglesendsLinkStatsResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("results") + @Getter + @Setter + private List results; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private LinkTrackingMetadata metadata; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("total_clicks") + @Getter + @Setter + private Integer totalClicks; + + public SinglesendsLinkStatsResponse() {} + + private SinglesendsLinkStatsResponse(Builder builder) { + this.results = builder.results; + this.metadata = builder.metadata; + this.totalClicks = builder.totalClicks; + } + + // Builder class for constructing object + public static class Builder { + + private List results; + private LinkTrackingMetadata metadata; + private Integer totalClicks; + + public Builder( + List results, + LinkTrackingMetadata metadata + ) { + this.results = results; + this.metadata = metadata; + } + + public Builder totalClicks(Integer totalClicks) { + this.totalClicks = totalClicks; + return this; + } + + public SinglesendsLinkStatsResponse build() { + return new SinglesendsLinkStatsResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SinglesendsLinkStatsResponse.class.getSimpleName() + "(", + ")" + ); + if (results != null) joiner.add("results=" + results); + if (metadata != null) joiner.add("metadata=" + metadata); + if (totalClicks != null) joiner.add("totalClicks=" + totalClicks); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/SinglesendsLinkStatsResponseResultsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/SinglesendsLinkStatsResponseResultsInner.java new file mode 100644 index 00000000..a030c016 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/SinglesendsLinkStatsResponseResultsInner.java @@ -0,0 +1,115 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcstats.models.AbPhase1; +import java.net.URI; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SinglesendsLinkStatsResponseResultsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("url") + @Getter + @Setter + private URI url; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("url_location") + @Getter + @Setter + private Integer urlLocation; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ab_variation") + @Getter + @Setter + private UUID abVariation; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ab_phase") + @Getter + @Setter + private AbPhase1 abPhase; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("clicks") + @Getter + @Setter + private Integer clicks; + + public SinglesendsLinkStatsResponseResultsInner() {} + + private SinglesendsLinkStatsResponseResultsInner(Builder builder) { + this.url = builder.url; + this.urlLocation = builder.urlLocation; + this.abVariation = builder.abVariation; + this.abPhase = builder.abPhase; + this.clicks = builder.clicks; + } + + // Builder class for constructing object + public static class Builder { + + private URI url; + private Integer urlLocation; + private UUID abVariation; + private AbPhase1 abPhase; + private Integer clicks; + + public Builder( + URI url, + UUID abVariation, + AbPhase1 abPhase, + Integer clicks + ) { + this.url = url; + this.abVariation = abVariation; + this.abPhase = abPhase; + this.clicks = clicks; + } + + public Builder urlLocation(Integer urlLocation) { + this.urlLocation = urlLocation; + return this; + } + + public SinglesendsLinkStatsResponseResultsInner build() { + return new SinglesendsLinkStatsResponseResultsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SinglesendsLinkStatsResponseResultsInner.class.getSimpleName() + + "(", + ")" + ); + if (url != null) joiner.add("url=" + url); + if (urlLocation != null) joiner.add("urlLocation=" + urlLocation); + if (abVariation != null) joiner.add("abVariation=" + abVariation); + if (abPhase != null) joiner.add("abPhase=" + abPhase); + if (clicks != null) joiner.add("clicks=" + clicks); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/SinglesendsResponse.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/SinglesendsResponse.java new file mode 100644 index 00000000..ae973269 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/SinglesendsResponse.java @@ -0,0 +1,78 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcstats.models.Metadata; +import com.sendgrid.rest.api.v3.mcstats.models.SinglesendsResponseResultsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SinglesendsResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("results") + @Getter + @Setter + private List results; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private Metadata metadata; + + public SinglesendsResponse() {} + + private SinglesendsResponse(Builder builder) { + this.results = builder.results; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private List results; + private Metadata metadata; + + public Builder( + List results, + Metadata metadata + ) { + this.results = results; + this.metadata = metadata; + } + + public SinglesendsResponse build() { + return new SinglesendsResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SinglesendsResponse.class.getSimpleName() + "(", + ")" + ); + if (results != null) joiner.add("results=" + results); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/SinglesendsResponseResultsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/SinglesendsResponseResultsInner.java new file mode 100644 index 00000000..178ae404 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mcstats/models/SinglesendsResponseResultsInner.java @@ -0,0 +1,113 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Statistics API + * The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + * + * 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.mcstats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mcstats.models.AbPhase; +import com.sendgrid.rest.api.v3.mcstats.models.Metrics; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SinglesendsResponseResultsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private UUID id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ab_variation") + @Getter + @Setter + private UUID abVariation; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ab_phase") + @Getter + @Setter + private AbPhase abPhase; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("aggregation") + @Getter + @Setter + private String aggregation; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("stats") + @Getter + @Setter + private Metrics stats; + + public SinglesendsResponseResultsInner() {} + + private SinglesendsResponseResultsInner(Builder builder) { + this.id = builder.id; + this.abVariation = builder.abVariation; + this.abPhase = builder.abPhase; + this.aggregation = builder.aggregation; + this.stats = builder.stats; + } + + // Builder class for constructing object + public static class Builder { + + private UUID id; + private UUID abVariation; + private AbPhase abPhase; + private String aggregation; + private Metrics stats; + + public Builder(UUID id, UUID abVariation, AbPhase abPhase) { + this.id = id; + this.abVariation = abVariation; + this.abPhase = abPhase; + } + + public Builder aggregation(String aggregation) { + this.aggregation = aggregation; + return this; + } + + public Builder stats(Metrics stats) { + this.stats = stats; + return this; + } + + public SinglesendsResponseResultsInner build() { + return new SinglesendsResponseResultsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SinglesendsResponseResultsInner.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (abVariation != null) joiner.add("abVariation=" + abVariation); + if (abPhase != null) joiner.add("abPhase=" + abPhase); + if (aggregation != null) joiner.add("aggregation=" + aggregation); + if (stats != null) joiner.add("stats=" + stats); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mctest/SendTestMarketingEmail.java b/src/main/java/com/sendgrid/rest/api/v3/mctest/SendTestMarketingEmail.java new file mode 100644 index 00000000..8a737ddf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mctest/SendTestMarketingEmail.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Send Test Email API + * The Twilio SendGrid Test Email API allows you to test a marketing email by first sending it to a list of up to 10 email addresses before pushing to a contact list or segment. With this feature, you can test the layout and content of your message in multiple email clients and with multiple recipients to see how it will function in a real-world scenario. + * + * 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.mctest; + +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.mctest.models.ErrorResponse; +import com.sendgrid.rest.api.v3.mctest.models.SendTestMarketingEmailRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class SendTestMarketingEmail extends ApiKeyBase { + + @Setter + private SendTestMarketingEmailRequest sendTestMarketingEmailRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/marketing/test/send_email"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "SendTestMarketingEmail 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), Object.class), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (sendTestMarketingEmailRequest != null) { + request.addBody(JsonUtil.toJson(sendTestMarketingEmailRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mctest/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/mctest/models/ErrorResponse.java new file mode 100644 index 00000000..9ed97c88 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mctest/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Send Test Email API + * The Twilio SendGrid Test Email API allows you to test a marketing email by first sending it to a list of up to 10 email addresses before pushing to a contact list or segment. With this feature, you can test the layout and content of your message in multiple email clients and with multiple recipients to see how it will function in a real-world scenario. + * + * 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.mctest.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.mctest.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mctest/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/mctest/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..9ae3fd6e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mctest/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Send Test Email API + * The Twilio SendGrid Test Email API allows you to test a marketing email by first sending it to a list of up to 10 email addresses before pushing to a contact list or segment. With this feature, you can test the layout and content of your message in multiple email clients and with multiple recipients to see how it will function in a real-world scenario. + * + * 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.mctest.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/mctest/models/SendTestMarketingEmailRequest.java b/src/main/java/com/sendgrid/rest/api/v3/mctest/models/SendTestMarketingEmailRequest.java new file mode 100644 index 00000000..1a733940 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/mctest/models/SendTestMarketingEmailRequest.java @@ -0,0 +1,150 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Marketing Campaigns Send Test Email API + * The Twilio SendGrid Test Email API allows you to test a marketing email by first sending it to a list of up to 10 email addresses before pushing to a contact list or segment. With this feature, you can test the layout and content of your message in multiple email clients and with multiple recipients to see how it will function in a real-world scenario. + * + * 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.mctest.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SendTestMarketingEmailRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("template_id") + @Getter + @Setter + private UUID templateId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("version_id_override") + @Getter + @Setter + private UUID versionIdOverride; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sender_id") + @Getter + @Setter + private Integer senderId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_unsubscribe_url") + @Getter + @Setter + private String customUnsubscribeUrl; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("suppression_group_id") + @Getter + @Setter + private Integer suppressionGroupId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("emails") + @Getter + @Setter + private List emails; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("from_address") + @Getter + @Setter + private String fromAddress; + + public SendTestMarketingEmailRequest() {} + + private SendTestMarketingEmailRequest(Builder builder) { + this.templateId = builder.templateId; + this.versionIdOverride = builder.versionIdOverride; + this.senderId = builder.senderId; + this.customUnsubscribeUrl = builder.customUnsubscribeUrl; + this.suppressionGroupId = builder.suppressionGroupId; + this.emails = builder.emails; + this.fromAddress = builder.fromAddress; + } + + // Builder class for constructing object + public static class Builder { + + private UUID templateId; + private UUID versionIdOverride; + private Integer senderId; + private String customUnsubscribeUrl; + private Integer suppressionGroupId; + private List emails; + private String fromAddress; + + public Builder(UUID templateId, List emails) { + this.templateId = templateId; + this.emails = emails; + } + + public Builder versionIdOverride(UUID versionIdOverride) { + this.versionIdOverride = versionIdOverride; + return this; + } + + public Builder senderId(Integer senderId) { + this.senderId = senderId; + return this; + } + + public Builder customUnsubscribeUrl(String customUnsubscribeUrl) { + this.customUnsubscribeUrl = customUnsubscribeUrl; + return this; + } + + public Builder suppressionGroupId(Integer suppressionGroupId) { + this.suppressionGroupId = suppressionGroupId; + return this; + } + + public Builder fromAddress(String fromAddress) { + this.fromAddress = fromAddress; + return this; + } + + public SendTestMarketingEmailRequest build() { + return new SendTestMarketingEmailRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SendTestMarketingEmailRequest.class.getSimpleName() + "(", + ")" + ); + if (templateId != null) joiner.add("templateId=" + templateId); + if (versionIdOverride != null) joiner.add( + "versionIdOverride=" + versionIdOverride + ); + if (senderId != null) joiner.add("senderId=" + senderId); + if (customUnsubscribeUrl != null) joiner.add( + "customUnsubscribeUrl=" + customUnsubscribeUrl + ); + if (suppressionGroupId != null) joiner.add( + "suppressionGroupId=" + suppressionGroupId + ); + if (emails != null) joiner.add("emails=" + emails); + if (fromAddress != null) joiner.add("fromAddress=" + fromAddress); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/partner/ListPartnerSetting.java b/src/main/java/com/sendgrid/rest/api/v3/partner/ListPartnerSetting.java new file mode 100644 index 00000000..8970d35d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/partner/ListPartnerSetting.java @@ -0,0 +1,101 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Partner API + * The Twilio SendGrid Partner Settings API allows you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners and how you can begin integrating with them, please visit our [Partners page](https://sendgrid.com/partners/marketplace/). + * + * 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.partner; + +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.partner.models.ListPartnerSetting200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListPartnerSetting extends ApiKeyBase { + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/partner_settings"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListPartnerSetting creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + ListPartnerSetting200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/partner/models/ListPartnerSetting200Response.java b/src/main/java/com/sendgrid/rest/api/v3/partner/models/ListPartnerSetting200Response.java new file mode 100644 index 00000000..43153689 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/partner/models/ListPartnerSetting200Response.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Partner API + * The Twilio SendGrid Partner Settings API allows you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners and how you can begin integrating with them, please visit our [Partners page](https://sendgrid.com/partners/marketplace/). + * + * 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.partner.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.partner.models.ListPartnerSetting200ResponseResultInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListPartnerSetting200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + public ListPartnerSetting200Response() {} + + private ListPartnerSetting200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + + public Builder() {} + + public Builder result( + List result + ) { + this.result = result; + return this; + } + + public ListPartnerSetting200Response build() { + return new ListPartnerSetting200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListPartnerSetting200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/partner/models/ListPartnerSetting200ResponseResultInner.java b/src/main/java/com/sendgrid/rest/api/v3/partner/models/ListPartnerSetting200ResponseResultInner.java new file mode 100644 index 00000000..f16eeaaf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/partner/models/ListPartnerSetting200ResponseResultInner.java @@ -0,0 +1,98 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Partner API + * The Twilio SendGrid Partner Settings API allows you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners and how you can begin integrating with them, please visit our [Partners page](https://sendgrid.com/partners/marketplace/). + * + * 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.partner.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListPartnerSetting200ResponseResultInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("title") + @Getter + @Setter + private String title; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + @Getter + @Setter + private String description; + + public ListPartnerSetting200ResponseResultInner() {} + + private ListPartnerSetting200ResponseResultInner(Builder builder) { + this.title = builder.title; + this.enabled = builder.enabled; + this.name = builder.name; + this.description = builder.description; + } + + // Builder class for constructing object + public static class Builder { + + private String title; + private Boolean enabled; + private String name; + private String description; + + public Builder( + String title, + Boolean enabled, + String name, + String description + ) { + this.title = title; + this.enabled = enabled; + this.name = name; + this.description = description; + } + + public ListPartnerSetting200ResponseResultInner build() { + return new ListPartnerSetting200ResponseResultInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListPartnerSetting200ResponseResultInner.class.getSimpleName() + + "(", + ")" + ); + if (title != null) joiner.add("title=" + title); + if (enabled != null) joiner.add("enabled=" + enabled); + if (name != null) joiner.add("name=" + name); + if (description != null) joiner.add("description=" + description); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/recipientsdataerasure/EraseRecipientEmailData.java b/src/main/java/com/sendgrid/rest/api/v3/recipientsdataerasure/EraseRecipientEmailData.java new file mode 100644 index 00000000..1d1a40cb --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/recipientsdataerasure/EraseRecipientEmailData.java @@ -0,0 +1,157 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Recipients' Data Erasure API + * The Recipients' Data Erasure API allows Twilio SendGrid customers to delete their own customers' personal data from the Twilio SendGrid Platform. The use of this API facilitates the self-service removal of email personal data from the Twilio SendGrid platform and will enable customers to comply with various obligatory data privacy regulations. + * + * 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.recipientsdataerasure; + +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.recipientsdataerasure.models.RecipientsDataErasureEraseRecipientsRequest; +import com.sendgrid.rest.api.v3.recipientsdataerasure.models.RecipientsDataErasureJobId; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class EraseRecipientEmailData extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private RecipientsDataErasureEraseRecipientsRequest recipientsDataErasureEraseRecipientsRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/recipients/erasejob"; + 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( + "EraseRecipientEmailData 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() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + Object error = JsonUtil.fromJson( + response.getStream(), + Object.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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 addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (recipientsDataErasureEraseRecipientsRequest != null) { + request.addBody( + JsonUtil.toJson(recipientsDataErasureEraseRecipientsRequest) + ); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/recipientsdataerasure/models/RecipientsDataErasureEraseRecipientsRequest.java b/src/main/java/com/sendgrid/rest/api/v3/recipientsdataerasure/models/RecipientsDataErasureEraseRecipientsRequest.java new file mode 100644 index 00000000..1325b9f5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/recipientsdataerasure/models/RecipientsDataErasureEraseRecipientsRequest.java @@ -0,0 +1,66 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Recipients' Data Erasure API + * The Recipients' Data Erasure API allows Twilio SendGrid customers to delete their own customers' personal data from the Twilio SendGrid Platform. The use of this API facilitates the self-service removal of email personal data from the Twilio SendGrid platform and will enable customers to comply with various obligatory data privacy regulations. + * + * 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.recipientsdataerasure.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class RecipientsDataErasureEraseRecipientsRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email_addresses") + @Getter + @Setter + private List emailAddresses; + + public RecipientsDataErasureEraseRecipientsRequest() {} + + private RecipientsDataErasureEraseRecipientsRequest(Builder builder) { + this.emailAddresses = builder.emailAddresses; + } + + // Builder class for constructing object + public static class Builder { + + private List emailAddresses; + + public Builder(List emailAddresses) { + this.emailAddresses = emailAddresses; + } + + public RecipientsDataErasureEraseRecipientsRequest build() { + return new RecipientsDataErasureEraseRecipientsRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + RecipientsDataErasureEraseRecipientsRequest.class.getSimpleName() + + "(", + ")" + ); + if (emailAddresses != null) joiner.add( + "emailAddresses=" + emailAddresses + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/recipientsdataerasure/models/RecipientsDataErasureErrorV1.java b/src/main/java/com/sendgrid/rest/api/v3/recipientsdataerasure/models/RecipientsDataErasureErrorV1.java new file mode 100644 index 00000000..5af0e4b8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/recipientsdataerasure/models/RecipientsDataErasureErrorV1.java @@ -0,0 +1,72 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Recipients' Data Erasure API + * The Recipients' Data Erasure API allows Twilio SendGrid customers to delete their own customers' personal data from the Twilio SendGrid Platform. The use of this API facilitates the self-service removal of email personal data from the Twilio SendGrid platform and will enable customers to comply with various obligatory data privacy regulations. + * + * 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.recipientsdataerasure.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class RecipientsDataErasureErrorV1 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + public RecipientsDataErasureErrorV1() {} + + private RecipientsDataErasureErrorV1(Builder builder) { + this.message = builder.message; + this.field = builder.field; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + + public Builder(String message, String field) { + this.message = message; + this.field = field; + } + + public RecipientsDataErasureErrorV1 build() { + return new RecipientsDataErasureErrorV1(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + RecipientsDataErasureErrorV1.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/recipientsdataerasure/models/RecipientsDataErasureJobId.java b/src/main/java/com/sendgrid/rest/api/v3/recipientsdataerasure/models/RecipientsDataErasureJobId.java new file mode 100644 index 00000000..2a10d97b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/recipientsdataerasure/models/RecipientsDataErasureJobId.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Recipients' Data Erasure API + * The Recipients' Data Erasure API allows Twilio SendGrid customers to delete their own customers' personal data from the Twilio SendGrid Platform. The use of this API facilitates the self-service removal of email personal data from the Twilio SendGrid platform and will enable customers to comply with various obligatory data privacy regulations. + * + * 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.recipientsdataerasure.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class RecipientsDataErasureJobId { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("job_id") + @Getter + @Setter + private String jobId; + + public RecipientsDataErasureJobId() {} + + private RecipientsDataErasureJobId(Builder builder) { + this.jobId = builder.jobId; + } + + // Builder class for constructing object + public static class Builder { + + private String jobId; + + public Builder(String jobId) { + this.jobId = jobId; + } + + public RecipientsDataErasureJobId build() { + return new RecipientsDataErasureJobId(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + RecipientsDataErasureJobId.class.getSimpleName() + "(", + ")" + ); + if (jobId != null) joiner.add("jobId=" + jobId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/DeleteReverseDns.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/DeleteReverseDns.java new file mode 100644 index 00000000..c4127d49 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/DeleteReverseDns.java @@ -0,0 +1,88 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns; + +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 lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteReverseDns extends ApiKeyBase { + + private final String id; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/ips/{id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteReverseDns creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/GetReverseDns.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/GetReverseDns.java new file mode 100644 index 00000000..48e92bb7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/GetReverseDns.java @@ -0,0 +1,89 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns; + +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.reversedns.models.ReverseDns; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetReverseDns extends ApiKeyBase { + + private final String id; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/ips/{id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetReverseDns creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), ReverseDns.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/ListReverseDns.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/ListReverseDns.java new file mode 100644 index 00000000..04a495c4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/ListReverseDns.java @@ -0,0 +1,103 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns; + +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.reversedns.models.ReverseDns; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListReverseDns extends ApiKeyBase { + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private String ip; + + @Setter + private String onBehalfOf; + + public ApiResponse> send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/ips"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListReverseDns creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (ip != null) { + request.addQueryParam("ip", ip.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/SetUpReverseDns.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/SetUpReverseDns.java new file mode 100644 index 00000000..cb964169 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/SetUpReverseDns.java @@ -0,0 +1,91 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns; + +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.reversedns.models.ReverseDns; +import com.sendgrid.rest.api.v3.reversedns.models.SetUpReverseDnsRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class SetUpReverseDns extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private SetUpReverseDnsRequest setUpReverseDnsRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/whitelabel/ips"; + 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( + "SetUpReverseDns creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), ReverseDns.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (setUpReverseDnsRequest != null) { + request.addBody(JsonUtil.toJson(setUpReverseDnsRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/ValidateReverseDns.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/ValidateReverseDns.java new file mode 100644 index 00000000..039e0821 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/ValidateReverseDns.java @@ -0,0 +1,123 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns; + +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.reversedns.models.ValidateReverseDns200Response; +import com.sendgrid.rest.api.v3.reversedns.models.ValidateReverseDns404Response; +import com.sendgrid.rest.api.v3.reversedns.models.ValidateReverseDns500Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ValidateReverseDns extends ApiKeyBase { + + private final String id; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/whitelabel/ips/{id}/validate"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ValidateReverseDns creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ValidateReverseDns404Response error = JsonUtil.fromJson( + response.getStream(), + ValidateReverseDns404Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ValidateReverseDns500Response error = JsonUtil.fromJson( + response.getStream(), + ValidateReverseDns500Response.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(), + ValidateReverseDns200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ReverseDns.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ReverseDns.java new file mode 100644 index 00000000..aa520e4e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ReverseDns.java @@ -0,0 +1,176 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.reversedns.models.ReverseDnsARecord; +import com.sendgrid.rest.api.v3.reversedns.models.ReverseDnsUsersInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ReverseDns { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("rdns") + @Getter + @Setter + private String rdns; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("users") + @Getter + @Setter + private List users; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subdomain") + @Getter + @Setter + private String subdomain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("domain") + @Getter + @Setter + private String domain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Boolean valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("legacy") + @Getter + @Setter + private Boolean legacy; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_validation_attempt_at") + @Getter + @Setter + private Integer lastValidationAttemptAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("a_record") + @Getter + @Setter + private ReverseDnsARecord aRecord; + + public ReverseDns() {} + + private ReverseDns(Builder builder) { + this.id = builder.id; + this.ip = builder.ip; + this.rdns = builder.rdns; + this.users = builder.users; + this.subdomain = builder.subdomain; + this.domain = builder.domain; + this.valid = builder.valid; + this.legacy = builder.legacy; + this.lastValidationAttemptAt = builder.lastValidationAttemptAt; + this.aRecord = builder.aRecord; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private String ip; + private String rdns; + private List users; + private String subdomain; + private String domain; + private Boolean valid; + private Boolean legacy; + private Integer lastValidationAttemptAt; + private ReverseDnsARecord aRecord; + + public Builder( + Integer id, + String ip, + String rdns, + List users, + String domain, + Boolean valid, + Boolean legacy, + ReverseDnsARecord aRecord + ) { + this.id = id; + this.ip = ip; + this.rdns = rdns; + this.users = users; + this.domain = domain; + this.valid = valid; + this.legacy = legacy; + this.aRecord = aRecord; + } + + public Builder subdomain(String subdomain) { + this.subdomain = subdomain; + return this; + } + + public Builder lastValidationAttemptAt( + Integer lastValidationAttemptAt + ) { + this.lastValidationAttemptAt = lastValidationAttemptAt; + return this; + } + + public ReverseDns build() { + return new ReverseDns(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ReverseDns.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (ip != null) joiner.add("ip=" + ip); + if (rdns != null) joiner.add("rdns=" + rdns); + if (users != null) joiner.add("users=" + users); + if (subdomain != null) joiner.add("subdomain=" + subdomain); + if (domain != null) joiner.add("domain=" + domain); + if (valid != null) joiner.add("valid=" + valid); + if (legacy != null) joiner.add("legacy=" + legacy); + if (lastValidationAttemptAt != null) joiner.add( + "lastValidationAttemptAt=" + lastValidationAttemptAt + ); + if (aRecord != null) joiner.add("aRecord=" + aRecord); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ReverseDnsARecord.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ReverseDnsARecord.java new file mode 100644 index 00000000..29debe8a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ReverseDnsARecord.java @@ -0,0 +1,92 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ReverseDnsARecord { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Boolean valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("host") + @Getter + @Setter + private String host; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("data") + @Getter + @Setter + private String data; + + public ReverseDnsARecord() {} + + private ReverseDnsARecord(Builder builder) { + this.valid = builder.valid; + this.type = builder.type; + this.host = builder.host; + this.data = builder.data; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean valid; + private String type; + private String host; + private String data; + + public Builder(Boolean valid, String type, String host, String data) { + this.valid = valid; + this.type = type; + this.host = host; + this.data = data; + } + + public ReverseDnsARecord build() { + return new ReverseDnsARecord(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ReverseDnsARecord.class.getSimpleName() + "(", + ")" + ); + if (valid != null) joiner.add("valid=" + valid); + if (type != null) joiner.add("type=" + type); + if (host != null) joiner.add("host=" + host); + if (data != null) joiner.add("data=" + data); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ReverseDnsUsersInner.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ReverseDnsUsersInner.java new file mode 100644 index 00000000..8c5a5218 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ReverseDnsUsersInner.java @@ -0,0 +1,72 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ReverseDnsUsersInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("user_id") + @Getter + @Setter + private Integer userId; + + public ReverseDnsUsersInner() {} + + private ReverseDnsUsersInner(Builder builder) { + this.username = builder.username; + this.userId = builder.userId; + } + + // Builder class for constructing object + public static class Builder { + + private String username; + private Integer userId; + + public Builder(String username, Integer userId) { + this.username = username; + this.userId = userId; + } + + public ReverseDnsUsersInner build() { + return new ReverseDnsUsersInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ReverseDnsUsersInner.class.getSimpleName() + "(", + ")" + ); + if (username != null) joiner.add("username=" + username); + if (userId != null) joiner.add("userId=" + userId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/SetUpReverseDnsRequest.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/SetUpReverseDnsRequest.java new file mode 100644 index 00000000..db058416 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/SetUpReverseDnsRequest.java @@ -0,0 +1,86 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SetUpReverseDnsRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subdomain") + @Getter + @Setter + private String subdomain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("domain") + @Getter + @Setter + private String domain; + + public SetUpReverseDnsRequest() {} + + private SetUpReverseDnsRequest(Builder builder) { + this.ip = builder.ip; + this.subdomain = builder.subdomain; + this.domain = builder.domain; + } + + // Builder class for constructing object + public static class Builder { + + private String ip; + private String subdomain; + private String domain; + + public Builder(String ip, String domain) { + this.ip = ip; + this.domain = domain; + } + + public Builder subdomain(String subdomain) { + this.subdomain = subdomain; + return this; + } + + public SetUpReverseDnsRequest build() { + return new SetUpReverseDnsRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SetUpReverseDnsRequest.class.getSimpleName() + "(", + ")" + ); + if (ip != null) joiner.add("ip=" + ip); + if (subdomain != null) joiner.add("subdomain=" + subdomain); + if (domain != null) joiner.add("domain=" + domain); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/Valid.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/Valid.java new file mode 100644 index 00000000..d3e24f02 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/Valid.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Valid { + TRUE("true"), + + FALSE("false"); + + private final String value; + + private Valid(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Valid forValue(final String value) { + return Promoter.enumFromString(value, Valid.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/Valid1.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/Valid1.java new file mode 100644 index 00000000..9429d05e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/Valid1.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Valid1 { + TRUE("true"), + + FALSE("false"); + + private final String value; + + private Valid1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Valid1 forValue(final String value) { + return Promoter.enumFromString(value, Valid1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns200Response.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns200Response.java new file mode 100644 index 00000000..0996add7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns200Response.java @@ -0,0 +1,90 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.reversedns.models.Valid; +import com.sendgrid.rest.api.v3.reversedns.models.ValidateReverseDns200ResponseValidationResults; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateReverseDns200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Valid valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("validation_results") + @Getter + @Setter + private ValidateReverseDns200ResponseValidationResults validationResults; + + public ValidateReverseDns200Response() {} + + private ValidateReverseDns200Response(Builder builder) { + this.id = builder.id; + this.valid = builder.valid; + this.validationResults = builder.validationResults; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private Valid valid; + private ValidateReverseDns200ResponseValidationResults validationResults; + + public Builder( + Integer id, + Valid valid, + ValidateReverseDns200ResponseValidationResults validationResults + ) { + this.id = id; + this.valid = valid; + this.validationResults = validationResults; + } + + public ValidateReverseDns200Response build() { + return new ValidateReverseDns200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateReverseDns200Response.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (valid != null) joiner.add("valid=" + valid); + if (validationResults != null) joiner.add( + "validationResults=" + validationResults + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns200ResponseValidationResults.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns200ResponseValidationResults.java new file mode 100644 index 00000000..d4228f77 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns200ResponseValidationResults.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.reversedns.models.ValidateReverseDns200ResponseValidationResultsARecord; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateReverseDns200ResponseValidationResults { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("a_record") + @Getter + @Setter + private ValidateReverseDns200ResponseValidationResultsARecord aRecord; + + public ValidateReverseDns200ResponseValidationResults() {} + + private ValidateReverseDns200ResponseValidationResults(Builder builder) { + this.aRecord = builder.aRecord; + } + + // Builder class for constructing object + public static class Builder { + + private ValidateReverseDns200ResponseValidationResultsARecord aRecord; + + public Builder() {} + + public Builder aRecord( + ValidateReverseDns200ResponseValidationResultsARecord aRecord + ) { + this.aRecord = aRecord; + return this; + } + + public ValidateReverseDns200ResponseValidationResults build() { + return new ValidateReverseDns200ResponseValidationResults(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateReverseDns200ResponseValidationResults.class.getSimpleName() + + "(", + ")" + ); + if (aRecord != null) joiner.add("aRecord=" + aRecord); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns200ResponseValidationResultsARecord.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns200ResponseValidationResultsARecord.java new file mode 100644 index 00000000..2bcc40f0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns200ResponseValidationResultsARecord.java @@ -0,0 +1,78 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.reversedns.models.Valid1; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateReverseDns200ResponseValidationResultsARecord { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Valid1 valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reason") + @Getter + @Setter + private String reason; + + public ValidateReverseDns200ResponseValidationResultsARecord() {} + + private ValidateReverseDns200ResponseValidationResultsARecord( + Builder builder + ) { + this.valid = builder.valid; + this.reason = builder.reason; + } + + // Builder class for constructing object + public static class Builder { + + private Valid1 valid; + private String reason; + + public Builder(Valid1 valid, String reason) { + this.valid = valid; + this.reason = reason; + } + + public ValidateReverseDns200ResponseValidationResultsARecord build() { + return new ValidateReverseDns200ResponseValidationResultsARecord( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateReverseDns200ResponseValidationResultsARecord.class.getSimpleName() + + "(", + ")" + ); + if (valid != null) joiner.add("valid=" + valid); + if (reason != null) joiner.add("reason=" + reason); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns404Response.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns404Response.java new file mode 100644 index 00000000..5d7f022d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns404Response.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.reversedns.models.ValidateReverseDns404ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateReverseDns404Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ValidateReverseDns404Response() {} + + private ValidateReverseDns404Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder(List errors) { + this.errors = errors; + } + + public ValidateReverseDns404Response build() { + return new ValidateReverseDns404Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateReverseDns404Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns404ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns404ResponseErrorsInner.java new file mode 100644 index 00000000..935de2ac --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns404ResponseErrorsInner.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateReverseDns404ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public ValidateReverseDns404ResponseErrorsInner() {} + + private ValidateReverseDns404ResponseErrorsInner(Builder builder) { + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + + public Builder(String message) { + this.message = message; + } + + public ValidateReverseDns404ResponseErrorsInner build() { + return new ValidateReverseDns404ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateReverseDns404ResponseErrorsInner.class.getSimpleName() + + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns500Response.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns500Response.java new file mode 100644 index 00000000..6c55c1cf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns500Response.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.reversedns.models.ValidateReverseDns500ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateReverseDns500Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ValidateReverseDns500Response() {} + + private ValidateReverseDns500Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder(List errors) { + this.errors = errors; + } + + public ValidateReverseDns500Response build() { + return new ValidateReverseDns500Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateReverseDns500Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns500ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns500ResponseErrorsInner.java new file mode 100644 index 00000000..5875c27b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/reversedns/models/ValidateReverseDns500ResponseErrorsInner.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Reverse DNS API + * The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + * + * 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.reversedns.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ValidateReverseDns500ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public ValidateReverseDns500ResponseErrorsInner() {} + + private ValidateReverseDns500ResponseErrorsInner(Builder builder) { + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + + public Builder(String message) { + this.message = message; + } + + public ValidateReverseDns500ResponseErrorsInner build() { + return new ValidateReverseDns500ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ValidateReverseDns500ResponseErrorsInner.class.getSimpleName() + + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/CreateScheduledSend.java b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/CreateScheduledSend.java new file mode 100644 index 00000000..dd056905 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/CreateScheduledSend.java @@ -0,0 +1,162 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scheduled Sends API + * The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + * + * 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.scheduledsends; + +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.scheduledsends.models.CancelOrPauseAScheduledSendRequest; +import com.sendgrid.rest.api.v3.scheduledsends.models.ErrorResponse; +import com.sendgrid.rest.api.v3.scheduledsends.models.ScheduledSendStatus; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateScheduledSend extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private CancelOrPauseAScheduledSendRequest cancelOrPauseAScheduledSendRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/scheduled_sends"; + 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( + "CreateScheduledSend 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), ScheduledSendStatus.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (cancelOrPauseAScheduledSendRequest != null) { + request.addBody( + JsonUtil.toJson(cancelOrPauseAScheduledSendRequest) + ); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/DeleteScheduledSend.java b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/DeleteScheduledSend.java new file mode 100644 index 00000000..c9d6ce48 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/DeleteScheduledSend.java @@ -0,0 +1,151 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scheduled Sends API + * The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + * + * 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.scheduledsends; + +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.scheduledsends.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteScheduledSend extends ApiKeyBase { + + private final String batchId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/user/scheduled_sends/{batch_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteScheduledSend 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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 (batchId != null) { + request.addPathParam("batch_id", batchId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/GetScheduledSend.java b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/GetScheduledSend.java new file mode 100644 index 00000000..b079c492 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/GetScheduledSend.java @@ -0,0 +1,159 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scheduled Sends API + * The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + * + * 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.scheduledsends; + +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.scheduledsends.models.ErrorResponse; +import com.sendgrid.rest.api.v3.scheduledsends.models.ScheduledSendStatus; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetScheduledSend extends ApiKeyBase { + + private final String batchId; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/scheduled_sends/{batch_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetScheduledSend 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), List.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (batchId != null) { + request.addPathParam("batch_id", batchId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/ListScheduledSend.java b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/ListScheduledSend.java new file mode 100644 index 00000000..adc8daa8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/ListScheduledSend.java @@ -0,0 +1,150 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scheduled Sends API + * The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + * + * 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.scheduledsends; + +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.scheduledsends.models.ErrorResponse; +import com.sendgrid.rest.api.v3.scheduledsends.models.ScheduledSendStatus; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListScheduledSend extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/scheduled_sends"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListScheduledSend 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/UpdateScheduledSend.java b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/UpdateScheduledSend.java new file mode 100644 index 00000000..ed2aa2a6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/UpdateScheduledSend.java @@ -0,0 +1,166 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scheduled Sends API + * The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + * + * 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.scheduledsends; + +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.scheduledsends.models.ErrorResponse; +import com.sendgrid.rest.api.v3.scheduledsends.models.UpdateScheduledSendRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateScheduledSend extends ApiKeyBase { + + private final String batchId; + + @Setter + private String onBehalfOf; + + @Setter + private UpdateScheduledSendRequest updateScheduledSendRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/user/scheduled_sends/{batch_id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateScheduledSend 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (batchId != null) { + request.addPathParam("batch_id", batchId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateScheduledSendRequest != null) { + request.addBody(JsonUtil.toJson(updateScheduledSendRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/CancelOrPauseAScheduledSendRequest.java b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/CancelOrPauseAScheduledSendRequest.java new file mode 100644 index 00000000..e722b779 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/CancelOrPauseAScheduledSendRequest.java @@ -0,0 +1,73 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scheduled Sends API + * The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + * + * 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.scheduledsends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.scheduledsends.models.Status; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CancelOrPauseAScheduledSendRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("batch_id") + @Getter + @Setter + private String batchId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private Status status; + + public CancelOrPauseAScheduledSendRequest() {} + + private CancelOrPauseAScheduledSendRequest(Builder builder) { + this.batchId = builder.batchId; + this.status = builder.status; + } + + // Builder class for constructing object + public static class Builder { + + private String batchId; + private Status status; + + public Builder(String batchId, Status status) { + this.batchId = batchId; + this.status = status; + } + + public CancelOrPauseAScheduledSendRequest build() { + return new CancelOrPauseAScheduledSendRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CancelOrPauseAScheduledSendRequest.class.getSimpleName() + "(", + ")" + ); + if (batchId != null) joiner.add("batchId=" + batchId); + if (status != null) joiner.add("status=" + status); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/ErrorResponse.java new file mode 100644 index 00000000..e2248875 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scheduled Sends API + * The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + * + * 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.scheduledsends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.scheduledsends.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..522aba01 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scheduled Sends API + * The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + * + * 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.scheduledsends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/MailBatchId.java b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/MailBatchId.java new file mode 100644 index 00000000..4e91728e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/MailBatchId.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scheduled Sends API + * The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + * + * 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.scheduledsends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class MailBatchId { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("batch_id") + @Getter + @Setter + private String batchId; + + public MailBatchId() {} + + private MailBatchId(Builder builder) { + this.batchId = builder.batchId; + } + + // Builder class for constructing object + public static class Builder { + + private String batchId; + + public Builder(String batchId) { + this.batchId = batchId; + } + + public MailBatchId build() { + return new MailBatchId(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + MailBatchId.class.getSimpleName() + "(", + ")" + ); + if (batchId != null) joiner.add("batchId=" + batchId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/ScheduledSendStatus.java b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/ScheduledSendStatus.java new file mode 100644 index 00000000..2dd786a3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/ScheduledSendStatus.java @@ -0,0 +1,73 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scheduled Sends API + * The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + * + * 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.scheduledsends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.scheduledsends.models.Status2; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ScheduledSendStatus { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("batch_id") + @Getter + @Setter + private String batchId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private Status2 status; + + public ScheduledSendStatus() {} + + private ScheduledSendStatus(Builder builder) { + this.batchId = builder.batchId; + this.status = builder.status; + } + + // Builder class for constructing object + public static class Builder { + + private String batchId; + private Status2 status; + + public Builder(String batchId, Status2 status) { + this.batchId = batchId; + this.status = status; + } + + public ScheduledSendStatus build() { + return new ScheduledSendStatus(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ScheduledSendStatus.class.getSimpleName() + "(", + ")" + ); + if (batchId != null) joiner.add("batchId=" + batchId); + if (status != null) joiner.add("status=" + status); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/Status.java b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/Status.java new file mode 100644 index 00000000..a22c1dec --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/Status.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scheduled Sends API + * The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + * + * 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.scheduledsends.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Status { + PAUSE("pause"), + + CANCEL("cancel"); + + private final String value; + + private Status(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Status forValue(final String value) { + return Promoter.enumFromString(value, Status.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/Status1.java b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/Status1.java new file mode 100644 index 00000000..d2c457a5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/Status1.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scheduled Sends API + * The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + * + * 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.scheduledsends.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Status1 { + CANCEL("cancel"), + + PAUSE("pause"); + + private final String value; + + private Status1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Status1 forValue(final String value) { + return Promoter.enumFromString(value, Status1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/Status2.java b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/Status2.java new file mode 100644 index 00000000..48ef5eb2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/Status2.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scheduled Sends API + * The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + * + * 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.scheduledsends.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Status2 { + CANCEL("cancel"), + + PAUSE("pause"); + + private final String value; + + private Status2(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Status2 forValue(final String value) { + return Promoter.enumFromString(value, Status2.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/UpdateScheduledSendRequest.java b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/UpdateScheduledSendRequest.java new file mode 100644 index 00000000..128f5389 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scheduledsends/models/UpdateScheduledSendRequest.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scheduled Sends API + * The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + * + * 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.scheduledsends.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.scheduledsends.models.Status1; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateScheduledSendRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private Status1 status; + + public UpdateScheduledSendRequest() {} + + private UpdateScheduledSendRequest(Builder builder) { + this.status = builder.status; + } + + // Builder class for constructing object + public static class Builder { + + private Status1 status; + + public Builder(Status1 status) { + this.status = status; + } + + public UpdateScheduledSendRequest build() { + return new UpdateScheduledSendRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateScheduledSendRequest.class.getSimpleName() + "(", + ")" + ); + if (status != null) joiner.add("status=" + status); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scopes/ApproveScopeRequest.java b/src/main/java/com/sendgrid/rest/api/v3/scopes/ApproveScopeRequest.java new file mode 100644 index 00000000..cd007274 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scopes/ApproveScopeRequest.java @@ -0,0 +1,111 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scopes API + * The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + * + * 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.scopes; + +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.scopes.models.ApproveScopeRequest200Response; +import com.sendgrid.rest.api.v3.scopes.models.DenyScopeRequest404Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ApproveScopeRequest extends ApiKeyBase { + + private final String requestId; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/scopes/requests/{request_id}/approve"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ApproveScopeRequest 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), "404")) { + DenyScopeRequest404Response error = JsonUtil.fromJson( + response.getStream(), + DenyScopeRequest404Response.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(), + ApproveScopeRequest200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (requestId != null) { + request.addPathParam("request_id", requestId.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scopes/DenyScopeRequest.java b/src/main/java/com/sendgrid/rest/api/v3/scopes/DenyScopeRequest.java new file mode 100644 index 00000000..c0af0531 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scopes/DenyScopeRequest.java @@ -0,0 +1,89 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scopes API + * The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + * + * 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.scopes; + +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.scopes.models.DenyScopeRequest404Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DenyScopeRequest extends ApiKeyBase { + + private final String requestId; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/scopes/requests/{request_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DenyScopeRequest creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + DenyScopeRequest404Response error = JsonUtil.fromJson( + response.getStream(), + DenyScopeRequest404Response.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 (requestId != null) { + request.addPathParam("request_id", requestId.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scopes/ListScope.java b/src/main/java/com/sendgrid/rest/api/v3/scopes/ListScope.java new file mode 100644 index 00000000..04055fb5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scopes/ListScope.java @@ -0,0 +1,137 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scopes API + * The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + * + * 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.scopes; + +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.scopes.models.ErrorResponse; +import com.sendgrid.rest.api.v3.scopes.models.ListScope200Response; +import com.sendgrid.rest.api.v3.scopes.models.ListScope401Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListScope extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/scopes"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListScope 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")) { + ListScope401Response error = JsonUtil.fromJson( + response.getStream(), + ListScope401Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), ListScope200Response.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scopes/ListScopeRequest.java b/src/main/java/com/sendgrid/rest/api/v3/scopes/ListScopeRequest.java new file mode 100644 index 00000000..b6411a20 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scopes/ListScopeRequest.java @@ -0,0 +1,89 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scopes API + * The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + * + * 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.scopes; + +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.scopes.models.ListScopeRequest200ResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListScopeRequest extends ApiKeyBase { + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/scopes/requests"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListScopeRequest creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ApproveScopeRequest200Response.java b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ApproveScopeRequest200Response.java new file mode 100644 index 00000000..049c7b70 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ApproveScopeRequest200Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scopes API + * The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + * + * 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.scopes.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ApproveScopeRequest200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("scope_group_name") + @Getter + @Setter + private String scopeGroupName; + + public ApproveScopeRequest200Response() {} + + private ApproveScopeRequest200Response(Builder builder) { + this.scopeGroupName = builder.scopeGroupName; + } + + // Builder class for constructing object + public static class Builder { + + private String scopeGroupName; + + public Builder() {} + + public Builder scopeGroupName(String scopeGroupName) { + this.scopeGroupName = scopeGroupName; + return this; + } + + public ApproveScopeRequest200Response build() { + return new ApproveScopeRequest200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ApproveScopeRequest200Response.class.getSimpleName() + "(", + ")" + ); + if (scopeGroupName != null) joiner.add( + "scopeGroupName=" + scopeGroupName + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scopes/models/DenyScopeRequest404Response.java b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/DenyScopeRequest404Response.java new file mode 100644 index 00000000..a8eddcaf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/DenyScopeRequest404Response.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scopes API + * The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + * + * 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.scopes.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.scopes.models.DenyScopeRequest404ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DenyScopeRequest404Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public DenyScopeRequest404Response() {} + + private DenyScopeRequest404Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors( + List errors + ) { + this.errors = errors; + return this; + } + + public DenyScopeRequest404Response build() { + return new DenyScopeRequest404Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DenyScopeRequest404Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scopes/models/DenyScopeRequest404ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/DenyScopeRequest404ResponseErrorsInner.java new file mode 100644 index 00000000..660a9b6f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/DenyScopeRequest404ResponseErrorsInner.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scopes API + * The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + * + * 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.scopes.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DenyScopeRequest404ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + public DenyScopeRequest404ResponseErrorsInner() {} + + private DenyScopeRequest404ResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public DenyScopeRequest404ResponseErrorsInner build() { + return new DenyScopeRequest404ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DenyScopeRequest404ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ErrorResponse.java new file mode 100644 index 00000000..154c2abf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scopes API + * The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + * + * 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.scopes.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.scopes.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..489e06af --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scopes API + * The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + * + * 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.scopes.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ListScope200Response.java b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ListScope200Response.java new file mode 100644 index 00000000..a015cd49 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ListScope200Response.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scopes API + * The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + * + * 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.scopes.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListScope200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("scopes") + @Getter + @Setter + private List scopes; + + public ListScope200Response() {} + + private ListScope200Response(Builder builder) { + this.scopes = builder.scopes; + } + + // Builder class for constructing object + public static class Builder { + + private List scopes; + + public Builder(List scopes) { + this.scopes = scopes; + } + + public ListScope200Response build() { + return new ListScope200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListScope200Response.class.getSimpleName() + "(", + ")" + ); + if (scopes != null) joiner.add("scopes=" + scopes); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ListScope401Response.java b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ListScope401Response.java new file mode 100644 index 00000000..95a9fa96 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ListScope401Response.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scopes API + * The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + * + * 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.scopes.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.scopes.models.ListScope401ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListScope401Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ListScope401Response() {} + + private ListScope401Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder(List errors) { + this.errors = errors; + } + + public ListScope401Response build() { + return new ListScope401Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListScope401Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ListScope401ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ListScope401ResponseErrorsInner.java new file mode 100644 index 00000000..27e04668 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ListScope401ResponseErrorsInner.java @@ -0,0 +1,76 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scopes API + * The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + * + * 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.scopes.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListScope401ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public ListScope401ResponseErrorsInner() {} + + private ListScope401ResponseErrorsInner(Builder builder) { + this.field = builder.field; + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String field; + private String message; + + public Builder(String message) { + this.message = message; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public ListScope401ResponseErrorsInner build() { + return new ListScope401ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListScope401ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (field != null) joiner.add("field=" + field); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ListScopeRequest200ResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ListScopeRequest200ResponseInner.java new file mode 100644 index 00000000..ebf72e34 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/scopes/models/ListScopeRequest200ResponseInner.java @@ -0,0 +1,137 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Scopes API + * The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + * + * 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.scopes.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListScopeRequest200ResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("scope_group_name") + @Getter + @Setter + private String scopeGroupName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + public ListScopeRequest200ResponseInner() {} + + private ListScopeRequest200ResponseInner(Builder builder) { + this.id = builder.id; + this.scopeGroupName = builder.scopeGroupName; + this.username = builder.username; + this.email = builder.email; + this.firstName = builder.firstName; + this.lastName = builder.lastName; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private String scopeGroupName; + private String username; + private String email; + private String firstName; + private String lastName; + + public Builder() {} + + public Builder id(Integer id) { + this.id = id; + return this; + } + + public Builder scopeGroupName(String scopeGroupName) { + this.scopeGroupName = scopeGroupName; + return this; + } + + public Builder username(String username) { + this.username = username; + return this; + } + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = firstName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = lastName; + return this; + } + + public ListScopeRequest200ResponseInner build() { + return new ListScopeRequest200ResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListScopeRequest200ResponseInner.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (scopeGroupName != null) joiner.add( + "scopeGroupName=" + scopeGroupName + ); + if (username != null) joiner.add("username=" + username); + if (email != null) joiner.add("email=" + email); + if (firstName != null) joiner.add("firstName=" + firstName); + if (lastName != null) joiner.add("lastName=" + lastName); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/seq/ListEngagementQualityScore.java b/src/main/java/com/sendgrid/rest/api/v3/seq/ListEngagementQualityScore.java new file mode 100644 index 00000000..e7316fe5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/seq/ListEngagementQualityScore.java @@ -0,0 +1,116 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Engagement Quality API + * The SendGrid Engagement Quality (SEQ) API allows you to retrieve metrics that define the quality of your email program. An SEQ score is correlated with: - The quality of the data in a sender’s program. - How “wanted” the sender's email is by their recipients. Because “wanted” email and deliverability are closely related, a higher SEQ metric is correlated with greater deliverability. This means the higher your SEQ score, the more likely you are to land in your recipients' inboxes. See the SEQ Overview page to understand SEQ, how it's calculated, and how you can address your score. The SEQ endpoints allow you to retrieve your scores and scores for your Subusers. + * + * 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.seq; + +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 java.time.LocalDate; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListEngagementQualityScore extends ApiKeyBase { + + private final LocalDate from; + private final LocalDate to; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/engagementquality/scores"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListEngagementQualityScore 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), "500")) { + 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 addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (from != null) { + request.addQueryParam("from", from.toString()); + } + if (to != null) { + request.addQueryParam("to", to.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/seq/ListSubuserEngagementQualityScore.java b/src/main/java/com/sendgrid/rest/api/v3/seq/ListSubuserEngagementQualityScore.java new file mode 100644 index 00000000..b6630699 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/seq/ListSubuserEngagementQualityScore.java @@ -0,0 +1,124 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Engagement Quality API + * The SendGrid Engagement Quality (SEQ) API allows you to retrieve metrics that define the quality of your email program. An SEQ score is correlated with: - The quality of the data in a sender’s program. - How “wanted” the sender's email is by their recipients. Because “wanted” email and deliverability are closely related, a higher SEQ metric is correlated with greater deliverability. This means the higher your SEQ score, the more likely you are to land in your recipients' inboxes. See the SEQ Overview page to understand SEQ, how it's calculated, and how you can address your score. The SEQ endpoints allow you to retrieve your scores and scores for your Subusers. + * + * 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.seq; + +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 java.time.LocalDate; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSubuserEngagementQualityScore extends ApiKeyBase { + + @Setter + private Integer limit; + + private final LocalDate date; + + @Setter + private Integer afterKey; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/engagementquality/subusers/scores"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSubuserEngagementQualityScore 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), "500")) { + 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 addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (date != null) { + request.addQueryParam("date", date.toString()); + } + if (afterKey != null) { + request.addQueryParam("after_key", afterKey.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/seq/models/SeqError.java b/src/main/java/com/sendgrid/rest/api/v3/seq/models/SeqError.java new file mode 100644 index 00000000..b1374e6f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/seq/models/SeqError.java @@ -0,0 +1,76 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Engagement Quality API + * The SendGrid Engagement Quality (SEQ) API allows you to retrieve metrics that define the quality of your email program. An SEQ score is correlated with: - The quality of the data in a sender’s program. - How “wanted” the sender's email is by their recipients. Because “wanted” email and deliverability are closely related, a higher SEQ metric is correlated with greater deliverability. This means the higher your SEQ score, the more likely you are to land in your recipients' inboxes. See the SEQ Overview page to understand SEQ, how it's calculated, and how you can address your score. The SEQ endpoints allow you to retrieve your scores and scores for your Subusers. + * + * 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.seq.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SeqError { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public SeqError() {} + + private SeqError(Builder builder) { + this.field = builder.field; + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String field; + private String message; + + public Builder(String message) { + this.message = message; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public SeqError build() { + return new SeqError(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SeqError.class.getSimpleName() + "(", + ")" + ); + if (field != null) joiner.add("field=" + field); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/seq/models/SeqMetadata.java b/src/main/java/com/sendgrid/rest/api/v3/seq/models/SeqMetadata.java new file mode 100644 index 00000000..b4b7268f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/seq/models/SeqMetadata.java @@ -0,0 +1,66 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Engagement Quality API + * The SendGrid Engagement Quality (SEQ) API allows you to retrieve metrics that define the quality of your email program. An SEQ score is correlated with: - The quality of the data in a sender’s program. - How “wanted” the sender's email is by their recipients. Because “wanted” email and deliverability are closely related, a higher SEQ metric is correlated with greater deliverability. This means the higher your SEQ score, the more likely you are to land in your recipients' inboxes. See the SEQ Overview page to understand SEQ, how it's calculated, and how you can address your score. The SEQ endpoints allow you to retrieve your scores and scores for your Subusers. + * + * 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.seq.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.seq.models.SeqMetadataNextParams; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SeqMetadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next_params") + @Getter + @Setter + private SeqMetadataNextParams nextParams; + + public SeqMetadata() {} + + private SeqMetadata(Builder builder) { + this.nextParams = builder.nextParams; + } + + // Builder class for constructing object + public static class Builder { + + private SeqMetadataNextParams nextParams; + + public Builder() {} + + public Builder nextParams(SeqMetadataNextParams nextParams) { + this.nextParams = nextParams; + return this; + } + + public SeqMetadata build() { + return new SeqMetadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SeqMetadata.class.getSimpleName() + "(", + ")" + ); + if (nextParams != null) joiner.add("nextParams=" + nextParams); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/seq/models/SeqMetadataNextParams.java b/src/main/java/com/sendgrid/rest/api/v3/seq/models/SeqMetadataNextParams.java new file mode 100644 index 00000000..3d7125c7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/seq/models/SeqMetadataNextParams.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Engagement Quality API + * The SendGrid Engagement Quality (SEQ) API allows you to retrieve metrics that define the quality of your email program. An SEQ score is correlated with: - The quality of the data in a sender’s program. - How “wanted” the sender's email is by their recipients. Because “wanted” email and deliverability are closely related, a higher SEQ metric is correlated with greater deliverability. This means the higher your SEQ score, the more likely you are to land in your recipients' inboxes. See the SEQ Overview page to understand SEQ, how it's calculated, and how you can address your score. The SEQ endpoints allow you to retrieve your scores and scores for your Subusers. + * + * 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.seq.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SeqMetadataNextParams { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("after_key") + @Getter + @Setter + private String afterKey; + + public SeqMetadataNextParams() {} + + private SeqMetadataNextParams(Builder builder) { + this.afterKey = builder.afterKey; + } + + // Builder class for constructing object + public static class Builder { + + private String afterKey; + + public Builder() {} + + public Builder afterKey(String afterKey) { + this.afterKey = afterKey; + return this; + } + + public SeqMetadataNextParams build() { + return new SeqMetadataNextParams(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SeqMetadataNextParams.class.getSimpleName() + "(", + ")" + ); + if (afterKey != null) joiner.add("afterKey=" + afterKey); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/seq/models/SeqMetrics.java b/src/main/java/com/sendgrid/rest/api/v3/seq/models/SeqMetrics.java new file mode 100644 index 00000000..437158be --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/seq/models/SeqMetrics.java @@ -0,0 +1,113 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Engagement Quality API + * The SendGrid Engagement Quality (SEQ) API allows you to retrieve metrics that define the quality of your email program. An SEQ score is correlated with: - The quality of the data in a sender’s program. - How “wanted” the sender's email is by their recipients. Because “wanted” email and deliverability are closely related, a higher SEQ metric is correlated with greater deliverability. This means the higher your SEQ score, the more likely you are to land in your recipients' inboxes. See the SEQ Overview page to understand SEQ, how it's calculated, and how you can address your score. The SEQ endpoints allow you to retrieve your scores and scores for your Subusers. + * + * 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.seq.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SeqMetrics { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("engagement_recency") + @Getter + @Setter + private BigDecimal engagementRecency; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("open_rate") + @Getter + @Setter + private BigDecimal openRate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounce_classification") + @Getter + @Setter + private BigDecimal bounceClassification; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounce_rate") + @Getter + @Setter + private BigDecimal bounceRate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_rate") + @Getter + @Setter + private BigDecimal spamRate; + + public SeqMetrics() {} + + private SeqMetrics(Builder builder) { + this.engagementRecency = builder.engagementRecency; + this.openRate = builder.openRate; + this.bounceClassification = builder.bounceClassification; + this.bounceRate = builder.bounceRate; + this.spamRate = builder.spamRate; + } + + // Builder class for constructing object + public static class Builder { + + private BigDecimal engagementRecency; + private BigDecimal openRate; + private BigDecimal bounceClassification; + private BigDecimal bounceRate; + private BigDecimal spamRate; + + public Builder( + BigDecimal engagementRecency, + BigDecimal openRate, + BigDecimal bounceClassification, + BigDecimal bounceRate, + BigDecimal spamRate + ) { + this.engagementRecency = engagementRecency; + this.openRate = openRate; + this.bounceClassification = bounceClassification; + this.bounceRate = bounceRate; + this.spamRate = spamRate; + } + + public SeqMetrics build() { + return new SeqMetrics(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SeqMetrics.class.getSimpleName() + "(", + ")" + ); + if (engagementRecency != null) joiner.add( + "engagementRecency=" + engagementRecency + ); + if (openRate != null) joiner.add("openRate=" + openRate); + if (bounceClassification != null) joiner.add( + "bounceClassification=" + bounceClassification + ); + if (bounceRate != null) joiner.add("bounceRate=" + bounceRate); + if (spamRate != null) joiner.add("spamRate=" + spamRate); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/seq/models/SeqScore.java b/src/main/java/com/sendgrid/rest/api/v3/seq/models/SeqScore.java new file mode 100644 index 00000000..d96f95f7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/seq/models/SeqScore.java @@ -0,0 +1,121 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Engagement Quality API + * The SendGrid Engagement Quality (SEQ) API allows you to retrieve metrics that define the quality of your email program. An SEQ score is correlated with: - The quality of the data in a sender’s program. - How “wanted” the sender's email is by their recipients. Because “wanted” email and deliverability are closely related, a higher SEQ metric is correlated with greater deliverability. This means the higher your SEQ score, the more likely you are to land in your recipients' inboxes. See the SEQ Overview page to understand SEQ, how it's calculated, and how you can address your score. The SEQ endpoints allow you to retrieve your scores and scores for your Subusers. + * + * 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.seq.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.seq.models.SeqMetrics; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SeqScore { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("user_id") + @Getter + @Setter + private String userId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("date") + @Getter + @Setter + private LocalDate date; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("score") + @Getter + @Setter + private BigDecimal score; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metrics") + @Getter + @Setter + private SeqMetrics metrics; + + public SeqScore() {} + + private SeqScore(Builder builder) { + this.userId = builder.userId; + this.username = builder.username; + this.date = builder.date; + this.score = builder.score; + this.metrics = builder.metrics; + } + + // Builder class for constructing object + public static class Builder { + + private String userId; + private String username; + private LocalDate date; + private BigDecimal score; + private SeqMetrics metrics; + + public Builder(String userId) { + this.userId = userId; + } + + public Builder username(String username) { + this.username = username; + return this; + } + + public Builder date(LocalDate date) { + this.date = date; + return this; + } + + public Builder score(BigDecimal score) { + this.score = score; + return this; + } + + public Builder metrics(SeqMetrics metrics) { + this.metrics = metrics; + return this; + } + + public SeqScore build() { + return new SeqScore(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SeqScore.class.getSimpleName() + "(", + ")" + ); + if (userId != null) joiner.add("userId=" + userId); + if (username != null) joiner.add("username=" + username); + if (date != null) joiner.add("date=" + date); + if (score != null) joiner.add("score=" + score); + if (metrics != null) joiner.add("metrics=" + metrics); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/CreateSsoCertificate.java b/src/main/java/com/sendgrid/rest/api/v3/sso/CreateSsoCertificate.java new file mode 100644 index 00000000..1409dfeb --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/CreateSsoCertificate.java @@ -0,0 +1,175 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso; + +import com.fasterxml.jackson.core.type.TypeReference; +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.sso.models.CreateSsoCertificateRequest; +import com.sendgrid.rest.api.v3.sso.models.SsoCertificateBody; +import com.sendgrid.rest.api.v3.sso.models.SsoErrorResponseInner; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateSsoCertificate extends ApiKeyBase { + + @Setter + private CreateSsoCertificateRequest createSsoCertificateRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/sso/certificates"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "CreateSsoCertificate 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")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "429")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + 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(), SsoCertificateBody.class), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (createSsoCertificateRequest != null) { + request.addBody(JsonUtil.toJson(createSsoCertificateRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/CreateSsoIntegration.java b/src/main/java/com/sendgrid/rest/api/v3/sso/CreateSsoIntegration.java new file mode 100644 index 00000000..cb6f8013 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/CreateSsoIntegration.java @@ -0,0 +1,175 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso; + +import com.fasterxml.jackson.core.type.TypeReference; +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.sso.models.PostPatchIntegrationRequest; +import com.sendgrid.rest.api.v3.sso.models.SsoErrorResponseInner; +import com.sendgrid.rest.api.v3.sso.models.SsoIntegration; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateSsoIntegration extends ApiKeyBase { + + @Setter + private PostPatchIntegrationRequest postPatchIntegrationRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/sso/integrations"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "CreateSsoIntegration 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")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "429")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + 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(), SsoIntegration.class), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (postPatchIntegrationRequest != null) { + request.addBody(JsonUtil.toJson(postPatchIntegrationRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/CreateSsoTeammate.java b/src/main/java/com/sendgrid/rest/api/v3/sso/CreateSsoTeammate.java new file mode 100644 index 00000000..45dfe38b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/CreateSsoTeammate.java @@ -0,0 +1,177 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso; + +import com.fasterxml.jackson.core.type.TypeReference; +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.sso.models.PostSsoTeammates201; +import com.sendgrid.rest.api.v3.sso.models.PostSsoTeammatesRequest; +import com.sendgrid.rest.api.v3.sso.models.SsoErrorResponseInner; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateSsoTeammate extends ApiKeyBase { + + @Setter + private PostSsoTeammatesRequest postSsoTeammatesRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/sso/teammates"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "CreateSsoTeammate 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")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "429")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + 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(), PostSsoTeammates201.class), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (postSsoTeammatesRequest != null) { + request.addBody(JsonUtil.toJson(postSsoTeammatesRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/DeleteSsoCertificate.java b/src/main/java/com/sendgrid/rest/api/v3/sso/DeleteSsoCertificate.java new file mode 100644 index 00000000..d91060ed --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/DeleteSsoCertificate.java @@ -0,0 +1,172 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso; + +import com.fasterxml.jackson.core.type.TypeReference; +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.sso.models.SsoCertificateBody; +import com.sendgrid.rest.api.v3.sso.models.SsoErrorResponseInner; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DeleteSsoCertificate extends ApiKeyBase { + + private final String certId; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/sso/certificates/{cert_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSsoCertificate 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")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "429")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + 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(), SsoCertificateBody.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (certId != null) { + request.addPathParam("cert_id", certId.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/DeleteSsoIntegration.java b/src/main/java/com/sendgrid/rest/api/v3/sso/DeleteSsoIntegration.java new file mode 100644 index 00000000..63d1d7c7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/DeleteSsoIntegration.java @@ -0,0 +1,167 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso; + +import com.fasterxml.jackson.core.type.TypeReference; +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.sso.models.SsoErrorResponseInner; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DeleteSsoIntegration extends ApiKeyBase { + + private final String id; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/sso/integrations/{id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSsoIntegration 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")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "429")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + 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 (id != null) { + request.addPathParam("id", id.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/GetSsoCertificate.java b/src/main/java/com/sendgrid/rest/api/v3/sso/GetSsoCertificate.java new file mode 100644 index 00000000..e3865d8b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/GetSsoCertificate.java @@ -0,0 +1,172 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso; + +import com.fasterxml.jackson.core.type.TypeReference; +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.sso.models.SsoCertificateBody; +import com.sendgrid.rest.api.v3.sso.models.SsoErrorResponseInner; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class GetSsoCertificate extends ApiKeyBase { + + private final String certId; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/sso/certificates/{cert_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetSsoCertificate 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")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "429")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + 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(), SsoCertificateBody.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (certId != null) { + request.addPathParam("cert_id", certId.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/GetSsoIntegration.java b/src/main/java/com/sendgrid/rest/api/v3/sso/GetSsoIntegration.java new file mode 100644 index 00000000..7678a440 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/GetSsoIntegration.java @@ -0,0 +1,183 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso; + +import com.fasterxml.jackson.core.type.TypeReference; +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.sso.models.SsoErrorResponseInner; +import com.sendgrid.rest.api.v3.sso.models.SsoIntegration; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetSsoIntegration extends ApiKeyBase { + + private final String id; + + @Setter + private Boolean si; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/sso/integrations/{id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetSsoIntegration 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")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "429")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + 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(), SsoIntegration.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addQueryParams(Request request) { + if (si != null) { + request.addQueryParam("si", si.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/ListSsoIntegration.java b/src/main/java/com/sendgrid/rest/api/v3/sso/ListSsoIntegration.java new file mode 100644 index 00000000..cd590b4e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/ListSsoIntegration.java @@ -0,0 +1,176 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso; + +import com.fasterxml.jackson.core.type.TypeReference; +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.sso.models.SsoErrorResponseInner; +import com.sendgrid.rest.api.v3.sso.models.SsoIntegration; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSsoIntegration extends ApiKeyBase { + + @Setter + private Boolean si; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/sso/integrations"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSsoIntegration 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")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "429")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + 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(), List.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (si != null) { + request.addQueryParam("si", si.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/ListSsoIntegrationCertificate.java b/src/main/java/com/sendgrid/rest/api/v3/sso/ListSsoIntegrationCertificate.java new file mode 100644 index 00000000..4168f889 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/ListSsoIntegrationCertificate.java @@ -0,0 +1,174 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso; + +import com.fasterxml.jackson.core.type.TypeReference; +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.sso.models.SsoCertificateBody; +import com.sendgrid.rest.api.v3.sso.models.SsoErrorResponseInner; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListSsoIntegrationCertificate extends ApiKeyBase { + + private final String integrationId; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/sso/integrations/{integration_id}/certificates"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSsoIntegrationCertificate 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")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "429")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + 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(), List.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (integrationId != null) { + request.addPathParam("integration_id", integrationId.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/UpdateSsoCertificate.java b/src/main/java/com/sendgrid/rest/api/v3/sso/UpdateSsoCertificate.java new file mode 100644 index 00000000..f0eeec0e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/UpdateSsoCertificate.java @@ -0,0 +1,184 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso; + +import com.fasterxml.jackson.core.type.TypeReference; +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.sso.models.SsoCertificateBody; +import com.sendgrid.rest.api.v3.sso.models.SsoErrorResponseInner; +import com.sendgrid.rest.api.v3.sso.models.UpdateSsoCertificateRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateSsoCertificate extends ApiKeyBase { + + private final String certId; + + @Setter + private UpdateSsoCertificateRequest updateSsoCertificateRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/sso/certificates/{cert_id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateSsoCertificate 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")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "429")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + 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(), SsoCertificateBody.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (certId != null) { + request.addPathParam("cert_id", certId.toString()); + } + } + + private void addBody(final Request request) { + if (updateSsoCertificateRequest != null) { + request.addBody(JsonUtil.toJson(updateSsoCertificateRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/UpdateSsoIntegration.java b/src/main/java/com/sendgrid/rest/api/v3/sso/UpdateSsoIntegration.java new file mode 100644 index 00000000..fc293002 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/UpdateSsoIntegration.java @@ -0,0 +1,194 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso; + +import com.fasterxml.jackson.core.type.TypeReference; +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.sso.models.PostPatchIntegrationRequest; +import com.sendgrid.rest.api.v3.sso.models.SsoErrorResponseInner; +import com.sendgrid.rest.api.v3.sso.models.SsoIntegration; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateSsoIntegration extends ApiKeyBase { + + private final String id; + + @Setter + private Boolean si; + + @Setter + private PostPatchIntegrationRequest postPatchIntegrationRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/sso/integrations/{id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateSsoIntegration 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")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "429")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + 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(), SsoIntegration.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addQueryParams(Request request) { + if (si != null) { + request.addQueryParam("si", si.toString()); + } + } + + private void addBody(final Request request) { + if (postPatchIntegrationRequest != null) { + request.addBody(JsonUtil.toJson(postPatchIntegrationRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/UpdateSsoTeammate.java b/src/main/java/com/sendgrid/rest/api/v3/sso/UpdateSsoTeammate.java new file mode 100644 index 00000000..44f60b9f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/UpdateSsoTeammate.java @@ -0,0 +1,186 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso; + +import com.fasterxml.jackson.core.type.TypeReference; +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.sso.models.PatchSsoTeammates200; +import com.sendgrid.rest.api.v3.sso.models.SsoErrorResponseInner; +import com.sendgrid.rest.api.v3.sso.models.SsoTeammatesBaseRequestProps; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateSsoTeammate extends ApiKeyBase { + + private final String username; + + @Setter + private SsoTeammatesBaseRequestProps body; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/sso/teammates/{username}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateSsoTeammate 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")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "429")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + TypeReference listTypeReference = new TypeReference< + List + >() {}; + List error = (List< + SsoErrorResponseInner + >) JsonUtil.fromJson( + response.getStream(), + listTypeReference + ); + 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(), PatchSsoTeammates200.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (username != null) { + request.addPathParam("username", username.toString()); + } + } + + private void addBody(final Request request) { + if (body != null) { + request.addBody(JsonUtil.toJson(body)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/CreateSsoCertificateRequest.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/CreateSsoCertificateRequest.java new file mode 100644 index 00000000..07fd1d7c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/CreateSsoCertificateRequest.java @@ -0,0 +1,88 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateSsoCertificateRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("public_certificate") + @Getter + @Setter + private String publicCertificate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("integration_id") + @Getter + @Setter + private String integrationId; + + public CreateSsoCertificateRequest() {} + + private CreateSsoCertificateRequest(Builder builder) { + this.publicCertificate = builder.publicCertificate; + this.enabled = builder.enabled; + this.integrationId = builder.integrationId; + } + + // Builder class for constructing object + public static class Builder { + + private String publicCertificate; + private Boolean enabled; + private String integrationId; + + public Builder(String publicCertificate, String integrationId) { + this.publicCertificate = publicCertificate; + this.integrationId = integrationId; + } + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public CreateSsoCertificateRequest build() { + return new CreateSsoCertificateRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateSsoCertificateRequest.class.getSimpleName() + "(", + ")" + ); + if (publicCertificate != null) joiner.add( + "publicCertificate=" + publicCertificate + ); + if (enabled != null) joiner.add("enabled=" + enabled); + if (integrationId != null) joiner.add("integrationId=" + integrationId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/PatchSsoTeammates200.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/PatchSsoTeammates200.java new file mode 100644 index 00000000..eb43ca66 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/PatchSsoTeammates200.java @@ -0,0 +1,332 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.sso.models.SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner; +import com.sendgrid.rest.api.v3.sso.models.UserType; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class PatchSsoTeammates200 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address") + @Getter + @Setter + private String address; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address2") + @Getter + @Setter + private String address2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city") + @Getter + @Setter + private String city; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("company") + @Getter + @Setter + private String company; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country") + @Getter + @Setter + private String country; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("phone") + @Getter + @Setter + private String phone; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state") + @Getter + @Setter + private String state; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("user_type") + @Getter + @Setter + private UserType userType; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("website") + @Getter + @Setter + private String website; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("zip") + @Getter + @Setter + private String zip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_admin") + @Getter + @Setter + private Boolean isAdmin; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_sso") + @Getter + @Setter + private Boolean isSso; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("scopes") + @Getter + @Setter + private List scopes; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("has_restricted_subuser_access") + @Getter + @Setter + private Boolean hasRestrictedSubuserAccess; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subuser_access") + @Getter + @Setter + private List< + SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner + > subuserAccess; + + public PatchSsoTeammates200() {} + + private PatchSsoTeammates200(Builder builder) { + this.address = builder.address; + this.address2 = builder.address2; + this.city = builder.city; + this.company = builder.company; + this.country = builder.country; + this.username = builder.username; + this.phone = builder.phone; + this.state = builder.state; + this.userType = builder.userType; + this.website = builder.website; + this.zip = builder.zip; + this.firstName = builder.firstName; + this.lastName = builder.lastName; + this.email = builder.email; + this.isAdmin = builder.isAdmin; + this.isSso = builder.isSso; + this.scopes = builder.scopes; + this.hasRestrictedSubuserAccess = builder.hasRestrictedSubuserAccess; + this.subuserAccess = builder.subuserAccess; + } + + // Builder class for constructing object + public static class Builder { + + private String address; + private String address2; + private String city; + private String company; + private String country; + private String username; + private String phone; + private String state; + private UserType userType; + private String website; + private String zip; + private String firstName; + private String lastName; + private String email; + private Boolean isAdmin; + private Boolean isSso; + private List scopes; + private Boolean hasRestrictedSubuserAccess; + private List< + SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner + > subuserAccess; + + public Builder() {} + + public Builder address(String address) { + this.address = address; + return this; + } + + public Builder address2(String address2) { + this.address2 = address2; + return this; + } + + public Builder city(String city) { + this.city = city; + return this; + } + + public Builder company(String company) { + this.company = company; + return this; + } + + public Builder country(String country) { + this.country = country; + return this; + } + + public Builder username(String username) { + this.username = username; + return this; + } + + public Builder phone(String phone) { + this.phone = phone; + return this; + } + + public Builder state(String state) { + this.state = state; + return this; + } + + public Builder userType(UserType userType) { + this.userType = userType; + return this; + } + + public Builder website(String website) { + this.website = website; + return this; + } + + public Builder zip(String zip) { + this.zip = zip; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = firstName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = lastName; + return this; + } + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder isAdmin(Boolean isAdmin) { + this.isAdmin = isAdmin; + return this; + } + + public Builder isSso(Boolean isSso) { + this.isSso = isSso; + return this; + } + + public Builder scopes(List scopes) { + this.scopes = scopes; + return this; + } + + public Builder hasRestrictedSubuserAccess( + Boolean hasRestrictedSubuserAccess + ) { + this.hasRestrictedSubuserAccess = hasRestrictedSubuserAccess; + return this; + } + + public Builder subuserAccess( + List< + SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner + > subuserAccess + ) { + this.subuserAccess = subuserAccess; + return this; + } + + public PatchSsoTeammates200 build() { + return new PatchSsoTeammates200(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + PatchSsoTeammates200.class.getSimpleName() + "(", + ")" + ); + if (address != null) joiner.add("address=" + address); + if (address2 != null) joiner.add("address2=" + address2); + if (city != null) joiner.add("city=" + city); + if (company != null) joiner.add("company=" + company); + if (country != null) joiner.add("country=" + country); + if (username != null) joiner.add("username=" + username); + if (phone != null) joiner.add("phone=" + phone); + if (state != null) joiner.add("state=" + state); + if (userType != null) joiner.add("userType=" + userType); + if (website != null) joiner.add("website=" + website); + if (zip != null) joiner.add("zip=" + zip); + if (firstName != null) joiner.add("firstName=" + firstName); + if (lastName != null) joiner.add("lastName=" + lastName); + if (email != null) joiner.add("email=" + email); + if (isAdmin != null) joiner.add("isAdmin=" + isAdmin); + if (isSso != null) joiner.add("isSso=" + isSso); + if (scopes != null) joiner.add("scopes=" + scopes); + if (hasRestrictedSubuserAccess != null) joiner.add( + "hasRestrictedSubuserAccess=" + hasRestrictedSubuserAccess + ); + if (subuserAccess != null) joiner.add("subuserAccess=" + subuserAccess); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/PermissionType.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/PermissionType.java new file mode 100644 index 00000000..8d16ac23 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/PermissionType.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum PermissionType { + ADMIN("admin"), + + RESTRICTED("restricted"); + + private final String value; + + private PermissionType(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static PermissionType forValue(final String value) { + return Promoter.enumFromString(value, PermissionType.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/PermissionType1.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/PermissionType1.java new file mode 100644 index 00000000..879db884 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/PermissionType1.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum PermissionType1 { + ADMIN("admin"), + + RESTRICTED("restricted"); + + private final String value; + + private PermissionType1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static PermissionType1 forValue(final String value) { + return Promoter.enumFromString(value, PermissionType1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/Persona.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/Persona.java new file mode 100644 index 00000000..d514bd28 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/Persona.java @@ -0,0 +1,46 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Persona { + ACCOUNTANT("accountant"), + + DEVELOPER("developer"), + + MARKETER("marketer"), + + OBSERVER("observer"); + + private final String value; + + private Persona(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Persona forValue(final String value) { + return Promoter.enumFromString(value, Persona.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/PostPatchIntegrationRequest.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/PostPatchIntegrationRequest.java new file mode 100644 index 00000000..e4caf14a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/PostPatchIntegrationRequest.java @@ -0,0 +1,124 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class PostPatchIntegrationRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("signin_url") + @Getter + @Setter + private String signinUrl; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("signout_url") + @Getter + @Setter + private String signoutUrl; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("entity_id") + @Getter + @Setter + private String entityId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("completed_integration") + @Getter + @Setter + private Boolean completedIntegration; + + public PostPatchIntegrationRequest() {} + + private PostPatchIntegrationRequest(Builder builder) { + this.name = builder.name; + this.enabled = builder.enabled; + this.signinUrl = builder.signinUrl; + this.signoutUrl = builder.signoutUrl; + this.entityId = builder.entityId; + this.completedIntegration = builder.completedIntegration; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private Boolean enabled; + private String signinUrl; + private String signoutUrl; + private String entityId; + private Boolean completedIntegration; + + public Builder( + String name, + Boolean enabled, + String signinUrl, + String signoutUrl, + String entityId + ) { + this.name = name; + this.enabled = enabled; + this.signinUrl = signinUrl; + this.signoutUrl = signoutUrl; + this.entityId = entityId; + } + + public Builder completedIntegration(Boolean completedIntegration) { + this.completedIntegration = completedIntegration; + return this; + } + + public PostPatchIntegrationRequest build() { + return new PostPatchIntegrationRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + PostPatchIntegrationRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (enabled != null) joiner.add("enabled=" + enabled); + if (signinUrl != null) joiner.add("signinUrl=" + signinUrl); + if (signoutUrl != null) joiner.add("signoutUrl=" + signoutUrl); + if (entityId != null) joiner.add("entityId=" + entityId); + if (completedIntegration != null) joiner.add( + "completedIntegration=" + completedIntegration + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/PostSsoTeammates201.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/PostSsoTeammates201.java new file mode 100644 index 00000000..f5192249 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/PostSsoTeammates201.java @@ -0,0 +1,177 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.sso.models.SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class PostSsoTeammates201 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_admin") + @Getter + @Setter + private Boolean isAdmin; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_sso") + @Getter + @Setter + private Boolean isSso; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("scopes") + @Getter + @Setter + private List scopes; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("has_restricted_subuser_access") + @Getter + @Setter + private Boolean hasRestrictedSubuserAccess; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subuser_access") + @Getter + @Setter + private List< + SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner + > subuserAccess; + + public PostSsoTeammates201() {} + + private PostSsoTeammates201(Builder builder) { + this.firstName = builder.firstName; + this.lastName = builder.lastName; + this.email = builder.email; + this.isAdmin = builder.isAdmin; + this.isSso = builder.isSso; + this.scopes = builder.scopes; + this.hasRestrictedSubuserAccess = builder.hasRestrictedSubuserAccess; + this.subuserAccess = builder.subuserAccess; + } + + // Builder class for constructing object + public static class Builder { + + private String firstName; + private String lastName; + private String email; + private Boolean isAdmin; + private Boolean isSso; + private List scopes; + private Boolean hasRestrictedSubuserAccess; + private List< + SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner + > subuserAccess; + + public Builder() {} + + public Builder firstName(String firstName) { + this.firstName = firstName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = lastName; + return this; + } + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder isAdmin(Boolean isAdmin) { + this.isAdmin = isAdmin; + return this; + } + + public Builder isSso(Boolean isSso) { + this.isSso = isSso; + return this; + } + + public Builder scopes(List scopes) { + this.scopes = scopes; + return this; + } + + public Builder hasRestrictedSubuserAccess( + Boolean hasRestrictedSubuserAccess + ) { + this.hasRestrictedSubuserAccess = hasRestrictedSubuserAccess; + return this; + } + + public Builder subuserAccess( + List< + SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner + > subuserAccess + ) { + this.subuserAccess = subuserAccess; + return this; + } + + public PostSsoTeammates201 build() { + return new PostSsoTeammates201(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + PostSsoTeammates201.class.getSimpleName() + "(", + ")" + ); + if (firstName != null) joiner.add("firstName=" + firstName); + if (lastName != null) joiner.add("lastName=" + lastName); + if (email != null) joiner.add("email=" + email); + if (isAdmin != null) joiner.add("isAdmin=" + isAdmin); + if (isSso != null) joiner.add("isSso=" + isSso); + if (scopes != null) joiner.add("scopes=" + scopes); + if (hasRestrictedSubuserAccess != null) joiner.add( + "hasRestrictedSubuserAccess=" + hasRestrictedSubuserAccess + ); + if (subuserAccess != null) joiner.add("subuserAccess=" + subuserAccess); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/PostSsoTeammatesRequest.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/PostSsoTeammatesRequest.java new file mode 100644 index 00000000..b98bcd02 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/PostSsoTeammatesRequest.java @@ -0,0 +1,163 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.sso.models.Persona; +import com.sendgrid.rest.api.v3.sso.models.SsoTeammatesBaseRequestPropsSubuserAccessInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class PostSsoTeammatesRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_admin") + @Getter + @Setter + private Boolean isAdmin; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("persona") + @Getter + @Setter + private Persona persona; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("scopes") + @Getter + @Setter + private List scopes; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("has_restricted_subuser_access") + @Getter + @Setter + private Boolean hasRestrictedSubuserAccess; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subuser_access") + @Getter + @Setter + private List subuserAccess; + + public PostSsoTeammatesRequest() {} + + private PostSsoTeammatesRequest(Builder builder) { + this.email = builder.email; + this.firstName = builder.firstName; + this.lastName = builder.lastName; + this.isAdmin = builder.isAdmin; + this.persona = builder.persona; + this.scopes = builder.scopes; + this.hasRestrictedSubuserAccess = builder.hasRestrictedSubuserAccess; + this.subuserAccess = builder.subuserAccess; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + private String firstName; + private String lastName; + private Boolean isAdmin; + private Persona persona; + private List scopes; + private Boolean hasRestrictedSubuserAccess; + private List< + SsoTeammatesBaseRequestPropsSubuserAccessInner + > subuserAccess; + + public Builder(String email, String firstName, String lastName) { + this.email = email; + this.firstName = firstName; + this.lastName = lastName; + } + + public Builder isAdmin(Boolean isAdmin) { + this.isAdmin = isAdmin; + return this; + } + + public Builder persona(Persona persona) { + this.persona = persona; + return this; + } + + public Builder scopes(List scopes) { + this.scopes = scopes; + return this; + } + + public Builder hasRestrictedSubuserAccess( + Boolean hasRestrictedSubuserAccess + ) { + this.hasRestrictedSubuserAccess = hasRestrictedSubuserAccess; + return this; + } + + public Builder subuserAccess( + List subuserAccess + ) { + this.subuserAccess = subuserAccess; + return this; + } + + public PostSsoTeammatesRequest build() { + return new PostSsoTeammatesRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + PostSsoTeammatesRequest.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + if (firstName != null) joiner.add("firstName=" + firstName); + if (lastName != null) joiner.add("lastName=" + lastName); + if (isAdmin != null) joiner.add("isAdmin=" + isAdmin); + if (persona != null) joiner.add("persona=" + persona); + if (scopes != null) joiner.add("scopes=" + scopes); + if (hasRestrictedSubuserAccess != null) joiner.add( + "hasRestrictedSubuserAccess=" + hasRestrictedSubuserAccess + ); + if (subuserAccess != null) joiner.add("subuserAccess=" + subuserAccess); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoCertificateBody.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoCertificateBody.java new file mode 100644 index 00000000..80200020 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoCertificateBody.java @@ -0,0 +1,126 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SsoCertificateBody { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("public_certificate") + @Getter + @Setter + private String publicCertificate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private BigDecimal id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("not_before") + @Getter + @Setter + private BigDecimal notBefore; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("not_after") + @Getter + @Setter + private BigDecimal notAfter; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("intergration_id") + @Getter + @Setter + private String intergrationId; + + public SsoCertificateBody() {} + + private SsoCertificateBody(Builder builder) { + this.publicCertificate = builder.publicCertificate; + this.id = builder.id; + this.notBefore = builder.notBefore; + this.notAfter = builder.notAfter; + this.intergrationId = builder.intergrationId; + } + + // Builder class for constructing object + public static class Builder { + + private String publicCertificate; + private BigDecimal id; + private BigDecimal notBefore; + private BigDecimal notAfter; + private String intergrationId; + + public Builder() {} + + public Builder publicCertificate(String publicCertificate) { + this.publicCertificate = publicCertificate; + return this; + } + + public Builder id(BigDecimal id) { + this.id = id; + return this; + } + + public Builder notBefore(BigDecimal notBefore) { + this.notBefore = notBefore; + return this; + } + + public Builder notAfter(BigDecimal notAfter) { + this.notAfter = notAfter; + return this; + } + + public Builder intergrationId(String intergrationId) { + this.intergrationId = intergrationId; + return this; + } + + public SsoCertificateBody build() { + return new SsoCertificateBody(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SsoCertificateBody.class.getSimpleName() + "(", + ")" + ); + if (publicCertificate != null) joiner.add( + "publicCertificate=" + publicCertificate + ); + if (id != null) joiner.add("id=" + id); + if (notBefore != null) joiner.add("notBefore=" + notBefore); + if (notAfter != null) joiner.add("notAfter=" + notAfter); + if (intergrationId != null) joiner.add( + "intergrationId=" + intergrationId + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoErrorResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoErrorResponseInner.java new file mode 100644 index 00000000..64fe18b7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoErrorResponseInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SsoErrorResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_id") + @Getter + @Setter + private String errorId; + + public SsoErrorResponseInner() {} + + private SsoErrorResponseInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.errorId = builder.errorId; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private String errorId; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder errorId(String errorId) { + this.errorId = errorId; + return this; + } + + public SsoErrorResponseInner build() { + return new SsoErrorResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SsoErrorResponseInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (errorId != null) joiner.add("errorId=" + errorId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoIntegration.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoIntegration.java new file mode 100644 index 00000000..1827b7bc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoIntegration.java @@ -0,0 +1,180 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SsoIntegration { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("signin_url") + @Getter + @Setter + private String signinUrl; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("signout_url") + @Getter + @Setter + private String signoutUrl; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("entity_id") + @Getter + @Setter + private String entityId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("completed_integration") + @Getter + @Setter + private Boolean completedIntegration; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_updated") + @Getter + @Setter + private BigDecimal lastUpdated; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("single_signon_url") + @Getter + @Setter + private String singleSignonUrl; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("audience_url") + @Getter + @Setter + private String audienceUrl; + + public SsoIntegration() {} + + private SsoIntegration(Builder builder) { + this.name = builder.name; + this.enabled = builder.enabled; + this.signinUrl = builder.signinUrl; + this.signoutUrl = builder.signoutUrl; + this.entityId = builder.entityId; + this.completedIntegration = builder.completedIntegration; + this.lastUpdated = builder.lastUpdated; + this.id = builder.id; + this.singleSignonUrl = builder.singleSignonUrl; + this.audienceUrl = builder.audienceUrl; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private Boolean enabled; + private String signinUrl; + private String signoutUrl; + private String entityId; + private Boolean completedIntegration; + private BigDecimal lastUpdated; + private String id; + private String singleSignonUrl; + private String audienceUrl; + + public Builder( + String name, + Boolean enabled, + String signinUrl, + String signoutUrl, + String entityId, + BigDecimal lastUpdated + ) { + this.name = name; + this.enabled = enabled; + this.signinUrl = signinUrl; + this.signoutUrl = signoutUrl; + this.entityId = entityId; + this.lastUpdated = lastUpdated; + } + + public Builder completedIntegration(Boolean completedIntegration) { + this.completedIntegration = completedIntegration; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder singleSignonUrl(String singleSignonUrl) { + this.singleSignonUrl = singleSignonUrl; + return this; + } + + public Builder audienceUrl(String audienceUrl) { + this.audienceUrl = audienceUrl; + return this; + } + + public SsoIntegration build() { + return new SsoIntegration(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SsoIntegration.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (enabled != null) joiner.add("enabled=" + enabled); + if (signinUrl != null) joiner.add("signinUrl=" + signinUrl); + if (signoutUrl != null) joiner.add("signoutUrl=" + signoutUrl); + if (entityId != null) joiner.add("entityId=" + entityId); + if (completedIntegration != null) joiner.add( + "completedIntegration=" + completedIntegration + ); + if (lastUpdated != null) joiner.add("lastUpdated=" + lastUpdated); + if (id != null) joiner.add("id=" + id); + if (singleSignonUrl != null) joiner.add( + "singleSignonUrl=" + singleSignonUrl + ); + if (audienceUrl != null) joiner.add("audienceUrl=" + audienceUrl); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoTeammatesBaseRequestProps.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoTeammatesBaseRequestProps.java new file mode 100644 index 00000000..620175a6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoTeammatesBaseRequestProps.java @@ -0,0 +1,153 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.sso.models.Persona; +import com.sendgrid.rest.api.v3.sso.models.SsoTeammatesBaseRequestPropsSubuserAccessInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SsoTeammatesBaseRequestProps { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_admin") + @Getter + @Setter + private Boolean isAdmin; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("persona") + @Getter + @Setter + private Persona persona; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("scopes") + @Getter + @Setter + private List scopes; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("has_restricted_subuser_access") + @Getter + @Setter + private Boolean hasRestrictedSubuserAccess; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subuser_access") + @Getter + @Setter + private List subuserAccess; + + public SsoTeammatesBaseRequestProps() {} + + private SsoTeammatesBaseRequestProps(Builder builder) { + this.firstName = builder.firstName; + this.lastName = builder.lastName; + this.isAdmin = builder.isAdmin; + this.persona = builder.persona; + this.scopes = builder.scopes; + this.hasRestrictedSubuserAccess = builder.hasRestrictedSubuserAccess; + this.subuserAccess = builder.subuserAccess; + } + + // Builder class for constructing object + public static class Builder { + + private String firstName; + private String lastName; + private Boolean isAdmin; + private Persona persona; + private List scopes; + private Boolean hasRestrictedSubuserAccess; + private List< + SsoTeammatesBaseRequestPropsSubuserAccessInner + > subuserAccess; + + public Builder(String firstName, String lastName) { + this.firstName = firstName; + this.lastName = lastName; + } + + public Builder isAdmin(Boolean isAdmin) { + this.isAdmin = isAdmin; + return this; + } + + public Builder persona(Persona persona) { + this.persona = persona; + return this; + } + + public Builder scopes(List scopes) { + this.scopes = scopes; + return this; + } + + public Builder hasRestrictedSubuserAccess( + Boolean hasRestrictedSubuserAccess + ) { + this.hasRestrictedSubuserAccess = hasRestrictedSubuserAccess; + return this; + } + + public Builder subuserAccess( + List subuserAccess + ) { + this.subuserAccess = subuserAccess; + return this; + } + + public SsoTeammatesBaseRequestProps build() { + return new SsoTeammatesBaseRequestProps(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SsoTeammatesBaseRequestProps.class.getSimpleName() + "(", + ")" + ); + if (firstName != null) joiner.add("firstName=" + firstName); + if (lastName != null) joiner.add("lastName=" + lastName); + if (isAdmin != null) joiner.add("isAdmin=" + isAdmin); + if (persona != null) joiner.add("persona=" + persona); + if (scopes != null) joiner.add("scopes=" + scopes); + if (hasRestrictedSubuserAccess != null) joiner.add( + "hasRestrictedSubuserAccess=" + hasRestrictedSubuserAccess + ); + if (subuserAccess != null) joiner.add("subuserAccess=" + subuserAccess); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoTeammatesBaseRequestPropsSubuserAccessInner.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoTeammatesBaseRequestPropsSubuserAccessInner.java new file mode 100644 index 00000000..311b97c1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoTeammatesBaseRequestPropsSubuserAccessInner.java @@ -0,0 +1,91 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.sso.models.PermissionType; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SsoTeammatesBaseRequestPropsSubuserAccessInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("permission_type") + @Getter + @Setter + private PermissionType permissionType; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("scopes") + @Getter + @Setter + private List scopes; + + public SsoTeammatesBaseRequestPropsSubuserAccessInner() {} + + private SsoTeammatesBaseRequestPropsSubuserAccessInner(Builder builder) { + this.id = builder.id; + this.permissionType = builder.permissionType; + this.scopes = builder.scopes; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private PermissionType permissionType; + private List scopes; + + public Builder(Integer id, PermissionType permissionType) { + this.id = id; + this.permissionType = permissionType; + } + + public Builder scopes(List scopes) { + this.scopes = scopes; + return this; + } + + public SsoTeammatesBaseRequestPropsSubuserAccessInner build() { + return new SsoTeammatesBaseRequestPropsSubuserAccessInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SsoTeammatesBaseRequestPropsSubuserAccessInner.class.getSimpleName() + + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (permissionType != null) joiner.add( + "permissionType=" + permissionType + ); + if (scopes != null) joiner.add("scopes=" + scopes); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoTeammatesBaseResponseProps.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoTeammatesBaseResponseProps.java new file mode 100644 index 00000000..2976a2ac --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoTeammatesBaseResponseProps.java @@ -0,0 +1,136 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SsoTeammatesBaseResponseProps { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_admin") + @Getter + @Setter + private Boolean isAdmin; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_sso") + @Getter + @Setter + private Boolean isSso; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("scopes") + @Getter + @Setter + private List scopes; + + public SsoTeammatesBaseResponseProps() {} + + private SsoTeammatesBaseResponseProps(Builder builder) { + this.firstName = builder.firstName; + this.lastName = builder.lastName; + this.email = builder.email; + this.isAdmin = builder.isAdmin; + this.isSso = builder.isSso; + this.scopes = builder.scopes; + } + + // Builder class for constructing object + public static class Builder { + + private String firstName; + private String lastName; + private String email; + private Boolean isAdmin; + private Boolean isSso; + private List scopes; + + public Builder() {} + + public Builder firstName(String firstName) { + this.firstName = firstName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = lastName; + return this; + } + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder isAdmin(Boolean isAdmin) { + this.isAdmin = isAdmin; + return this; + } + + public Builder isSso(Boolean isSso) { + this.isSso = isSso; + return this; + } + + public Builder scopes(List scopes) { + this.scopes = scopes; + return this; + } + + public SsoTeammatesBaseResponseProps build() { + return new SsoTeammatesBaseResponseProps(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SsoTeammatesBaseResponseProps.class.getSimpleName() + "(", + ")" + ); + if (firstName != null) joiner.add("firstName=" + firstName); + if (lastName != null) joiner.add("lastName=" + lastName); + if (email != null) joiner.add("email=" + email); + if (isAdmin != null) joiner.add("isAdmin=" + isAdmin); + if (isSso != null) joiner.add("isSso=" + isSso); + if (scopes != null) joiner.add("scopes=" + scopes); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoTeammatesRestrictedSubuserResponseProps.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoTeammatesRestrictedSubuserResponseProps.java new file mode 100644 index 00000000..6609cf16 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoTeammatesRestrictedSubuserResponseProps.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.sso.models.SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SsoTeammatesRestrictedSubuserResponseProps { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("has_restricted_subuser_access") + @Getter + @Setter + private Boolean hasRestrictedSubuserAccess; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subuser_access") + @Getter + @Setter + private List< + SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner + > subuserAccess; + + public SsoTeammatesRestrictedSubuserResponseProps() {} + + private SsoTeammatesRestrictedSubuserResponseProps(Builder builder) { + this.hasRestrictedSubuserAccess = builder.hasRestrictedSubuserAccess; + this.subuserAccess = builder.subuserAccess; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean hasRestrictedSubuserAccess; + private List< + SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner + > subuserAccess; + + public Builder() {} + + public Builder hasRestrictedSubuserAccess( + Boolean hasRestrictedSubuserAccess + ) { + this.hasRestrictedSubuserAccess = hasRestrictedSubuserAccess; + return this; + } + + public Builder subuserAccess( + List< + SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner + > subuserAccess + ) { + this.subuserAccess = subuserAccess; + return this; + } + + public SsoTeammatesRestrictedSubuserResponseProps build() { + return new SsoTeammatesRestrictedSubuserResponseProps(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SsoTeammatesRestrictedSubuserResponseProps.class.getSimpleName() + + "(", + ")" + ); + if (hasRestrictedSubuserAccess != null) joiner.add( + "hasRestrictedSubuserAccess=" + hasRestrictedSubuserAccess + ); + if (subuserAccess != null) joiner.add("subuserAccess=" + subuserAccess); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner.java new file mode 100644 index 00000000..5dc42ca6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner.java @@ -0,0 +1,144 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.sso.models.PermissionType1; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("disabled") + @Getter + @Setter + private Boolean disabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("permission_type") + @Getter + @Setter + private PermissionType1 permissionType; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("scopes") + @Getter + @Setter + private List scopes; + + public SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner() {} + + private SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner( + Builder builder + ) { + this.id = builder.id; + this.username = builder.username; + this.email = builder.email; + this.disabled = builder.disabled; + this.permissionType = builder.permissionType; + this.scopes = builder.scopes; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private String username; + private String email; + private Boolean disabled; + private PermissionType1 permissionType; + private List scopes; + + public Builder() {} + + public Builder id(Integer id) { + this.id = id; + return this; + } + + public Builder username(String username) { + this.username = username; + return this; + } + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = disabled; + return this; + } + + public Builder permissionType(PermissionType1 permissionType) { + this.permissionType = permissionType; + return this; + } + + public Builder scopes(List scopes) { + this.scopes = scopes; + return this; + } + + public SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner build() { + return new SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner.class.getSimpleName() + + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (username != null) joiner.add("username=" + username); + if (email != null) joiner.add("email=" + email); + if (disabled != null) joiner.add("disabled=" + disabled); + if (permissionType != null) joiner.add( + "permissionType=" + permissionType + ); + if (scopes != null) joiner.add("scopes=" + scopes); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/UpdateSsoCertificateRequest.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/UpdateSsoCertificateRequest.java new file mode 100644 index 00000000..a83976c7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/UpdateSsoCertificateRequest.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateSsoCertificateRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("public_certificate") + @Getter + @Setter + private String publicCertificate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("integration_id") + @Getter + @Setter + private String integrationId; + + public UpdateSsoCertificateRequest() {} + + private UpdateSsoCertificateRequest(Builder builder) { + this.publicCertificate = builder.publicCertificate; + this.enabled = builder.enabled; + this.integrationId = builder.integrationId; + } + + // Builder class for constructing object + public static class Builder { + + private String publicCertificate; + private Boolean enabled; + private String integrationId; + + public Builder() {} + + public Builder publicCertificate(String publicCertificate) { + this.publicCertificate = publicCertificate; + return this; + } + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public Builder integrationId(String integrationId) { + this.integrationId = integrationId; + return this; + } + + public UpdateSsoCertificateRequest build() { + return new UpdateSsoCertificateRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateSsoCertificateRequest.class.getSimpleName() + "(", + ")" + ); + if (publicCertificate != null) joiner.add( + "publicCertificate=" + publicCertificate + ); + if (enabled != null) joiner.add("enabled=" + enabled); + if (integrationId != null) joiner.add("integrationId=" + integrationId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/sso/models/UserType.java b/src/main/java/com/sendgrid/rest/api/v3/sso/models/UserType.java new file mode 100644 index 00000000..f75b6ae7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/sso/models/UserType.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Single Sign-On API + * The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + * + * 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.sso.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum UserType { + ADMIN("admin"), + + OWNER("owner"), + + TEAMMATE("teammate"); + + private final String value; + + private UserType(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static UserType forValue(final String value) { + return Promoter.enumFromString(value, UserType.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/GetClientStat.java b/src/main/java/com/sendgrid/rest/api/v3/stats/GetClientStat.java new file mode 100644 index 00000000..bf5762a8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/GetClientStat.java @@ -0,0 +1,114 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats; + +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.stats.models.AggregatedBy2; +import com.sendgrid.rest.api.v3.stats.models.ClientType; +import com.sendgrid.rest.api.v3.stats.models.ListClientStat200ResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetClientStat extends ApiKeyBase { + + private final ClientType clientType; + private final String startDate; + + @Setter + private String endDate; + + @Setter + private AggregatedBy2 aggregatedBy; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/clients/{client_type}/stats"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetClientStat creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (clientType != null) { + request.addPathParam("client_type", clientType.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (startDate != null) { + request.addQueryParam("start_date", startDate.toString()); + } + if (endDate != null) { + request.addQueryParam("end_date", endDate.toString()); + } + if (aggregatedBy != null) { + request.addQueryParam("aggregated_by", aggregatedBy.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/ListBrowserStat.java b/src/main/java/com/sendgrid/rest/api/v3/stats/ListBrowserStat.java new file mode 100644 index 00000000..cb2b1134 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/ListBrowserStat.java @@ -0,0 +1,123 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats; + +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.stats.models.AggregatedBy3; +import com.sendgrid.rest.api.v3.stats.models.ListBrowserStat200ResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListBrowserStat extends ApiKeyBase { + + @Setter + private String browsers; + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private AggregatedBy3 aggregatedBy; + + private final String startDate; + + @Setter + private String endDate; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/browsers/stats"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListBrowserStat creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (browsers != null) { + request.addQueryParam("browsers", browsers.toString()); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (aggregatedBy != null) { + request.addQueryParam("aggregated_by", aggregatedBy.toString()); + } + if (startDate != null) { + request.addQueryParam("start_date", startDate.toString()); + } + if (endDate != null) { + request.addQueryParam("end_date", endDate.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/ListCategory.java b/src/main/java/com/sendgrid/rest/api/v3/stats/ListCategory.java new file mode 100644 index 00000000..381cab22 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/ListCategory.java @@ -0,0 +1,120 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats; + +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.stats.models.ListCategory200ResponseInner; +import com.sendgrid.rest.api.v3.stats.models.ListCategory400Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListCategory extends ApiKeyBase { + + @Setter + private Integer limit; + + @Setter + private String category; + + @Setter + private Integer offset; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/categories"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListCategory 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")) { + ListCategory400Response error = JsonUtil.fromJson( + response.getStream(), + ListCategory400Response.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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (category != null) { + request.addQueryParam("category", category.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/ListCategoryStat.java b/src/main/java/com/sendgrid/rest/api/v3/stats/ListCategoryStat.java new file mode 100644 index 00000000..99d711a8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/ListCategoryStat.java @@ -0,0 +1,110 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats; + +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.stats.models.AggregatedBy; +import com.sendgrid.rest.api.v3.stats.models.CategoryStats; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListCategoryStat extends ApiKeyBase { + + private final String startDate; + + @Setter + private String endDate; + + private final String categories; + + @Setter + private AggregatedBy aggregatedBy; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/categories/stats"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListCategoryStat creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (startDate != null) { + request.addQueryParam("start_date", startDate.toString()); + } + if (endDate != null) { + request.addQueryParam("end_date", endDate.toString()); + } + if (categories != null) { + request.addQueryParam("categories", categories.toString()); + } + if (aggregatedBy != null) { + request.addQueryParam("aggregated_by", aggregatedBy.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/ListCategoryStatSum.java b/src/main/java/com/sendgrid/rest/api/v3/stats/ListCategoryStatSum.java new file mode 100644 index 00000000..c11fa05b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/ListCategoryStatSum.java @@ -0,0 +1,130 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats; + +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.stats.models.AggregatedBy1; +import com.sendgrid.rest.api.v3.stats.models.CategoryStats; +import com.sendgrid.rest.api.v3.stats.models.SortByDirection; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListCategoryStatSum extends ApiKeyBase { + + @Setter + private String sortByMetric; + + @Setter + private SortByDirection sortByDirection; + + private final String startDate; + + @Setter + private String endDate; + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private AggregatedBy1 aggregatedBy; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/categories/stats/sums"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListCategoryStatSum creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), CategoryStats.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (sortByMetric != null) { + request.addQueryParam("sort_by_metric", sortByMetric.toString()); + } + if (sortByDirection != null) { + request.addQueryParam( + "sort_by_direction", + sortByDirection.toString() + ); + } + if (startDate != null) { + request.addQueryParam("start_date", startDate.toString()); + } + if (endDate != null) { + request.addQueryParam("end_date", endDate.toString()); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (aggregatedBy != null) { + request.addQueryParam("aggregated_by", aggregatedBy.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/ListClientStat.java b/src/main/java/com/sendgrid/rest/api/v3/stats/ListClientStat.java new file mode 100644 index 00000000..a9957a0e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/ListClientStat.java @@ -0,0 +1,105 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats; + +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.stats.models.AggregatedBy2; +import com.sendgrid.rest.api.v3.stats.models.ListClientStat200ResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListClientStat extends ApiKeyBase { + + private final String startDate; + + @Setter + private String endDate; + + @Setter + private AggregatedBy2 aggregatedBy; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/clients/stats"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListClientStat creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (startDate != null) { + request.addQueryParam("start_date", startDate.toString()); + } + if (endDate != null) { + request.addQueryParam("end_date", endDate.toString()); + } + if (aggregatedBy != null) { + request.addQueryParam("aggregated_by", aggregatedBy.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/ListDeviceStat.java b/src/main/java/com/sendgrid/rest/api/v3/stats/ListDeviceStat.java new file mode 100644 index 00000000..5b0192e7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/ListDeviceStat.java @@ -0,0 +1,117 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats; + +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.stats.models.AggregatedBy3; +import com.sendgrid.rest.api.v3.stats.models.ListClientStat200ResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListDeviceStat extends ApiKeyBase { + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private AggregatedBy3 aggregatedBy; + + private final String startDate; + + @Setter + private String endDate; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/devices/stats"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListDeviceStat creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (aggregatedBy != null) { + request.addQueryParam("aggregated_by", aggregatedBy.toString()); + } + if (startDate != null) { + request.addQueryParam("start_date", startDate.toString()); + } + if (endDate != null) { + request.addQueryParam("end_date", endDate.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/ListGeoStat.java b/src/main/java/com/sendgrid/rest/api/v3/stats/ListGeoStat.java new file mode 100644 index 00000000..c6b50ec4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/ListGeoStat.java @@ -0,0 +1,124 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats; + +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.stats.models.AggregatedBy3; +import com.sendgrid.rest.api.v3.stats.models.Country; +import com.sendgrid.rest.api.v3.stats.models.ListGeoStat200ResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListGeoStat extends ApiKeyBase { + + @Setter + private Country country; + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private AggregatedBy3 aggregatedBy; + + private final String startDate; + + @Setter + private String endDate; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/geo/stats"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListGeoStat creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (country != null) { + request.addQueryParam("country", country.toString()); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (aggregatedBy != null) { + request.addQueryParam("aggregated_by", aggregatedBy.toString()); + } + if (startDate != null) { + request.addQueryParam("start_date", startDate.toString()); + } + if (endDate != null) { + request.addQueryParam("end_date", endDate.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/ListMailboxProviderStat.java b/src/main/java/com/sendgrid/rest/api/v3/stats/ListMailboxProviderStat.java new file mode 100644 index 00000000..0e02b44b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/ListMailboxProviderStat.java @@ -0,0 +1,126 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats; + +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.stats.models.AggregatedBy3; +import com.sendgrid.rest.api.v3.stats.models.ListMailboxProviderStat200ResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListMailboxProviderStat extends ApiKeyBase { + + @Setter + private String mailboxProviders; + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private AggregatedBy3 aggregatedBy; + + private final String startDate; + + @Setter + private String endDate; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/mailbox_providers/stats"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListMailboxProviderStat creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (mailboxProviders != null) { + request.addQueryParam( + "mailbox_providers", + mailboxProviders.toString() + ); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (aggregatedBy != null) { + request.addQueryParam("aggregated_by", aggregatedBy.toString()); + } + if (startDate != null) { + request.addQueryParam("start_date", startDate.toString()); + } + if (endDate != null) { + request.addQueryParam("end_date", endDate.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/ListStat.java b/src/main/java/com/sendgrid/rest/api/v3/stats/ListStat.java new file mode 100644 index 00000000..2d4fe03a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/ListStat.java @@ -0,0 +1,117 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats; + +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.stats.models.AggregatedBy3; +import com.sendgrid.rest.api.v3.stats.models.ListStat200ResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListStat extends ApiKeyBase { + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private AggregatedBy3 aggregatedBy; + + private final String startDate; + + @Setter + private String endDate; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/stats"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListStat creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (aggregatedBy != null) { + request.addQueryParam("aggregated_by", aggregatedBy.toString()); + } + if (startDate != null) { + request.addQueryParam("start_date", startDate.toString()); + } + if (endDate != null) { + request.addQueryParam("end_date", endDate.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/AdvancedStatsClicks.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/AdvancedStatsClicks.java new file mode 100644 index 00000000..32a0076a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/AdvancedStatsClicks.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AdvancedStatsClicks { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("clicks") + @Getter + @Setter + private Integer clicks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unique_clicks") + @Getter + @Setter + private Integer uniqueClicks; + + public AdvancedStatsClicks() {} + + private AdvancedStatsClicks(Builder builder) { + this.clicks = builder.clicks; + this.uniqueClicks = builder.uniqueClicks; + } + + // Builder class for constructing object + public static class Builder { + + private Integer clicks; + private Integer uniqueClicks; + + public Builder() {} + + public Builder clicks(Integer clicks) { + this.clicks = clicks; + return this; + } + + public Builder uniqueClicks(Integer uniqueClicks) { + this.uniqueClicks = uniqueClicks; + return this; + } + + public AdvancedStatsClicks build() { + return new AdvancedStatsClicks(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AdvancedStatsClicks.class.getSimpleName() + "(", + ")" + ); + if (clicks != null) joiner.add("clicks=" + clicks); + if (uniqueClicks != null) joiner.add("uniqueClicks=" + uniqueClicks); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/AdvancedStatsClicksOpens.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/AdvancedStatsClicksOpens.java new file mode 100644 index 00000000..c6cde06d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/AdvancedStatsClicksOpens.java @@ -0,0 +1,107 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AdvancedStatsClicksOpens { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("clicks") + @Getter + @Setter + private Integer clicks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unique_clicks") + @Getter + @Setter + private Integer uniqueClicks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("opens") + @Getter + @Setter + private Integer opens; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unique_opens") + @Getter + @Setter + private Integer uniqueOpens; + + public AdvancedStatsClicksOpens() {} + + private AdvancedStatsClicksOpens(Builder builder) { + this.clicks = builder.clicks; + this.uniqueClicks = builder.uniqueClicks; + this.opens = builder.opens; + this.uniqueOpens = builder.uniqueOpens; + } + + // Builder class for constructing object + public static class Builder { + + private Integer clicks; + private Integer uniqueClicks; + private Integer opens; + private Integer uniqueOpens; + + public Builder() {} + + public Builder clicks(Integer clicks) { + this.clicks = clicks; + return this; + } + + public Builder uniqueClicks(Integer uniqueClicks) { + this.uniqueClicks = uniqueClicks; + return this; + } + + public Builder opens(Integer opens) { + this.opens = opens; + return this; + } + + public Builder uniqueOpens(Integer uniqueOpens) { + this.uniqueOpens = uniqueOpens; + return this; + } + + public AdvancedStatsClicksOpens build() { + return new AdvancedStatsClicksOpens(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AdvancedStatsClicksOpens.class.getSimpleName() + "(", + ")" + ); + if (clicks != null) joiner.add("clicks=" + clicks); + if (uniqueClicks != null) joiner.add("uniqueClicks=" + uniqueClicks); + if (opens != null) joiner.add("opens=" + opens); + if (uniqueOpens != null) joiner.add("uniqueOpens=" + uniqueOpens); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/AdvancedStatsMailboxProvider.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/AdvancedStatsMailboxProvider.java new file mode 100644 index 00000000..51fc6173 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/AdvancedStatsMailboxProvider.java @@ -0,0 +1,163 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AdvancedStatsMailboxProvider { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("blocks") + @Getter + @Setter + private Integer blocks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounces") + @Getter + @Setter + private Integer bounces; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("deferred") + @Getter + @Setter + private Integer deferred; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("delivered") + @Getter + @Setter + private Integer delivered; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("drops") + @Getter + @Setter + private Integer drops; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("requests") + @Getter + @Setter + private Integer requests; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("processed") + @Getter + @Setter + private Integer processed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_reports") + @Getter + @Setter + private Integer spamReports; + + public AdvancedStatsMailboxProvider() {} + + private AdvancedStatsMailboxProvider(Builder builder) { + this.blocks = builder.blocks; + this.bounces = builder.bounces; + this.deferred = builder.deferred; + this.delivered = builder.delivered; + this.drops = builder.drops; + this.requests = builder.requests; + this.processed = builder.processed; + this.spamReports = builder.spamReports; + } + + // Builder class for constructing object + public static class Builder { + + private Integer blocks; + private Integer bounces; + private Integer deferred; + private Integer delivered; + private Integer drops; + private Integer requests; + private Integer processed; + private Integer spamReports; + + public Builder() {} + + public Builder blocks(Integer blocks) { + this.blocks = blocks; + return this; + } + + public Builder bounces(Integer bounces) { + this.bounces = bounces; + return this; + } + + public Builder deferred(Integer deferred) { + this.deferred = deferred; + return this; + } + + public Builder delivered(Integer delivered) { + this.delivered = delivered; + return this; + } + + public Builder drops(Integer drops) { + this.drops = drops; + return this; + } + + public Builder requests(Integer requests) { + this.requests = requests; + return this; + } + + public Builder processed(Integer processed) { + this.processed = processed; + return this; + } + + public Builder spamReports(Integer spamReports) { + this.spamReports = spamReports; + return this; + } + + public AdvancedStatsMailboxProvider build() { + return new AdvancedStatsMailboxProvider(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AdvancedStatsMailboxProvider.class.getSimpleName() + "(", + ")" + ); + if (blocks != null) joiner.add("blocks=" + blocks); + if (bounces != null) joiner.add("bounces=" + bounces); + if (deferred != null) joiner.add("deferred=" + deferred); + if (delivered != null) joiner.add("delivered=" + delivered); + if (drops != null) joiner.add("drops=" + drops); + if (requests != null) joiner.add("requests=" + requests); + if (processed != null) joiner.add("processed=" + processed); + if (spamReports != null) joiner.add("spamReports=" + spamReports); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/AdvancedStatsOpens.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/AdvancedStatsOpens.java new file mode 100644 index 00000000..baffdaee --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/AdvancedStatsOpens.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AdvancedStatsOpens { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("opens") + @Getter + @Setter + private Integer opens; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unique_opens") + @Getter + @Setter + private Integer uniqueOpens; + + public AdvancedStatsOpens() {} + + private AdvancedStatsOpens(Builder builder) { + this.opens = builder.opens; + this.uniqueOpens = builder.uniqueOpens; + } + + // Builder class for constructing object + public static class Builder { + + private Integer opens; + private Integer uniqueOpens; + + public Builder() {} + + public Builder opens(Integer opens) { + this.opens = opens; + return this; + } + + public Builder uniqueOpens(Integer uniqueOpens) { + this.uniqueOpens = uniqueOpens; + return this; + } + + public AdvancedStatsOpens build() { + return new AdvancedStatsOpens(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AdvancedStatsOpens.class.getSimpleName() + "(", + ")" + ); + if (opens != null) joiner.add("opens=" + opens); + if (uniqueOpens != null) joiner.add("uniqueOpens=" + uniqueOpens); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/AggregatedBy.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/AggregatedBy.java new file mode 100644 index 00000000..83ad0933 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/AggregatedBy.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum AggregatedBy { + DAY("day"), + + WEEK("week"), + + MONTH("month"); + + private final String value; + + private AggregatedBy(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static AggregatedBy forValue(final String value) { + return Promoter.enumFromString(value, AggregatedBy.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/AggregatedBy1.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/AggregatedBy1.java new file mode 100644 index 00000000..50ec3110 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/AggregatedBy1.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum AggregatedBy1 { + DAY("day"), + + WEEK("week"), + + MONTH("month"); + + private final String value; + + private AggregatedBy1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static AggregatedBy1 forValue(final String value) { + return Promoter.enumFromString(value, AggregatedBy1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/AggregatedBy2.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/AggregatedBy2.java new file mode 100644 index 00000000..2f13b313 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/AggregatedBy2.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum AggregatedBy2 { + DAY("day"), + + WEEK("week"), + + MONTH("month"); + + private final String value; + + private AggregatedBy2(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static AggregatedBy2 forValue(final String value) { + return Promoter.enumFromString(value, AggregatedBy2.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/AggregatedBy3.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/AggregatedBy3.java new file mode 100644 index 00000000..d6a36cbc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/AggregatedBy3.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum AggregatedBy3 { + DAY("day"), + + WEEK("week"), + + MONTH("month"); + + private final String value; + + private AggregatedBy3(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static AggregatedBy3 forValue(final String value) { + return Promoter.enumFromString(value, AggregatedBy3.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/CategoryStats.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/CategoryStats.java new file mode 100644 index 00000000..f8d9ff60 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/CategoryStats.java @@ -0,0 +1,78 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.stats.models.CategoryStatsStatsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CategoryStats { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("date") + @Getter + @Setter + private String date; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("stats") + @Getter + @Setter + private List stats; + + public CategoryStats() {} + + private CategoryStats(Builder builder) { + this.date = builder.date; + this.stats = builder.stats; + } + + // Builder class for constructing object + public static class Builder { + + private String date; + private List stats; + + public Builder(String date) { + this.date = date; + } + + public Builder stats(List stats) { + this.stats = stats; + return this; + } + + public CategoryStats build() { + return new CategoryStats(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CategoryStats.class.getSimpleName() + "(", + ")" + ); + if (date != null) joiner.add("date=" + date); + if (stats != null) joiner.add("stats=" + stats); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/CategoryStatsStatsInner.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/CategoryStatsStatsInner.java new file mode 100644 index 00000000..6a80ea74 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/CategoryStatsStatsInner.java @@ -0,0 +1,91 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.stats.models.CategoryStatsStatsInnerMetrics; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CategoryStatsStatsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metrics") + @Getter + @Setter + private CategoryStatsStatsInnerMetrics metrics; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + public CategoryStatsStatsInner() {} + + private CategoryStatsStatsInner(Builder builder) { + this.metrics = builder.metrics; + this.name = builder.name; + this.type = builder.type; + } + + // Builder class for constructing object + public static class Builder { + + private CategoryStatsStatsInnerMetrics metrics; + private String name; + private String type; + + public Builder(String type) { + this.type = type; + } + + public Builder metrics(CategoryStatsStatsInnerMetrics metrics) { + this.metrics = metrics; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public CategoryStatsStatsInner build() { + return new CategoryStatsStatsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CategoryStatsStatsInner.class.getSimpleName() + "(", + ")" + ); + if (metrics != null) joiner.add("metrics=" + metrics); + if (name != null) joiner.add("name=" + name); + if (type != null) joiner.add("type=" + type); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/CategoryStatsStatsInnerMetrics.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/CategoryStatsStatsInnerMetrics.java new file mode 100644 index 00000000..6780d42e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/CategoryStatsStatsInnerMetrics.java @@ -0,0 +1,233 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CategoryStatsStatsInnerMetrics { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("blocks") + @Getter + @Setter + private Integer blocks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounce_drops") + @Getter + @Setter + private Integer bounceDrops; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounces") + @Getter + @Setter + private Integer bounces; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("clicks") + @Getter + @Setter + private Integer clicks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("deferred") + @Getter + @Setter + private Integer deferred; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("delivered") + @Getter + @Setter + private Integer delivered; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("invalid_emails") + @Getter + @Setter + private Integer invalidEmails; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("opens") + @Getter + @Setter + private Integer opens; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("processed") + @Getter + @Setter + private Integer processed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("requests") + @Getter + @Setter + private Integer requests; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_report_drops") + @Getter + @Setter + private Integer spamReportDrops; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_reports") + @Getter + @Setter + private Integer spamReports; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unique_clicks") + @Getter + @Setter + private Integer uniqueClicks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unique_opens") + @Getter + @Setter + private Integer uniqueOpens; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unsubscribe_drops") + @Getter + @Setter + private Integer unsubscribeDrops; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unsubscribes") + @Getter + @Setter + private Integer unsubscribes; + + public CategoryStatsStatsInnerMetrics() {} + + private CategoryStatsStatsInnerMetrics(Builder builder) { + this.blocks = builder.blocks; + this.bounceDrops = builder.bounceDrops; + this.bounces = builder.bounces; + this.clicks = builder.clicks; + this.deferred = builder.deferred; + this.delivered = builder.delivered; + this.invalidEmails = builder.invalidEmails; + this.opens = builder.opens; + this.processed = builder.processed; + this.requests = builder.requests; + this.spamReportDrops = builder.spamReportDrops; + this.spamReports = builder.spamReports; + this.uniqueClicks = builder.uniqueClicks; + this.uniqueOpens = builder.uniqueOpens; + this.unsubscribeDrops = builder.unsubscribeDrops; + this.unsubscribes = builder.unsubscribes; + } + + // Builder class for constructing object + public static class Builder { + + private Integer blocks; + private Integer bounceDrops; + private Integer bounces; + private Integer clicks; + private Integer deferred; + private Integer delivered; + private Integer invalidEmails; + private Integer opens; + private Integer processed; + private Integer requests; + private Integer spamReportDrops; + private Integer spamReports; + private Integer uniqueClicks; + private Integer uniqueOpens; + private Integer unsubscribeDrops; + private Integer unsubscribes; + + public Builder( + Integer blocks, + Integer bounceDrops, + Integer bounces, + Integer clicks, + Integer deferred, + Integer delivered, + Integer invalidEmails, + Integer opens, + Integer processed, + Integer requests, + Integer spamReportDrops, + Integer spamReports, + Integer uniqueClicks, + Integer uniqueOpens, + Integer unsubscribeDrops, + Integer unsubscribes + ) { + this.blocks = blocks; + this.bounceDrops = bounceDrops; + this.bounces = bounces; + this.clicks = clicks; + this.deferred = deferred; + this.delivered = delivered; + this.invalidEmails = invalidEmails; + this.opens = opens; + this.processed = processed; + this.requests = requests; + this.spamReportDrops = spamReportDrops; + this.spamReports = spamReports; + this.uniqueClicks = uniqueClicks; + this.uniqueOpens = uniqueOpens; + this.unsubscribeDrops = unsubscribeDrops; + this.unsubscribes = unsubscribes; + } + + public CategoryStatsStatsInnerMetrics build() { + return new CategoryStatsStatsInnerMetrics(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CategoryStatsStatsInnerMetrics.class.getSimpleName() + "(", + ")" + ); + if (blocks != null) joiner.add("blocks=" + blocks); + if (bounceDrops != null) joiner.add("bounceDrops=" + bounceDrops); + if (bounces != null) joiner.add("bounces=" + bounces); + if (clicks != null) joiner.add("clicks=" + clicks); + if (deferred != null) joiner.add("deferred=" + deferred); + if (delivered != null) joiner.add("delivered=" + delivered); + if (invalidEmails != null) joiner.add("invalidEmails=" + invalidEmails); + if (opens != null) joiner.add("opens=" + opens); + if (processed != null) joiner.add("processed=" + processed); + if (requests != null) joiner.add("requests=" + requests); + if (spamReportDrops != null) joiner.add( + "spamReportDrops=" + spamReportDrops + ); + if (spamReports != null) joiner.add("spamReports=" + spamReports); + if (uniqueClicks != null) joiner.add("uniqueClicks=" + uniqueClicks); + if (uniqueOpens != null) joiner.add("uniqueOpens=" + uniqueOpens); + if (unsubscribeDrops != null) joiner.add( + "unsubscribeDrops=" + unsubscribeDrops + ); + if (unsubscribes != null) joiner.add("unsubscribes=" + unsubscribes); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/ClientType.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ClientType.java new file mode 100644 index 00000000..fae751ed --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ClientType.java @@ -0,0 +1,46 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum ClientType { + PHONE("phone"), + + TABLET("tablet"), + + WEBMAIL("webmail"), + + DESKTOP("desktop"); + + private final String value; + + private ClientType(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static ClientType forValue(final String value) { + return Promoter.enumFromString(value, ClientType.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/Country.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/Country.java new file mode 100644 index 00000000..7e8ba12a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/Country.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Country { + US("US"), + + CA("CA"); + + private final String value; + + private Country(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Country forValue(final String value) { + return Promoter.enumFromString(value, Country.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListBrowserStat200ResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListBrowserStat200ResponseInner.java new file mode 100644 index 00000000..8e901860 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListBrowserStat200ResponseInner.java @@ -0,0 +1,83 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.stats.models.ListBrowserStat200ResponseInnerStatsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListBrowserStat200ResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("date") + @Getter + @Setter + private String date; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("stats") + @Getter + @Setter + private List stats; + + public ListBrowserStat200ResponseInner() {} + + private ListBrowserStat200ResponseInner(Builder builder) { + this.date = builder.date; + this.stats = builder.stats; + } + + // Builder class for constructing object + public static class Builder { + + private String date; + private List stats; + + public Builder() {} + + public Builder date(String date) { + this.date = date; + return this; + } + + public Builder stats( + List stats + ) { + this.stats = stats; + return this; + } + + public ListBrowserStat200ResponseInner build() { + return new ListBrowserStat200ResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListBrowserStat200ResponseInner.class.getSimpleName() + "(", + ")" + ); + if (date != null) joiner.add("date=" + date); + if (stats != null) joiner.add("stats=" + stats); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListBrowserStat200ResponseInnerStatsInner.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListBrowserStat200ResponseInnerStatsInner.java new file mode 100644 index 00000000..fd693409 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListBrowserStat200ResponseInnerStatsInner.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.stats.models.AdvancedStatsClicks; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListBrowserStat200ResponseInnerStatsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metrics") + @Getter + @Setter + private AdvancedStatsClicks metrics; + + public ListBrowserStat200ResponseInnerStatsInner() {} + + private ListBrowserStat200ResponseInnerStatsInner(Builder builder) { + this.type = builder.type; + this.name = builder.name; + this.metrics = builder.metrics; + } + + // Builder class for constructing object + public static class Builder { + + private String type; + private String name; + private AdvancedStatsClicks metrics; + + public Builder() {} + + public Builder type(String type) { + this.type = type; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder metrics(AdvancedStatsClicks metrics) { + this.metrics = metrics; + return this; + } + + public ListBrowserStat200ResponseInnerStatsInner build() { + return new ListBrowserStat200ResponseInnerStatsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListBrowserStat200ResponseInnerStatsInner.class.getSimpleName() + + "(", + ")" + ); + if (type != null) joiner.add("type=" + type); + if (name != null) joiner.add("name=" + name); + if (metrics != null) joiner.add("metrics=" + metrics); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListCategory200ResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListCategory200ResponseInner.java new file mode 100644 index 00000000..cfde8237 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListCategory200ResponseInner.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListCategory200ResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("category") + @Getter + @Setter + private String category; + + public ListCategory200ResponseInner() {} + + private ListCategory200ResponseInner(Builder builder) { + this.category = builder.category; + } + + // Builder class for constructing object + public static class Builder { + + private String category; + + public Builder(String category) { + this.category = category; + } + + public ListCategory200ResponseInner build() { + return new ListCategory200ResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListCategory200ResponseInner.class.getSimpleName() + "(", + ")" + ); + if (category != null) joiner.add("category=" + category); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListCategory400Response.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListCategory400Response.java new file mode 100644 index 00000000..d0c04e2d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListCategory400Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.stats.models.ListCategory400ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListCategory400Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ListCategory400Response() {} + + private ListCategory400Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public ListCategory400Response build() { + return new ListCategory400Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListCategory400Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListCategory400ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListCategory400ResponseErrorsInner.java new file mode 100644 index 00000000..a65a6c94 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListCategory400ResponseErrorsInner.java @@ -0,0 +1,72 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListCategory400ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public ListCategory400ResponseErrorsInner() {} + + private ListCategory400ResponseErrorsInner(Builder builder) { + this.field = builder.field; + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String field; + private String message; + + public Builder(String field, String message) { + this.field = field; + this.message = message; + } + + public ListCategory400ResponseErrorsInner build() { + return new ListCategory400ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListCategory400ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (field != null) joiner.add("field=" + field); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListClientStat200ResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListClientStat200ResponseInner.java new file mode 100644 index 00000000..83a1577d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListClientStat200ResponseInner.java @@ -0,0 +1,83 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.stats.models.ListClientStat200ResponseInnerStatsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListClientStat200ResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("date") + @Getter + @Setter + private String date; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("stats") + @Getter + @Setter + private List stats; + + public ListClientStat200ResponseInner() {} + + private ListClientStat200ResponseInner(Builder builder) { + this.date = builder.date; + this.stats = builder.stats; + } + + // Builder class for constructing object + public static class Builder { + + private String date; + private List stats; + + public Builder() {} + + public Builder date(String date) { + this.date = date; + return this; + } + + public Builder stats( + List stats + ) { + this.stats = stats; + return this; + } + + public ListClientStat200ResponseInner build() { + return new ListClientStat200ResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListClientStat200ResponseInner.class.getSimpleName() + "(", + ")" + ); + if (date != null) joiner.add("date=" + date); + if (stats != null) joiner.add("stats=" + stats); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListClientStat200ResponseInnerStatsInner.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListClientStat200ResponseInnerStatsInner.java new file mode 100644 index 00000000..d3524348 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListClientStat200ResponseInnerStatsInner.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.stats.models.AdvancedStatsOpens; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListClientStat200ResponseInnerStatsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metrics") + @Getter + @Setter + private AdvancedStatsOpens metrics; + + public ListClientStat200ResponseInnerStatsInner() {} + + private ListClientStat200ResponseInnerStatsInner(Builder builder) { + this.type = builder.type; + this.name = builder.name; + this.metrics = builder.metrics; + } + + // Builder class for constructing object + public static class Builder { + + private String type; + private String name; + private AdvancedStatsOpens metrics; + + public Builder() {} + + public Builder type(String type) { + this.type = type; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder metrics(AdvancedStatsOpens metrics) { + this.metrics = metrics; + return this; + } + + public ListClientStat200ResponseInnerStatsInner build() { + return new ListClientStat200ResponseInnerStatsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListClientStat200ResponseInnerStatsInner.class.getSimpleName() + + "(", + ")" + ); + if (type != null) joiner.add("type=" + type); + if (name != null) joiner.add("name=" + name); + if (metrics != null) joiner.add("metrics=" + metrics); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListGeoStat200ResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListGeoStat200ResponseInner.java new file mode 100644 index 00000000..cb8c4a71 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListGeoStat200ResponseInner.java @@ -0,0 +1,83 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.stats.models.ListGeoStat200ResponseInnerStatsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListGeoStat200ResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("date") + @Getter + @Setter + private String date; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("stats") + @Getter + @Setter + private List stats; + + public ListGeoStat200ResponseInner() {} + + private ListGeoStat200ResponseInner(Builder builder) { + this.date = builder.date; + this.stats = builder.stats; + } + + // Builder class for constructing object + public static class Builder { + + private String date; + private List stats; + + public Builder() {} + + public Builder date(String date) { + this.date = date; + return this; + } + + public Builder stats( + List stats + ) { + this.stats = stats; + return this; + } + + public ListGeoStat200ResponseInner build() { + return new ListGeoStat200ResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListGeoStat200ResponseInner.class.getSimpleName() + "(", + ")" + ); + if (date != null) joiner.add("date=" + date); + if (stats != null) joiner.add("stats=" + stats); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListGeoStat200ResponseInnerStatsInner.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListGeoStat200ResponseInnerStatsInner.java new file mode 100644 index 00000000..5bf72a34 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListGeoStat200ResponseInnerStatsInner.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.stats.models.AdvancedStatsClicksOpens; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListGeoStat200ResponseInnerStatsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metrics") + @Getter + @Setter + private AdvancedStatsClicksOpens metrics; + + public ListGeoStat200ResponseInnerStatsInner() {} + + private ListGeoStat200ResponseInnerStatsInner(Builder builder) { + this.type = builder.type; + this.name = builder.name; + this.metrics = builder.metrics; + } + + // Builder class for constructing object + public static class Builder { + + private String type; + private String name; + private AdvancedStatsClicksOpens metrics; + + public Builder() {} + + public Builder type(String type) { + this.type = type; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder metrics(AdvancedStatsClicksOpens metrics) { + this.metrics = metrics; + return this; + } + + public ListGeoStat200ResponseInnerStatsInner build() { + return new ListGeoStat200ResponseInnerStatsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListGeoStat200ResponseInnerStatsInner.class.getSimpleName() + "(", + ")" + ); + if (type != null) joiner.add("type=" + type); + if (name != null) joiner.add("name=" + name); + if (metrics != null) joiner.add("metrics=" + metrics); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListMailboxProviderStat200ResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListMailboxProviderStat200ResponseInner.java new file mode 100644 index 00000000..e2dd312c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListMailboxProviderStat200ResponseInner.java @@ -0,0 +1,83 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.stats.models.ListMailboxProviderStat200ResponseInnerStatsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListMailboxProviderStat200ResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("date") + @Getter + @Setter + private String date; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("stats") + @Getter + @Setter + private List stats; + + public ListMailboxProviderStat200ResponseInner() {} + + private ListMailboxProviderStat200ResponseInner(Builder builder) { + this.date = builder.date; + this.stats = builder.stats; + } + + // Builder class for constructing object + public static class Builder { + + private String date; + private List stats; + + public Builder() {} + + public Builder date(String date) { + this.date = date; + return this; + } + + public Builder stats( + List stats + ) { + this.stats = stats; + return this; + } + + public ListMailboxProviderStat200ResponseInner build() { + return new ListMailboxProviderStat200ResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListMailboxProviderStat200ResponseInner.class.getSimpleName() + "(", + ")" + ); + if (date != null) joiner.add("date=" + date); + if (stats != null) joiner.add("stats=" + stats); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListMailboxProviderStat200ResponseInnerStatsInner.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListMailboxProviderStat200ResponseInnerStatsInner.java new file mode 100644 index 00000000..ac77eb6e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListMailboxProviderStat200ResponseInnerStatsInner.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.stats.models.AdvancedStatsMailboxProvider; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListMailboxProviderStat200ResponseInnerStatsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metrics") + @Getter + @Setter + private AdvancedStatsMailboxProvider metrics; + + public ListMailboxProviderStat200ResponseInnerStatsInner() {} + + private ListMailboxProviderStat200ResponseInnerStatsInner(Builder builder) { + this.type = builder.type; + this.name = builder.name; + this.metrics = builder.metrics; + } + + // Builder class for constructing object + public static class Builder { + + private String type; + private String name; + private AdvancedStatsMailboxProvider metrics; + + public Builder() {} + + public Builder type(String type) { + this.type = type; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder metrics(AdvancedStatsMailboxProvider metrics) { + this.metrics = metrics; + return this; + } + + public ListMailboxProviderStat200ResponseInnerStatsInner build() { + return new ListMailboxProviderStat200ResponseInnerStatsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListMailboxProviderStat200ResponseInnerStatsInner.class.getSimpleName() + + "(", + ")" + ); + if (type != null) joiner.add("type=" + type); + if (name != null) joiner.add("name=" + name); + if (metrics != null) joiner.add("metrics=" + metrics); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListStat200ResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListStat200ResponseInner.java new file mode 100644 index 00000000..6918aa74 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListStat200ResponseInner.java @@ -0,0 +1,77 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.stats.models.ListStat200ResponseInnerStatsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListStat200ResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("date") + @Getter + @Setter + private String date; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("stats") + @Getter + @Setter + private List stats; + + public ListStat200ResponseInner() {} + + private ListStat200ResponseInner(Builder builder) { + this.date = builder.date; + this.stats = builder.stats; + } + + // Builder class for constructing object + public static class Builder { + + private String date; + private List stats; + + public Builder( + String date, + List stats + ) { + this.date = date; + this.stats = stats; + } + + public ListStat200ResponseInner build() { + return new ListStat200ResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListStat200ResponseInner.class.getSimpleName() + "(", + ")" + ); + if (date != null) joiner.add("date=" + date); + if (stats != null) joiner.add("stats=" + stats); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListStat200ResponseInnerStatsInner.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListStat200ResponseInnerStatsInner.java new file mode 100644 index 00000000..5ba9e39b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/ListStat200ResponseInnerStatsInner.java @@ -0,0 +1,66 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.stats.models.StatsAdvancedGlobalStats; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListStat200ResponseInnerStatsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metrics") + @Getter + @Setter + private StatsAdvancedGlobalStats metrics; + + public ListStat200ResponseInnerStatsInner() {} + + private ListStat200ResponseInnerStatsInner(Builder builder) { + this.metrics = builder.metrics; + } + + // Builder class for constructing object + public static class Builder { + + private StatsAdvancedGlobalStats metrics; + + public Builder() {} + + public Builder metrics(StatsAdvancedGlobalStats metrics) { + this.metrics = metrics; + return this; + } + + public ListStat200ResponseInnerStatsInner build() { + return new ListStat200ResponseInnerStatsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListStat200ResponseInnerStatsInner.class.getSimpleName() + "(", + ")" + ); + if (metrics != null) joiner.add("metrics=" + metrics); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/SortByDirection.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/SortByDirection.java new file mode 100644 index 00000000..569db172 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/SortByDirection.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum SortByDirection { + DESC("desc"), + + ASC("asc"); + + private final String value; + + private SortByDirection(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static SortByDirection forValue(final String value) { + return Promoter.enumFromString(value, SortByDirection.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/stats/models/StatsAdvancedGlobalStats.java b/src/main/java/com/sendgrid/rest/api/v3/stats/models/StatsAdvancedGlobalStats.java new file mode 100644 index 00000000..f9168bb8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/stats/models/StatsAdvancedGlobalStats.java @@ -0,0 +1,279 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Statistics API + * The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + * + * 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.stats.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class StatsAdvancedGlobalStats { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("clicks") + @Getter + @Setter + private Integer clicks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unique_clicks") + @Getter + @Setter + private Integer uniqueClicks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("opens") + @Getter + @Setter + private Integer opens; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unique_opens") + @Getter + @Setter + private Integer uniqueOpens; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("blocks") + @Getter + @Setter + private Integer blocks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounce_drops") + @Getter + @Setter + private Integer bounceDrops; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounces") + @Getter + @Setter + private Integer bounces; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("deferred") + @Getter + @Setter + private Integer deferred; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("delivered") + @Getter + @Setter + private Integer delivered; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("invalid_emails") + @Getter + @Setter + private Integer invalidEmails; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("processed") + @Getter + @Setter + private Integer processed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("requests") + @Getter + @Setter + private Integer requests; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_report_drops") + @Getter + @Setter + private Integer spamReportDrops; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_reports") + @Getter + @Setter + private Integer spamReports; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unsubscribe_drops") + @Getter + @Setter + private Integer unsubscribeDrops; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unsubscribes") + @Getter + @Setter + private Integer unsubscribes; + + public StatsAdvancedGlobalStats() {} + + private StatsAdvancedGlobalStats(Builder builder) { + this.clicks = builder.clicks; + this.uniqueClicks = builder.uniqueClicks; + this.opens = builder.opens; + this.uniqueOpens = builder.uniqueOpens; + this.blocks = builder.blocks; + this.bounceDrops = builder.bounceDrops; + this.bounces = builder.bounces; + this.deferred = builder.deferred; + this.delivered = builder.delivered; + this.invalidEmails = builder.invalidEmails; + this.processed = builder.processed; + this.requests = builder.requests; + this.spamReportDrops = builder.spamReportDrops; + this.spamReports = builder.spamReports; + this.unsubscribeDrops = builder.unsubscribeDrops; + this.unsubscribes = builder.unsubscribes; + } + + // Builder class for constructing object + public static class Builder { + + private Integer clicks; + private Integer uniqueClicks; + private Integer opens; + private Integer uniqueOpens; + private Integer blocks; + private Integer bounceDrops; + private Integer bounces; + private Integer deferred; + private Integer delivered; + private Integer invalidEmails; + private Integer processed; + private Integer requests; + private Integer spamReportDrops; + private Integer spamReports; + private Integer unsubscribeDrops; + private Integer unsubscribes; + + public Builder() {} + + public Builder clicks(Integer clicks) { + this.clicks = clicks; + return this; + } + + public Builder uniqueClicks(Integer uniqueClicks) { + this.uniqueClicks = uniqueClicks; + return this; + } + + public Builder opens(Integer opens) { + this.opens = opens; + return this; + } + + public Builder uniqueOpens(Integer uniqueOpens) { + this.uniqueOpens = uniqueOpens; + return this; + } + + public Builder blocks(Integer blocks) { + this.blocks = blocks; + return this; + } + + public Builder bounceDrops(Integer bounceDrops) { + this.bounceDrops = bounceDrops; + return this; + } + + public Builder bounces(Integer bounces) { + this.bounces = bounces; + return this; + } + + public Builder deferred(Integer deferred) { + this.deferred = deferred; + return this; + } + + public Builder delivered(Integer delivered) { + this.delivered = delivered; + return this; + } + + public Builder invalidEmails(Integer invalidEmails) { + this.invalidEmails = invalidEmails; + return this; + } + + public Builder processed(Integer processed) { + this.processed = processed; + return this; + } + + public Builder requests(Integer requests) { + this.requests = requests; + return this; + } + + public Builder spamReportDrops(Integer spamReportDrops) { + this.spamReportDrops = spamReportDrops; + return this; + } + + public Builder spamReports(Integer spamReports) { + this.spamReports = spamReports; + return this; + } + + public Builder unsubscribeDrops(Integer unsubscribeDrops) { + this.unsubscribeDrops = unsubscribeDrops; + return this; + } + + public Builder unsubscribes(Integer unsubscribes) { + this.unsubscribes = unsubscribes; + return this; + } + + public StatsAdvancedGlobalStats build() { + return new StatsAdvancedGlobalStats(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + StatsAdvancedGlobalStats.class.getSimpleName() + "(", + ")" + ); + if (clicks != null) joiner.add("clicks=" + clicks); + if (uniqueClicks != null) joiner.add("uniqueClicks=" + uniqueClicks); + if (opens != null) joiner.add("opens=" + opens); + if (uniqueOpens != null) joiner.add("uniqueOpens=" + uniqueOpens); + if (blocks != null) joiner.add("blocks=" + blocks); + if (bounceDrops != null) joiner.add("bounceDrops=" + bounceDrops); + if (bounces != null) joiner.add("bounces=" + bounces); + if (deferred != null) joiner.add("deferred=" + deferred); + if (delivered != null) joiner.add("delivered=" + delivered); + if (invalidEmails != null) joiner.add("invalidEmails=" + invalidEmails); + if (processed != null) joiner.add("processed=" + processed); + if (requests != null) joiner.add("requests=" + requests); + if (spamReportDrops != null) joiner.add( + "spamReportDrops=" + spamReportDrops + ); + if (spamReports != null) joiner.add("spamReports=" + spamReports); + if (unsubscribeDrops != null) joiner.add( + "unsubscribeDrops=" + unsubscribeDrops + ); + if (unsubscribes != null) joiner.add("unsubscribes=" + unsubscribes); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/CreateSubuser.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/CreateSubuser.java new file mode 100644 index 00000000..33075202 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/CreateSubuser.java @@ -0,0 +1,135 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers; + +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.subusers.models.CreateSubuserRequest; +import com.sendgrid.rest.api.v3.subusers.models.ErrorResponse; +import com.sendgrid.rest.api.v3.subusers.models.SubuserPost; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateSubuser extends ApiKeyBase { + + @Setter + private CreateSubuserRequest createSubuserRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/subusers"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "CreateSubuser 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), SubuserPost.class), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (createSubuserRequest != null) { + request.addBody(JsonUtil.toJson(createSubuserRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/DeleteSubuser.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/DeleteSubuser.java new file mode 100644 index 00000000..0f1e5ac0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/DeleteSubuser.java @@ -0,0 +1,92 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers; + +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.subusers.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DeleteSubuser extends ApiKeyBase { + + private final String subuserName; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/subusers/{subuser_name}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSubuser 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (subuserName != null) { + request.addPathParam("subuser_name", subuserName.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/GetSubuserCredit.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/GetSubuserCredit.java new file mode 100644 index 00000000..a3b07df5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/GetSubuserCredit.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers; + +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.subusers.models.ErrorResponse; +import com.sendgrid.rest.api.v3.subusers.models.SubuserCredits; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class GetSubuserCredit extends ApiKeyBase { + + private final String subuserName; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/subusers/{subuser_name}/credits"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetSubuserCredit 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), SubuserCredits.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (subuserName != null) { + request.addPathParam("subuser_name", subuserName.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/ListMonthlyStat.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/ListMonthlyStat.java new file mode 100644 index 00000000..1c88a8bc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/ListMonthlyStat.java @@ -0,0 +1,114 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers; + +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.subusers.models.SortByDirection1; +import com.sendgrid.rest.api.v3.subusers.models.SortByMetric; +import com.sendgrid.rest.api.v3.subusers.models.SubuserStats; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListMonthlyStat extends ApiKeyBase { + + private final String date; + + @Setter + private String subuser; + + @Setter + private SortByMetric sortByMetric; + + @Setter + private SortByDirection1 sortByDirection; + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/subusers/stats/monthly"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListMonthlyStat creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), SubuserStats.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (date != null) { + request.addQueryParam("date", date.toString()); + } + if (subuser != null) { + request.addQueryParam("subuser", subuser.toString()); + } + if (sortByMetric != null) { + request.addQueryParam("sort_by_metric", sortByMetric.toString()); + } + if (sortByDirection != null) { + request.addQueryParam( + "sort_by_direction", + sortByDirection.toString() + ); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/ListReputation.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/ListReputation.java new file mode 100644 index 00000000..8b836e96 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/ListReputation.java @@ -0,0 +1,83 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers; + +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.subusers.models.ListReputation200ResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListReputation extends ApiKeyBase { + + @Setter + private String usernames; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/subusers/reputations"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListReputation creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (usernames != null) { + request.addQueryParam("usernames", usernames.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/ListStat.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/ListStat.java new file mode 100644 index 00000000..00562a1c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/ListStat.java @@ -0,0 +1,111 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers; + +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.subusers.models.AggregatedBy; +import com.sendgrid.rest.api.v3.subusers.models.CategoryStats; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListStat extends ApiKeyBase { + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private AggregatedBy aggregatedBy; + + private final String subusers; + private final String startDate; + + @Setter + private String endDate; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/subusers/stats"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListStat creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (aggregatedBy != null) { + request.addQueryParam("aggregated_by", aggregatedBy.toString()); + } + if (subusers != null) { + request.addQueryParam("subusers", subusers.toString()); + } + if (startDate != null) { + request.addQueryParam("start_date", startDate.toString()); + } + if (endDate != null) { + request.addQueryParam("end_date", endDate.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/ListStatSum.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/ListStatSum.java new file mode 100644 index 00000000..4ebd600c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/ListStatSum.java @@ -0,0 +1,119 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers; + +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.subusers.models.CategoryStats; +import com.sendgrid.rest.api.v3.subusers.models.SortByDirection2; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListStatSum extends ApiKeyBase { + + @Setter + private SortByDirection2 sortByDirection; + + private final String startDate; + + @Setter + private String endDate; + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private String aggregatedBy; + + @Setter + private String sortByMetric; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/subusers/stats/sums"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListStatSum creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), CategoryStats.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (sortByDirection != null) { + request.addQueryParam( + "sort_by_direction", + sortByDirection.toString() + ); + } + if (startDate != null) { + request.addQueryParam("start_date", startDate.toString()); + } + if (endDate != null) { + request.addQueryParam("end_date", endDate.toString()); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (aggregatedBy != null) { + request.addQueryParam("aggregated_by", aggregatedBy.toString()); + } + if (sortByMetric != null) { + request.addQueryParam("sort_by_metric", sortByMetric.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/ListSubuser.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/ListSubuser.java new file mode 100644 index 00000000..341a6bb8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/ListSubuser.java @@ -0,0 +1,121 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers; + +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.subusers.models.ErrorResponse; +import com.sendgrid.rest.api.v3.subusers.models.Region; +import com.sendgrid.rest.api.v3.subusers.models.Subuser; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSubuser extends ApiKeyBase { + + @Setter + private String username; + + @Setter + private Integer limit; + + @Setter + private Region region; + + @Setter + private Boolean includeRegion; + + @Setter + private Integer offset; + + public ApiResponse> send(final ApiKeyRestClient client) { + String path = "/v3/subusers"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSubuser 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), List.class), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (username != null) { + request.addQueryParam("username", username.toString()); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (region != null) { + request.addQueryParam("region", region.toString()); + } + if (includeRegion != null) { + request.addQueryParam("include_region", includeRegion.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/ListSubuserMonthlyStat.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/ListSubuserMonthlyStat.java new file mode 100644 index 00000000..ffa50742 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/ListSubuserMonthlyStat.java @@ -0,0 +1,115 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers; + +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.subusers.models.SortByDirection; +import com.sendgrid.rest.api.v3.subusers.models.SubuserStats; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSubuserMonthlyStat extends ApiKeyBase { + + private final String subuserName; + private final String date; + + @Setter + private String sortByMetric; + + @Setter + private SortByDirection sortByDirection; + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/subusers/{subuser_name}/stats/monthly"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSubuserMonthlyStat creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), SubuserStats.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (subuserName != null) { + request.addPathParam("subuser_name", subuserName.toString()); + } + } + + private void addQueryParams(Request request) { + if (date != null) { + request.addQueryParam("date", date.toString()); + } + if (sortByMetric != null) { + request.addQueryParam("sort_by_metric", sortByMetric.toString()); + } + if (sortByDirection != null) { + request.addQueryParam( + "sort_by_direction", + sortByDirection.toString() + ); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/UpdateSubuser.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/UpdateSubuser.java new file mode 100644 index 00000000..c97f7389 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/UpdateSubuser.java @@ -0,0 +1,130 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers; + +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.subusers.models.ErrorResponse; +import com.sendgrid.rest.api.v3.subusers.models.UpdateSubuserRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateSubuser extends ApiKeyBase { + + private final String subuserName; + + @Setter + private UpdateSubuserRequest updateSubuserRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/subusers/{subuser_name}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateSubuser 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (subuserName != null) { + request.addPathParam("subuser_name", subuserName.toString()); + } + } + + private void addBody(final Request request) { + if (updateSubuserRequest != null) { + request.addBody(JsonUtil.toJson(updateSubuserRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/UpdateSubuserCredit.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/UpdateSubuserCredit.java new file mode 100644 index 00000000..18c65555 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/UpdateSubuserCredit.java @@ -0,0 +1,105 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers; + +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.subusers.models.ErrorResponse; +import com.sendgrid.rest.api.v3.subusers.models.SubuserCredits; +import com.sendgrid.rest.api.v3.subusers.models.SubuserCreditsRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateSubuserCredit extends ApiKeyBase { + + private final String subuserName; + + @Setter + private SubuserCreditsRequest subuserCreditsRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/subusers/{subuser_name}/credits"; + Request request = new Request( + HttpMethod.PUT, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateSubuserCredit 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), SubuserCredits.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (subuserName != null) { + request.addPathParam("subuser_name", subuserName.toString()); + } + } + + private void addBody(final Request request) { + if (subuserCreditsRequest != null) { + request.addBody(JsonUtil.toJson(subuserCreditsRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/UpdateSubuserIp.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/UpdateSubuserIp.java new file mode 100644 index 00000000..1bb33ac7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/UpdateSubuserIp.java @@ -0,0 +1,110 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers; + +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.subusers.models.ErrorResponse; +import com.sendgrid.rest.api.v3.subusers.models.UpdateSubuserIp200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateSubuserIp extends ApiKeyBase { + + private final String subuserName; + + @Setter + private List requestBody; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/subusers/{subuser_name}/ips"; + Request request = new Request( + HttpMethod.PUT, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateSubuserIp 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + UpdateSubuserIp200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (subuserName != null) { + request.addPathParam("subuser_name", subuserName.toString()); + } + } + + private void addBody(final Request request) { + if (requestBody != null) { + request.addBody(JsonUtil.toJson(requestBody)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/UpdateSubuserRemainingCredit.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/UpdateSubuserRemainingCredit.java new file mode 100644 index 00000000..488453f7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/UpdateSubuserRemainingCredit.java @@ -0,0 +1,107 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers; + +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.subusers.models.ErrorResponse; +import com.sendgrid.rest.api.v3.subusers.models.SubuserCredits; +import com.sendgrid.rest.api.v3.subusers.models.UpdateSubuserRemainingCreditRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateSubuserRemainingCredit extends ApiKeyBase { + + private final String subuserName; + + @Setter + private UpdateSubuserRemainingCreditRequest updateSubuserRemainingCreditRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/subusers/{subuser_name}/credits/remaining"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateSubuserRemainingCredit 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), SubuserCredits.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (subuserName != null) { + request.addPathParam("subuser_name", subuserName.toString()); + } + } + + private void addBody(final Request request) { + if (updateSubuserRemainingCreditRequest != null) { + request.addBody( + JsonUtil.toJson(updateSubuserRemainingCreditRequest) + ); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/UpdateSubuserWebsiteAccess.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/UpdateSubuserWebsiteAccess.java new file mode 100644 index 00000000..2078fb00 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/UpdateSubuserWebsiteAccess.java @@ -0,0 +1,89 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers; + +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.subusers.models.UpdateSubuserWebsiteAccessRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateSubuserWebsiteAccess extends ApiKeyBase { + + private final String subuserName; + + @Setter + private UpdateSubuserWebsiteAccessRequest updateSubuserWebsiteAccessRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/subusers/{subuser_name}/website_access"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateSubuserWebsiteAccess creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (subuserName != null) { + request.addPathParam("subuser_name", subuserName.toString()); + } + } + + private void addBody(final Request request) { + if (updateSubuserWebsiteAccessRequest != null) { + request.addBody(JsonUtil.toJson(updateSubuserWebsiteAccessRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/AggregatedBy.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/AggregatedBy.java new file mode 100644 index 00000000..ca986820 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/AggregatedBy.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum AggregatedBy { + DAY("day"), + + WEEK("week"), + + MONTH("month"); + + private final String value; + + private AggregatedBy(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static AggregatedBy forValue(final String value) { + return Promoter.enumFromString(value, AggregatedBy.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/CategoryStats.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/CategoryStats.java new file mode 100644 index 00000000..327a9300 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/CategoryStats.java @@ -0,0 +1,78 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.subusers.models.CategoryStatsStatsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CategoryStats { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("date") + @Getter + @Setter + private String date; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("stats") + @Getter + @Setter + private List stats; + + public CategoryStats() {} + + private CategoryStats(Builder builder) { + this.date = builder.date; + this.stats = builder.stats; + } + + // Builder class for constructing object + public static class Builder { + + private String date; + private List stats; + + public Builder(String date) { + this.date = date; + } + + public Builder stats(List stats) { + this.stats = stats; + return this; + } + + public CategoryStats build() { + return new CategoryStats(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CategoryStats.class.getSimpleName() + "(", + ")" + ); + if (date != null) joiner.add("date=" + date); + if (stats != null) joiner.add("stats=" + stats); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/CategoryStatsStatsInner.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/CategoryStatsStatsInner.java new file mode 100644 index 00000000..3b052241 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/CategoryStatsStatsInner.java @@ -0,0 +1,91 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.subusers.models.CategoryStatsStatsInnerMetrics; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CategoryStatsStatsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metrics") + @Getter + @Setter + private CategoryStatsStatsInnerMetrics metrics; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + public CategoryStatsStatsInner() {} + + private CategoryStatsStatsInner(Builder builder) { + this.metrics = builder.metrics; + this.name = builder.name; + this.type = builder.type; + } + + // Builder class for constructing object + public static class Builder { + + private CategoryStatsStatsInnerMetrics metrics; + private String name; + private String type; + + public Builder(String type) { + this.type = type; + } + + public Builder metrics(CategoryStatsStatsInnerMetrics metrics) { + this.metrics = metrics; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public CategoryStatsStatsInner build() { + return new CategoryStatsStatsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CategoryStatsStatsInner.class.getSimpleName() + "(", + ")" + ); + if (metrics != null) joiner.add("metrics=" + metrics); + if (name != null) joiner.add("name=" + name); + if (type != null) joiner.add("type=" + type); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/CategoryStatsStatsInnerMetrics.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/CategoryStatsStatsInnerMetrics.java new file mode 100644 index 00000000..07c88f66 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/CategoryStatsStatsInnerMetrics.java @@ -0,0 +1,233 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CategoryStatsStatsInnerMetrics { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("blocks") + @Getter + @Setter + private Integer blocks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounce_drops") + @Getter + @Setter + private Integer bounceDrops; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounces") + @Getter + @Setter + private Integer bounces; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("clicks") + @Getter + @Setter + private Integer clicks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("deferred") + @Getter + @Setter + private Integer deferred; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("delivered") + @Getter + @Setter + private Integer delivered; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("invalid_emails") + @Getter + @Setter + private Integer invalidEmails; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("opens") + @Getter + @Setter + private Integer opens; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("processed") + @Getter + @Setter + private Integer processed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("requests") + @Getter + @Setter + private Integer requests; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_report_drops") + @Getter + @Setter + private Integer spamReportDrops; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_reports") + @Getter + @Setter + private Integer spamReports; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unique_clicks") + @Getter + @Setter + private Integer uniqueClicks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unique_opens") + @Getter + @Setter + private Integer uniqueOpens; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unsubscribe_drops") + @Getter + @Setter + private Integer unsubscribeDrops; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unsubscribes") + @Getter + @Setter + private Integer unsubscribes; + + public CategoryStatsStatsInnerMetrics() {} + + private CategoryStatsStatsInnerMetrics(Builder builder) { + this.blocks = builder.blocks; + this.bounceDrops = builder.bounceDrops; + this.bounces = builder.bounces; + this.clicks = builder.clicks; + this.deferred = builder.deferred; + this.delivered = builder.delivered; + this.invalidEmails = builder.invalidEmails; + this.opens = builder.opens; + this.processed = builder.processed; + this.requests = builder.requests; + this.spamReportDrops = builder.spamReportDrops; + this.spamReports = builder.spamReports; + this.uniqueClicks = builder.uniqueClicks; + this.uniqueOpens = builder.uniqueOpens; + this.unsubscribeDrops = builder.unsubscribeDrops; + this.unsubscribes = builder.unsubscribes; + } + + // Builder class for constructing object + public static class Builder { + + private Integer blocks; + private Integer bounceDrops; + private Integer bounces; + private Integer clicks; + private Integer deferred; + private Integer delivered; + private Integer invalidEmails; + private Integer opens; + private Integer processed; + private Integer requests; + private Integer spamReportDrops; + private Integer spamReports; + private Integer uniqueClicks; + private Integer uniqueOpens; + private Integer unsubscribeDrops; + private Integer unsubscribes; + + public Builder( + Integer blocks, + Integer bounceDrops, + Integer bounces, + Integer clicks, + Integer deferred, + Integer delivered, + Integer invalidEmails, + Integer opens, + Integer processed, + Integer requests, + Integer spamReportDrops, + Integer spamReports, + Integer uniqueClicks, + Integer uniqueOpens, + Integer unsubscribeDrops, + Integer unsubscribes + ) { + this.blocks = blocks; + this.bounceDrops = bounceDrops; + this.bounces = bounces; + this.clicks = clicks; + this.deferred = deferred; + this.delivered = delivered; + this.invalidEmails = invalidEmails; + this.opens = opens; + this.processed = processed; + this.requests = requests; + this.spamReportDrops = spamReportDrops; + this.spamReports = spamReports; + this.uniqueClicks = uniqueClicks; + this.uniqueOpens = uniqueOpens; + this.unsubscribeDrops = unsubscribeDrops; + this.unsubscribes = unsubscribes; + } + + public CategoryStatsStatsInnerMetrics build() { + return new CategoryStatsStatsInnerMetrics(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CategoryStatsStatsInnerMetrics.class.getSimpleName() + "(", + ")" + ); + if (blocks != null) joiner.add("blocks=" + blocks); + if (bounceDrops != null) joiner.add("bounceDrops=" + bounceDrops); + if (bounces != null) joiner.add("bounces=" + bounces); + if (clicks != null) joiner.add("clicks=" + clicks); + if (deferred != null) joiner.add("deferred=" + deferred); + if (delivered != null) joiner.add("delivered=" + delivered); + if (invalidEmails != null) joiner.add("invalidEmails=" + invalidEmails); + if (opens != null) joiner.add("opens=" + opens); + if (processed != null) joiner.add("processed=" + processed); + if (requests != null) joiner.add("requests=" + requests); + if (spamReportDrops != null) joiner.add( + "spamReportDrops=" + spamReportDrops + ); + if (spamReports != null) joiner.add("spamReports=" + spamReports); + if (uniqueClicks != null) joiner.add("uniqueClicks=" + uniqueClicks); + if (uniqueOpens != null) joiner.add("uniqueOpens=" + uniqueOpens); + if (unsubscribeDrops != null) joiner.add( + "unsubscribeDrops=" + unsubscribeDrops + ); + if (unsubscribes != null) joiner.add("unsubscribes=" + unsubscribes); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/CreateSubuserRequest.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/CreateSubuserRequest.java new file mode 100644 index 00000000..77674b2b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/CreateSubuserRequest.java @@ -0,0 +1,127 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.subusers.models.Region1; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateSubuserRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("password") + @Getter + @Setter + private String password; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ips") + @Getter + @Setter + private List ips; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("region") + @Getter + @Setter + private Region1 region; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("include_region") + @Getter + @Setter + private Boolean includeRegion; + + public CreateSubuserRequest() {} + + private CreateSubuserRequest(Builder builder) { + this.username = builder.username; + this.email = builder.email; + this.password = builder.password; + this.ips = builder.ips; + this.region = builder.region; + this.includeRegion = builder.includeRegion; + } + + // Builder class for constructing object + public static class Builder { + + private String username; + private String email; + private String password; + private List ips; + private Region1 region; + private Boolean includeRegion; + + public Builder( + String username, + String email, + String password, + List ips + ) { + this.username = username; + this.email = email; + this.password = password; + this.ips = ips; + } + + public Builder region(Region1 region) { + this.region = region; + return this; + } + + public Builder includeRegion(Boolean includeRegion) { + this.includeRegion = includeRegion; + return this; + } + + public CreateSubuserRequest build() { + return new CreateSubuserRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateSubuserRequest.class.getSimpleName() + "(", + ")" + ); + if (username != null) joiner.add("username=" + username); + if (email != null) joiner.add("email=" + email); + if (password != null) joiner.add("password=" + password); + if (ips != null) joiner.add("ips=" + ips); + if (region != null) joiner.add("region=" + region); + if (includeRegion != null) joiner.add("includeRegion=" + includeRegion); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/ErrorResponse.java new file mode 100644 index 00000000..550052e0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.subusers.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..5747d876 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/ListReputation200ResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/ListReputation200ResponseInner.java new file mode 100644 index 00000000..1e539526 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/ListReputation200ResponseInner.java @@ -0,0 +1,73 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListReputation200ResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reputation") + @Getter + @Setter + private BigDecimal reputation; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + public ListReputation200ResponseInner() {} + + private ListReputation200ResponseInner(Builder builder) { + this.reputation = builder.reputation; + this.username = builder.username; + } + + // Builder class for constructing object + public static class Builder { + + private BigDecimal reputation; + private String username; + + public Builder(BigDecimal reputation, String username) { + this.reputation = reputation; + this.username = username; + } + + public ListReputation200ResponseInner build() { + return new ListReputation200ResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListReputation200ResponseInner.class.getSimpleName() + "(", + ")" + ); + if (reputation != null) joiner.add("reputation=" + reputation); + if (username != null) joiner.add("username=" + username); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Region.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Region.java new file mode 100644 index 00000000..a3aab774 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Region.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Region { + ALL("all"), + + GLOBAL("global"), + + EU("eu"); + + private final String value; + + private Region(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Region forValue(final String value) { + return Promoter.enumFromString(value, Region.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Region1.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Region1.java new file mode 100644 index 00000000..8edb080e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Region1.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Region1 { + GLOBAL("global"), + + EU("eu"); + + private final String value; + + private Region1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Region1 forValue(final String value) { + return Promoter.enumFromString(value, Region1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Region2.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Region2.java new file mode 100644 index 00000000..9789c420 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Region2.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Region2 { + GLOBAL("global"), + + EU("eu"); + + private final String value; + + private Region2(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Region2 forValue(final String value) { + return Promoter.enumFromString(value, Region2.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Region3.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Region3.java new file mode 100644 index 00000000..a4e8bc6a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Region3.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Region3 { + GLOBAL("global"), + + EU("eu"); + + private final String value; + + private Region3(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Region3 forValue(final String value) { + return Promoter.enumFromString(value, Region3.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/ResetFrequency.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/ResetFrequency.java new file mode 100644 index 00000000..21882edb --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/ResetFrequency.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum ResetFrequency { + MONTHLY("monthly"), + + WEEKLY("weekly"), + + DAILY("daily"); + + private final String value; + + private ResetFrequency(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static ResetFrequency forValue(final String value) { + return Promoter.enumFromString(value, ResetFrequency.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/ResetFrequency1.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/ResetFrequency1.java new file mode 100644 index 00000000..4128c727 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/ResetFrequency1.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum ResetFrequency1 { + MONTHLY("monthly"), + + WEEKLY("weekly"), + + DAILY("daily"); + + private final String value; + + private ResetFrequency1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static ResetFrequency1 forValue(final String value) { + return Promoter.enumFromString(value, ResetFrequency1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SortByDirection.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SortByDirection.java new file mode 100644 index 00000000..64f6484b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SortByDirection.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum SortByDirection { + DESC("desc"), + + ASC("asc"); + + private final String value; + + private SortByDirection(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static SortByDirection forValue(final String value) { + return Promoter.enumFromString(value, SortByDirection.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SortByDirection1.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SortByDirection1.java new file mode 100644 index 00000000..9efc576c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SortByDirection1.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum SortByDirection1 { + DESC("desc"), + + ASC("asc"); + + private final String value; + + private SortByDirection1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static SortByDirection1 forValue(final String value) { + return Promoter.enumFromString(value, SortByDirection1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SortByDirection2.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SortByDirection2.java new file mode 100644 index 00000000..8994c6df --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SortByDirection2.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum SortByDirection2 { + DESC("desc"), + + ASC("asc"); + + private final String value; + + private SortByDirection2(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static SortByDirection2 forValue(final String value) { + return Promoter.enumFromString(value, SortByDirection2.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SortByMetric.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SortByMetric.java new file mode 100644 index 00000000..9e190f79 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SortByMetric.java @@ -0,0 +1,56 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum SortByMetric { + BLOCKS("blocks"), + + BOUNCES("bounces"), + + CLICKS("clicks"), + + DELIVERED("delivered"), + + OPENS("opens"), + + REQUESTS("requests"), + + UNIQUE_CLICKS("unique_clicks"), + + UNIQUE_OPENS("unique_opens"), + + UNSUBSCRIBES("unsubscribes"); + + private final String value; + + private SortByMetric(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static SortByMetric forValue(final String value) { + return Promoter.enumFromString(value, SortByMetric.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Subuser.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Subuser.java new file mode 100644 index 00000000..ec80d70a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Subuser.java @@ -0,0 +1,113 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.subusers.models.Region2; +import java.math.BigDecimal; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Subuser { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("disabled") + @Getter + @Setter + private Boolean disabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private BigDecimal id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("region") + @Getter + @Setter + private Region2 region; + + public Subuser() {} + + private Subuser(Builder builder) { + this.disabled = builder.disabled; + this.id = builder.id; + this.username = builder.username; + this.email = builder.email; + this.region = builder.region; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean disabled; + private BigDecimal id; + private String username; + private String email; + private Region2 region; + + public Builder( + Boolean disabled, + BigDecimal id, + String username, + String email + ) { + this.disabled = disabled; + this.id = id; + this.username = username; + this.email = email; + } + + public Builder region(Region2 region) { + this.region = region; + return this; + } + + public Subuser build() { + return new Subuser(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Subuser.class.getSimpleName() + "(", + ")" + ); + if (disabled != null) joiner.add("disabled=" + disabled); + if (id != null) joiner.add("id=" + id); + if (username != null) joiner.add("username=" + username); + if (email != null) joiner.add("email=" + email); + if (region != null) joiner.add("region=" + region); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserCredits.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserCredits.java new file mode 100644 index 00000000..455bac11 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserCredits.java @@ -0,0 +1,112 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.subusers.models.ResetFrequency; +import com.sendgrid.rest.api.v3.subusers.models.Type; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SubuserCredits { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private Type type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reset_frequency") + @Getter + @Setter + private ResetFrequency resetFrequency; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("remain") + @Getter + @Setter + private Integer remain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("total") + @Getter + @Setter + private Integer total; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("used") + @Getter + @Setter + private Integer used; + + public SubuserCredits() {} + + private SubuserCredits(Builder builder) { + this.type = builder.type; + this.resetFrequency = builder.resetFrequency; + this.remain = builder.remain; + this.total = builder.total; + this.used = builder.used; + } + + // Builder class for constructing object + public static class Builder { + + private Type type; + private ResetFrequency resetFrequency; + private Integer remain; + private Integer total; + private Integer used; + + public Builder( + Type type, + ResetFrequency resetFrequency, + Integer remain, + Integer total, + Integer used + ) { + this.type = type; + this.resetFrequency = resetFrequency; + this.remain = remain; + this.total = total; + this.used = used; + } + + public SubuserCredits build() { + return new SubuserCredits(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SubuserCredits.class.getSimpleName() + "(", + ")" + ); + if (type != null) joiner.add("type=" + type); + if (resetFrequency != null) joiner.add( + "resetFrequency=" + resetFrequency + ); + if (remain != null) joiner.add("remain=" + remain); + if (total != null) joiner.add("total=" + total); + if (used != null) joiner.add("used=" + used); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserCreditsRequest.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserCreditsRequest.java new file mode 100644 index 00000000..08eecfad --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserCreditsRequest.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.subusers.models.ResetFrequency1; +import com.sendgrid.rest.api.v3.subusers.models.Type1; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SubuserCreditsRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private Type1 type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reset_frequency") + @Getter + @Setter + private ResetFrequency1 resetFrequency; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("total") + @Getter + @Setter + private Integer total; + + public SubuserCreditsRequest() {} + + private SubuserCreditsRequest(Builder builder) { + this.type = builder.type; + this.resetFrequency = builder.resetFrequency; + this.total = builder.total; + } + + // Builder class for constructing object + public static class Builder { + + private Type1 type; + private ResetFrequency1 resetFrequency; + private Integer total; + + public Builder(Type1 type) { + this.type = type; + } + + public Builder resetFrequency(ResetFrequency1 resetFrequency) { + this.resetFrequency = resetFrequency; + return this; + } + + public Builder total(Integer total) { + this.total = total; + return this; + } + + public SubuserCreditsRequest build() { + return new SubuserCreditsRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SubuserCreditsRequest.class.getSimpleName() + "(", + ")" + ); + if (type != null) joiner.add("type=" + type); + if (resetFrequency != null) joiner.add( + "resetFrequency=" + resetFrequency + ); + if (total != null) joiner.add("total=" + total); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserPost.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserPost.java new file mode 100644 index 00000000..e088d7de --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserPost.java @@ -0,0 +1,117 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.subusers.models.Region3; +import com.sendgrid.rest.api.v3.subusers.models.SubuserPostCreditAllocation; +import java.math.BigDecimal; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SubuserPost { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("user_id") + @Getter + @Setter + private BigDecimal userId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("credit_allocation") + @Getter + @Setter + private SubuserPostCreditAllocation creditAllocation; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("region") + @Getter + @Setter + private Region3 region; + + public SubuserPost() {} + + private SubuserPost(Builder builder) { + this.username = builder.username; + this.userId = builder.userId; + this.email = builder.email; + this.creditAllocation = builder.creditAllocation; + this.region = builder.region; + } + + // Builder class for constructing object + public static class Builder { + + private String username; + private BigDecimal userId; + private String email; + private SubuserPostCreditAllocation creditAllocation; + private Region3 region; + + public Builder(String username, BigDecimal userId, String email) { + this.username = username; + this.userId = userId; + this.email = email; + } + + public Builder creditAllocation( + SubuserPostCreditAllocation creditAllocation + ) { + this.creditAllocation = creditAllocation; + return this; + } + + public Builder region(Region3 region) { + this.region = region; + return this; + } + + public SubuserPost build() { + return new SubuserPost(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SubuserPost.class.getSimpleName() + "(", + ")" + ); + if (username != null) joiner.add("username=" + username); + if (userId != null) joiner.add("userId=" + userId); + if (email != null) joiner.add("email=" + email); + if (creditAllocation != null) joiner.add( + "creditAllocation=" + creditAllocation + ); + if (region != null) joiner.add("region=" + region); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserPostCreditAllocation.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserPostCreditAllocation.java new file mode 100644 index 00000000..ce4602bf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserPostCreditAllocation.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SubuserPostCreditAllocation { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + public SubuserPostCreditAllocation() {} + + private SubuserPostCreditAllocation(Builder builder) { + this.type = builder.type; + } + + // Builder class for constructing object + public static class Builder { + + private String type; + + public Builder() {} + + public Builder type(String type) { + this.type = type; + return this; + } + + public SubuserPostCreditAllocation build() { + return new SubuserPostCreditAllocation(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SubuserPostCreditAllocation.class.getSimpleName() + "(", + ")" + ); + if (type != null) joiner.add("type=" + type); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserStats.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserStats.java new file mode 100644 index 00000000..ff3f0472 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserStats.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.subusers.models.SubuserStatsStatsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SubuserStats { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("date") + @Getter + @Setter + private String date; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("stats") + @Getter + @Setter + private List stats; + + public SubuserStats() {} + + private SubuserStats(Builder builder) { + this.date = builder.date; + this.stats = builder.stats; + } + + // Builder class for constructing object + public static class Builder { + + private String date; + private List stats; + + public Builder() {} + + public Builder date(String date) { + this.date = date; + return this; + } + + public Builder stats(List stats) { + this.stats = stats; + return this; + } + + public SubuserStats build() { + return new SubuserStats(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SubuserStats.class.getSimpleName() + "(", + ")" + ); + if (date != null) joiner.add("date=" + date); + if (stats != null) joiner.add("stats=" + stats); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserStatsStatsInner.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserStatsStatsInner.java new file mode 100644 index 00000000..ee644c7a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserStatsStatsInner.java @@ -0,0 +1,122 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.subusers.models.SubuserStatsStatsInnerMetrics; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SubuserStatsStatsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metrics") + @Getter + @Setter + private SubuserStatsStatsInnerMetrics metrics; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + public SubuserStatsStatsInner() {} + + private SubuserStatsStatsInner(Builder builder) { + this.firstName = builder.firstName; + this.lastName = builder.lastName; + this.metrics = builder.metrics; + this.name = builder.name; + this.type = builder.type; + } + + // Builder class for constructing object + public static class Builder { + + private String firstName; + private String lastName; + private SubuserStatsStatsInnerMetrics metrics; + private String name; + private String type; + + public Builder() {} + + public Builder firstName(String firstName) { + this.firstName = firstName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = lastName; + return this; + } + + public Builder metrics(SubuserStatsStatsInnerMetrics metrics) { + this.metrics = metrics; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder type(String type) { + this.type = type; + return this; + } + + public SubuserStatsStatsInner build() { + return new SubuserStatsStatsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SubuserStatsStatsInner.class.getSimpleName() + "(", + ")" + ); + if (firstName != null) joiner.add("firstName=" + firstName); + if (lastName != null) joiner.add("lastName=" + lastName); + if (metrics != null) joiner.add("metrics=" + metrics); + if (name != null) joiner.add("name=" + name); + if (type != null) joiner.add("type=" + type); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserStatsStatsInnerMetrics.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserStatsStatsInnerMetrics.java new file mode 100644 index 00000000..3f590747 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/SubuserStatsStatsInnerMetrics.java @@ -0,0 +1,279 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SubuserStatsStatsInnerMetrics { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("blocks") + @Getter + @Setter + private Integer blocks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounce_drops") + @Getter + @Setter + private Integer bounceDrops; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounces") + @Getter + @Setter + private Integer bounces; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("clicks") + @Getter + @Setter + private Integer clicks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("deferred") + @Getter + @Setter + private Integer deferred; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("delivered") + @Getter + @Setter + private Integer delivered; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("invalid_emails") + @Getter + @Setter + private Integer invalidEmails; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("opens") + @Getter + @Setter + private Integer opens; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("processed") + @Getter + @Setter + private Integer processed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("requests") + @Getter + @Setter + private Integer requests; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_report_drops") + @Getter + @Setter + private Integer spamReportDrops; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_reports") + @Getter + @Setter + private Integer spamReports; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unique_clicks") + @Getter + @Setter + private Integer uniqueClicks; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unique_opens") + @Getter + @Setter + private Integer uniqueOpens; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unsubscribe_drops") + @Getter + @Setter + private Integer unsubscribeDrops; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unsubscribes") + @Getter + @Setter + private Integer unsubscribes; + + public SubuserStatsStatsInnerMetrics() {} + + private SubuserStatsStatsInnerMetrics(Builder builder) { + this.blocks = builder.blocks; + this.bounceDrops = builder.bounceDrops; + this.bounces = builder.bounces; + this.clicks = builder.clicks; + this.deferred = builder.deferred; + this.delivered = builder.delivered; + this.invalidEmails = builder.invalidEmails; + this.opens = builder.opens; + this.processed = builder.processed; + this.requests = builder.requests; + this.spamReportDrops = builder.spamReportDrops; + this.spamReports = builder.spamReports; + this.uniqueClicks = builder.uniqueClicks; + this.uniqueOpens = builder.uniqueOpens; + this.unsubscribeDrops = builder.unsubscribeDrops; + this.unsubscribes = builder.unsubscribes; + } + + // Builder class for constructing object + public static class Builder { + + private Integer blocks; + private Integer bounceDrops; + private Integer bounces; + private Integer clicks; + private Integer deferred; + private Integer delivered; + private Integer invalidEmails; + private Integer opens; + private Integer processed; + private Integer requests; + private Integer spamReportDrops; + private Integer spamReports; + private Integer uniqueClicks; + private Integer uniqueOpens; + private Integer unsubscribeDrops; + private Integer unsubscribes; + + public Builder() {} + + public Builder blocks(Integer blocks) { + this.blocks = blocks; + return this; + } + + public Builder bounceDrops(Integer bounceDrops) { + this.bounceDrops = bounceDrops; + return this; + } + + public Builder bounces(Integer bounces) { + this.bounces = bounces; + return this; + } + + public Builder clicks(Integer clicks) { + this.clicks = clicks; + return this; + } + + public Builder deferred(Integer deferred) { + this.deferred = deferred; + return this; + } + + public Builder delivered(Integer delivered) { + this.delivered = delivered; + return this; + } + + public Builder invalidEmails(Integer invalidEmails) { + this.invalidEmails = invalidEmails; + return this; + } + + public Builder opens(Integer opens) { + this.opens = opens; + return this; + } + + public Builder processed(Integer processed) { + this.processed = processed; + return this; + } + + public Builder requests(Integer requests) { + this.requests = requests; + return this; + } + + public Builder spamReportDrops(Integer spamReportDrops) { + this.spamReportDrops = spamReportDrops; + return this; + } + + public Builder spamReports(Integer spamReports) { + this.spamReports = spamReports; + return this; + } + + public Builder uniqueClicks(Integer uniqueClicks) { + this.uniqueClicks = uniqueClicks; + return this; + } + + public Builder uniqueOpens(Integer uniqueOpens) { + this.uniqueOpens = uniqueOpens; + return this; + } + + public Builder unsubscribeDrops(Integer unsubscribeDrops) { + this.unsubscribeDrops = unsubscribeDrops; + return this; + } + + public Builder unsubscribes(Integer unsubscribes) { + this.unsubscribes = unsubscribes; + return this; + } + + public SubuserStatsStatsInnerMetrics build() { + return new SubuserStatsStatsInnerMetrics(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SubuserStatsStatsInnerMetrics.class.getSimpleName() + "(", + ")" + ); + if (blocks != null) joiner.add("blocks=" + blocks); + if (bounceDrops != null) joiner.add("bounceDrops=" + bounceDrops); + if (bounces != null) joiner.add("bounces=" + bounces); + if (clicks != null) joiner.add("clicks=" + clicks); + if (deferred != null) joiner.add("deferred=" + deferred); + if (delivered != null) joiner.add("delivered=" + delivered); + if (invalidEmails != null) joiner.add("invalidEmails=" + invalidEmails); + if (opens != null) joiner.add("opens=" + opens); + if (processed != null) joiner.add("processed=" + processed); + if (requests != null) joiner.add("requests=" + requests); + if (spamReportDrops != null) joiner.add( + "spamReportDrops=" + spamReportDrops + ); + if (spamReports != null) joiner.add("spamReports=" + spamReports); + if (uniqueClicks != null) joiner.add("uniqueClicks=" + uniqueClicks); + if (uniqueOpens != null) joiner.add("uniqueOpens=" + uniqueOpens); + if (unsubscribeDrops != null) joiner.add( + "unsubscribeDrops=" + unsubscribeDrops + ); + if (unsubscribes != null) joiner.add("unsubscribes=" + unsubscribes); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Type.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Type.java new file mode 100644 index 00000000..49282ff9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Type.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Type { + UNLIMITED("unlimited"), + + RECURRING("recurring"), + + NONRECURRING("nonrecurring"); + + private final String value; + + private Type(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Type forValue(final String value) { + return Promoter.enumFromString(value, Type.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Type1.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Type1.java new file mode 100644 index 00000000..dd37f9e4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/Type1.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Type1 { + UNLIMITED("unlimited"), + + RECURRING("recurring"), + + NONRECURRING("nonrecurring"); + + private final String value; + + private Type1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Type1 forValue(final String value) { + return Promoter.enumFromString(value, Type1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/UpdateSubuserIp200Response.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/UpdateSubuserIp200Response.java new file mode 100644 index 00000000..6cbc586b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/UpdateSubuserIp200Response.java @@ -0,0 +1,66 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateSubuserIp200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ips") + @Getter + @Setter + private List ips; + + public UpdateSubuserIp200Response() {} + + private UpdateSubuserIp200Response(Builder builder) { + this.ips = builder.ips; + } + + // Builder class for constructing object + public static class Builder { + + private List ips; + + public Builder() {} + + public Builder ips(List ips) { + this.ips = ips; + return this; + } + + public UpdateSubuserIp200Response build() { + return new UpdateSubuserIp200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateSubuserIp200Response.class.getSimpleName() + "(", + ")" + ); + if (ips != null) joiner.add("ips=" + ips); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/UpdateSubuserRemainingCreditRequest.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/UpdateSubuserRemainingCreditRequest.java new file mode 100644 index 00000000..d4e8145f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/UpdateSubuserRemainingCreditRequest.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateSubuserRemainingCreditRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("allocation_update") + @Getter + @Setter + private Integer allocationUpdate; + + public UpdateSubuserRemainingCreditRequest() {} + + private UpdateSubuserRemainingCreditRequest(Builder builder) { + this.allocationUpdate = builder.allocationUpdate; + } + + // Builder class for constructing object + public static class Builder { + + private Integer allocationUpdate; + + public Builder(Integer allocationUpdate) { + this.allocationUpdate = allocationUpdate; + } + + public UpdateSubuserRemainingCreditRequest build() { + return new UpdateSubuserRemainingCreditRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateSubuserRemainingCreditRequest.class.getSimpleName() + "(", + ")" + ); + if (allocationUpdate != null) joiner.add( + "allocationUpdate=" + allocationUpdate + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/UpdateSubuserRequest.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/UpdateSubuserRequest.java new file mode 100644 index 00000000..413e175c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/UpdateSubuserRequest.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateSubuserRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("disabled") + @Getter + @Setter + private Boolean disabled; + + public UpdateSubuserRequest() {} + + private UpdateSubuserRequest(Builder builder) { + this.disabled = builder.disabled; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean disabled; + + public Builder() {} + + public Builder disabled(Boolean disabled) { + this.disabled = disabled; + return this; + } + + public UpdateSubuserRequest build() { + return new UpdateSubuserRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateSubuserRequest.class.getSimpleName() + "(", + ")" + ); + if (disabled != null) joiner.add("disabled=" + disabled); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/subusers/models/UpdateSubuserWebsiteAccessRequest.java b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/UpdateSubuserWebsiteAccessRequest.java new file mode 100644 index 00000000..f14a2c09 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/subusers/models/UpdateSubuserWebsiteAccessRequest.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Subusers + * The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + * + * 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.subusers.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateSubuserWebsiteAccessRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("disabled") + @Getter + @Setter + private Boolean disabled; + + public UpdateSubuserWebsiteAccessRequest() {} + + private UpdateSubuserWebsiteAccessRequest(Builder builder) { + this.disabled = builder.disabled; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean disabled; + + public Builder() {} + + public Builder disabled(Boolean disabled) { + this.disabled = disabled; + return this; + } + + public UpdateSubuserWebsiteAccessRequest build() { + return new UpdateSubuserWebsiteAccessRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateSubuserWebsiteAccessRequest.class.getSimpleName() + "(", + ")" + ); + if (disabled != null) joiner.add("disabled=" + disabled); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/AddSuppressionToAsmGroup.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/AddSuppressionToAsmGroup.java new file mode 100644 index 00000000..dfa9449e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/AddSuppressionToAsmGroup.java @@ -0,0 +1,105 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.AddSuppressionToAsmGroup201Response; +import com.sendgrid.rest.api.v3.suppressions.models.SuppressionsRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class AddSuppressionToAsmGroup extends ApiKeyBase { + + private final String groupId; + + @Setter + private String onBehalfOf; + + @Setter + private SuppressionsRequest suppressionsRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/asm/groups/{group_id}/suppressions"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "AddSuppressionToAsmGroup creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + AddSuppressionToAsmGroup201Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (groupId != null) { + request.addPathParam("group_id", groupId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (suppressionsRequest != null) { + request.addBody(JsonUtil.toJson(suppressionsRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/CreatAsmGroup.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/CreatAsmGroup.java new file mode 100644 index 00000000..9ddb8542 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/CreatAsmGroup.java @@ -0,0 +1,96 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.CreatAsmGroup201Response; +import com.sendgrid.rest.api.v3.suppressions.models.SuppressionGroupRequestBaseProps; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreatAsmGroup extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private SuppressionGroupRequestBaseProps suppressionGroupRequestBaseProps; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/asm/groups"; + 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( + "CreatAsmGroup creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + CreatAsmGroup201Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (suppressionGroupRequestBaseProps != null) { + request.addBody(JsonUtil.toJson(suppressionGroupRequestBaseProps)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/CreateGlobalSuppression.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/CreateGlobalSuppression.java new file mode 100644 index 00000000..e7fe1aa6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/CreateGlobalSuppression.java @@ -0,0 +1,96 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.CreateGlobalSuppression201Response; +import com.sendgrid.rest.api.v3.suppressions.models.SuppressionsRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateGlobalSuppression extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private SuppressionsRequest suppressionsRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/asm/suppressions/global"; + 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( + "CreateGlobalSuppression creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + CreateGlobalSuppression201Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (suppressionsRequest != null) { + request.addBody(JsonUtil.toJson(suppressionsRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteAsmGroup.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteAsmGroup.java new file mode 100644 index 00000000..ad7cfcd1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteAsmGroup.java @@ -0,0 +1,88 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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 lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteAsmGroup extends ApiKeyBase { + + private final String groupId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/asm/groups/{group_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteAsmGroup creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (groupId != null) { + request.addPathParam("group_id", groupId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteGlobalSuppression.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteGlobalSuppression.java new file mode 100644 index 00000000..b74ae34d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteGlobalSuppression.java @@ -0,0 +1,88 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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 lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteGlobalSuppression extends ApiKeyBase { + + private final String email; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/asm/suppressions/global/{email}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteGlobalSuppression creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (email != null) { + request.addPathParam("email", email.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteInvalidEmail.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteInvalidEmail.java new file mode 100644 index 00000000..b4d18ca5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteInvalidEmail.java @@ -0,0 +1,88 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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 lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteInvalidEmail extends ApiKeyBase { + + private final String email; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/suppression/invalid_emails/{email}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteInvalidEmail creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (email != null) { + request.addPathParam("email", email.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteInvalidEmails.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteInvalidEmails.java new file mode 100644 index 00000000..5d5102fc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteInvalidEmails.java @@ -0,0 +1,90 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.DeleteInvalidEmailsRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteInvalidEmails extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private DeleteInvalidEmailsRequest deleteInvalidEmailsRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/suppression/invalid_emails"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteInvalidEmails creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (deleteInvalidEmailsRequest != null) { + request.addBody(JsonUtil.toJson(deleteInvalidEmailsRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSpamReport.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSpamReport.java new file mode 100644 index 00000000..496066a9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSpamReport.java @@ -0,0 +1,88 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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 lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteSpamReport extends ApiKeyBase { + + private final String email; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/suppression/spam_reports/{email}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSpamReport creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (email != null) { + request.addPathParam("email", email.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSpamReports.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSpamReports.java new file mode 100644 index 00000000..291df4f1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSpamReports.java @@ -0,0 +1,90 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.DeleteSpamReportsRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteSpamReports extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private DeleteSpamReportsRequest deleteSpamReportsRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/suppression/spam_reports"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSpamReports creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (deleteSpamReportsRequest != null) { + request.addBody(JsonUtil.toJson(deleteSpamReportsRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSuppressionBlock.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSuppressionBlock.java new file mode 100644 index 00000000..1e0de626 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSuppressionBlock.java @@ -0,0 +1,88 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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 lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteSuppressionBlock extends ApiKeyBase { + + private final String email; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/suppression/blocks/{email}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSuppressionBlock creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (email != null) { + request.addPathParam("email", email.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSuppressionBlocks.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSuppressionBlocks.java new file mode 100644 index 00000000..3ffa08b8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSuppressionBlocks.java @@ -0,0 +1,90 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.DeleteSuppressionBlocksRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteSuppressionBlocks extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private DeleteSuppressionBlocksRequest deleteSuppressionBlocksRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/suppression/blocks"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSuppressionBlocks creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (deleteSuppressionBlocksRequest != null) { + request.addBody(JsonUtil.toJson(deleteSuppressionBlocksRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSuppressionBounce.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSuppressionBounce.java new file mode 100644 index 00000000..5a1d138c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSuppressionBounce.java @@ -0,0 +1,103 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteSuppressionBounce extends ApiKeyBase { + + private final String email; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/suppression/bounces/{email}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSuppressionBounce 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (email != null) { + request.addPathParam("email", email.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSuppressionBounces.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSuppressionBounces.java new file mode 100644 index 00000000..ce364a69 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSuppressionBounces.java @@ -0,0 +1,105 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.DeleteSuppressionBouncesRequest; +import com.sendgrid.rest.api.v3.suppressions.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteSuppressionBounces extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private DeleteSuppressionBouncesRequest deleteSuppressionBouncesRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/suppression/bounces"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSuppressionBounces 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), Object.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (deleteSuppressionBouncesRequest != null) { + request.addBody(JsonUtil.toJson(deleteSuppressionBouncesRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSuppressionFromAsmGroup.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSuppressionFromAsmGroup.java new file mode 100644 index 00000000..5a8ef68a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/DeleteSuppressionFromAsmGroup.java @@ -0,0 +1,92 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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 lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteSuppressionFromAsmGroup extends ApiKeyBase { + + private final String groupId; + private final String email; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/asm/groups/{group_id}/suppressions/{email}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteSuppressionFromAsmGroup creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (groupId != null) { + request.addPathParam("group_id", groupId.toString()); + } + if (email != null) { + request.addPathParam("email", email.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetAsmGroup.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetAsmGroup.java new file mode 100644 index 00000000..18b0a18f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetAsmGroup.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.GetAsmGroup200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetAsmGroup extends ApiKeyBase { + + private final String groupId; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/asm/groups/{group_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetAsmGroup creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + GetAsmGroup200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (groupId != null) { + request.addPathParam("group_id", groupId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetAsmSuppression.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetAsmSuppression.java new file mode 100644 index 00000000..0728d4ea --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetAsmSuppression.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.GetAsmSuppression200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetAsmSuppression extends ApiKeyBase { + + private final String email; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/asm/suppressions/{email}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetAsmSuppression creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + GetAsmSuppression200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (email != null) { + request.addPathParam("email", email.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetGlobalSuppression.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetGlobalSuppression.java new file mode 100644 index 00000000..e416c497 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetGlobalSuppression.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.RetrieveAGlobalSuppressionResponse; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetGlobalSuppression extends ApiKeyBase { + + private final String email; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/asm/suppressions/global/{email}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetGlobalSuppression creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + RetrieveAGlobalSuppressionResponse.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (email != null) { + request.addPathParam("email", email.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetInvalidEmail.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetInvalidEmail.java new file mode 100644 index 00000000..b35b423a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetInvalidEmail.java @@ -0,0 +1,90 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.InvalidEmail; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetInvalidEmail extends ApiKeyBase { + + private final String email; + + @Setter + private String onBehalfOf; + + public ApiResponse> send(final ApiKeyRestClient client) { + String path = "/v3/suppression/invalid_emails/{email}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetInvalidEmail creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (email != null) { + request.addPathParam("email", email.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetSpamReport.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetSpamReport.java new file mode 100644 index 00000000..d5f1e1e0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetSpamReport.java @@ -0,0 +1,92 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.SpamReportsResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetSpamReport extends ApiKeyBase { + + private final String email; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/suppression/spam_reports/{email}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetSpamReport creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (email != null) { + request.addPathParam("email", email.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetSuppressionBlock.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetSuppressionBlock.java new file mode 100644 index 00000000..99e3f577 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetSuppressionBlock.java @@ -0,0 +1,92 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.BlocksResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetSuppressionBlock extends ApiKeyBase { + + private final String email; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/suppression/blocks/{email}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetSuppressionBlock creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (email != null) { + request.addPathParam("email", email.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetSuppressionBounces.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetSuppressionBounces.java new file mode 100644 index 00000000..b3d178a2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetSuppressionBounces.java @@ -0,0 +1,92 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.BounceResponse; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetSuppressionBounces extends ApiKeyBase { + + private final String email; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/suppression/bounces/{email}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetSuppressionBounces creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (email != null) { + request.addPathParam("email", email.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetSuppressionBouncesClassifications.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetSuppressionBouncesClassifications.java new file mode 100644 index 00000000..d27543e0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/GetSuppressionBouncesClassifications.java @@ -0,0 +1,118 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.Accept1; +import com.sendgrid.rest.api.v3.suppressions.models.Classification1; +import com.sendgrid.rest.api.v3.suppressions.models.GetSuppressionBouncesClassifications200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetSuppressionBouncesClassifications extends ApiKeyBase { + + private final Classification1 classification; + + @Setter + private String startDate; + + @Setter + private String endDate; + + private final Accept1 accept; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = + "/v3/suppression/bounces/classifications/{classification}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetSuppressionBouncesClassifications creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + GetSuppressionBouncesClassifications200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (classification != null) { + request.addPathParam("classification", classification.toString()); + } + } + + private void addHeaderParams(Request request) { + if (accept != null) { + request.addHeaderParam("Accept", accept.toString()); + } + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (startDate != null) { + request.addQueryParam("start_date", startDate.toString()); + } + if (endDate != null) { + request.addQueryParam("end_date", endDate.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListAsmGroup.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListAsmGroup.java new file mode 100644 index 00000000..7187fc22 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListAsmGroup.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.SuppressionGroup; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListAsmGroup extends ApiKeyBase { + + @Setter + private Integer id; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/asm/groups"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListAsmGroup creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (id != null) { + request.addQueryParam("id", id.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListAsmSuppression.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListAsmSuppression.java new file mode 100644 index 00000000..6bc7baef --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListAsmSuppression.java @@ -0,0 +1,83 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.ListAsmSuppression200ResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListAsmSuppression extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/asm/suppressions"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListAsmSuppression creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListGlobalSuppression.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListGlobalSuppression.java new file mode 100644 index 00000000..69f3ac0f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListGlobalSuppression.java @@ -0,0 +1,117 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.ListGlobalSuppression200ResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListGlobalSuppression extends ApiKeyBase { + + @Setter + private Integer startTime; + + @Setter + private Integer endTime; + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private String email; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/suppression/unsubscribes"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListGlobalSuppression creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (startTime != null) { + request.addQueryParam("start_time", startTime.toString()); + } + if (endTime != null) { + request.addQueryParam("end_time", endTime.toString()); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (email != null) { + request.addQueryParam("email", email.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListInvalidEmail.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListInvalidEmail.java new file mode 100644 index 00000000..49c3a462 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListInvalidEmail.java @@ -0,0 +1,115 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.InvalidEmail; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListInvalidEmail extends ApiKeyBase { + + @Setter + private Integer startTime; + + @Setter + private Integer endTime; + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private String email; + + @Setter + private String onBehalfOf; + + public ApiResponse> send(final ApiKeyRestClient client) { + String path = "/v3/suppression/invalid_emails"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListInvalidEmail creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (startTime != null) { + request.addQueryParam("start_time", startTime.toString()); + } + if (endTime != null) { + request.addQueryParam("end_time", endTime.toString()); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (email != null) { + request.addQueryParam("email", email.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListSpamReport.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListSpamReport.java new file mode 100644 index 00000000..bbd58a6e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListSpamReport.java @@ -0,0 +1,117 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.SpamReportsResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSpamReport extends ApiKeyBase { + + @Setter + private Integer startTime; + + @Setter + private Integer endTime; + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private String email; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/suppression/spam_reports"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSpamReport creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (startTime != null) { + request.addQueryParam("start_time", startTime.toString()); + } + if (endTime != null) { + request.addQueryParam("end_time", endTime.toString()); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (email != null) { + request.addQueryParam("email", email.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListSuppressionBlock.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListSuppressionBlock.java new file mode 100644 index 00000000..363947c4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListSuppressionBlock.java @@ -0,0 +1,117 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.BlocksResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSuppressionBlock extends ApiKeyBase { + + @Setter + private Integer startTime; + + @Setter + private Integer endTime; + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private String email; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/suppression/blocks"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSuppressionBlock creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (startTime != null) { + request.addQueryParam("start_time", startTime.toString()); + } + if (endTime != null) { + request.addQueryParam("end_time", endTime.toString()); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (email != null) { + request.addQueryParam("email", email.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListSuppressionBounces.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListSuppressionBounces.java new file mode 100644 index 00000000..ec45bacc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListSuppressionBounces.java @@ -0,0 +1,137 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.BounceResponse; +import com.sendgrid.rest.api.v3.suppressions.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSuppressionBounces extends ApiKeyBase { + + @Setter + private Integer startTime; + + @Setter + private Integer endTime; + + @Setter + private Integer limit; + + @Setter + private Integer offset; + + @Setter + private String email; + + private final String accept; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/suppression/bounces"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSuppressionBounces 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (accept != null) { + request.addHeaderParam("Accept", accept.toString()); + } + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (startTime != null) { + request.addQueryParam("start_time", startTime.toString()); + } + if (endTime != null) { + request.addQueryParam("end_time", endTime.toString()); + } + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (email != null) { + request.addQueryParam("email", email.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListSuppressionBouncesClassifications.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListSuppressionBouncesClassifications.java new file mode 100644 index 00000000..5c0fb570 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListSuppressionBouncesClassifications.java @@ -0,0 +1,122 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.Accept; +import com.sendgrid.rest.api.v3.suppressions.models.ErrorResponse; +import com.sendgrid.rest.api.v3.suppressions.models.ListSuppressionBouncesClassifications200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSuppressionBouncesClassifications extends ApiKeyBase { + + @Setter + private String startDate; + + @Setter + private String endDate; + + private final Accept accept; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/suppression/bounces/classifications"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSuppressionBouncesClassifications 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), + ListSuppressionBouncesClassifications200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (accept != null) { + request.addHeaderParam("Accept", accept.toString()); + } + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (startDate != null) { + request.addQueryParam("start_date", startDate.toString()); + } + if (endDate != null) { + request.addQueryParam("end_date", endDate.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListSuppressionFromAsmGroup.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListSuppressionFromAsmGroup.java new file mode 100644 index 00000000..c52aadb9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/ListSuppressionFromAsmGroup.java @@ -0,0 +1,89 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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 java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSuppressionFromAsmGroup extends ApiKeyBase { + + private final String groupId; + + @Setter + private String onBehalfOf; + + public ApiResponse> send(final ApiKeyRestClient client) { + String path = "/v3/asm/groups/{group_id}/suppressions"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSuppressionFromAsmGroup creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (groupId != null) { + request.addPathParam("group_id", groupId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/SearchSuppressionFromAsmGroup.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/SearchSuppressionFromAsmGroup.java new file mode 100644 index 00000000..87a567ae --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/SearchSuppressionFromAsmGroup.java @@ -0,0 +1,100 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.SuppressionsRequest; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class SearchSuppressionFromAsmGroup extends ApiKeyBase { + + private final String groupId; + + @Setter + private String onBehalfOf; + + @Setter + private SuppressionsRequest suppressionsRequest; + + public ApiResponse> send(final ApiKeyRestClient client) { + String path = "/v3/asm/groups/{group_id}/suppressions/search"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "SearchSuppressionFromAsmGroup creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (groupId != null) { + request.addPathParam("group_id", groupId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (suppressionsRequest != null) { + request.addBody(JsonUtil.toJson(suppressionsRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/UpdateAsmGroup.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/UpdateAsmGroup.java new file mode 100644 index 00000000..315f91df --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/UpdateAsmGroup.java @@ -0,0 +1,100 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions; + +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.suppressions.models.SuppressionGroup; +import com.sendgrid.rest.api.v3.suppressions.models.UpdateAsmGroupRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateAsmGroup extends ApiKeyBase { + + private final String groupId; + + @Setter + private String onBehalfOf; + + @Setter + private UpdateAsmGroupRequest updateAsmGroupRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/asm/groups/{group_id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateAsmGroup creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), SuppressionGroup.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (groupId != null) { + request.addPathParam("group_id", groupId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateAsmGroupRequest != null) { + request.addBody(JsonUtil.toJson(updateAsmGroupRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/Accept.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/Accept.java new file mode 100644 index 00000000..3b2c51a9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/Accept.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Accept { + APPLICATION_JSON("application/json"), + + TEXT_CSV("text/csv"); + + private final String value; + + private Accept(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Accept forValue(final String value) { + return Promoter.enumFromString(value, Accept.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/Accept1.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/Accept1.java new file mode 100644 index 00000000..eee37b0f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/Accept1.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Accept1 { + APPLICATION_JSON("application/json"), + + TEXT_CSV("text/csv"); + + private final String value; + + private Accept1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Accept1 forValue(final String value) { + return Promoter.enumFromString(value, Accept1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/AddSuppressionToAsmGroup201Response.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/AddSuppressionToAsmGroup201Response.java new file mode 100644 index 00000000..e80a945d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/AddSuppressionToAsmGroup201Response.java @@ -0,0 +1,68 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class AddSuppressionToAsmGroup201Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("recipient_emails") + @Getter + @Setter + private List recipientEmails; + + public AddSuppressionToAsmGroup201Response() {} + + private AddSuppressionToAsmGroup201Response(Builder builder) { + this.recipientEmails = builder.recipientEmails; + } + + // Builder class for constructing object + public static class Builder { + + private List recipientEmails; + + public Builder() {} + + public Builder recipientEmails(List recipientEmails) { + this.recipientEmails = recipientEmails; + return this; + } + + public AddSuppressionToAsmGroup201Response build() { + return new AddSuppressionToAsmGroup201Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + AddSuppressionToAsmGroup201Response.class.getSimpleName() + "(", + ")" + ); + if (recipientEmails != null) joiner.add( + "recipientEmails=" + recipientEmails + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/BlocksResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/BlocksResponseInner.java new file mode 100644 index 00000000..a9146710 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/BlocksResponseInner.java @@ -0,0 +1,97 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class BlocksResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created") + @Getter + @Setter + private Integer created; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reason") + @Getter + @Setter + private String reason; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private String status; + + public BlocksResponseInner() {} + + private BlocksResponseInner(Builder builder) { + this.created = builder.created; + this.email = builder.email; + this.reason = builder.reason; + this.status = builder.status; + } + + // Builder class for constructing object + public static class Builder { + + private Integer created; + private String email; + private String reason; + private String status; + + public Builder( + Integer created, + String email, + String reason, + String status + ) { + this.created = created; + this.email = email; + this.reason = reason; + this.status = status; + } + + public BlocksResponseInner build() { + return new BlocksResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + BlocksResponseInner.class.getSimpleName() + "(", + ")" + ); + if (created != null) joiner.add("created=" + created); + if (email != null) joiner.add("email=" + email); + if (reason != null) joiner.add("reason=" + reason); + if (status != null) joiner.add("status=" + status); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/BounceResponse.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/BounceResponse.java new file mode 100644 index 00000000..e21b2549 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/BounceResponse.java @@ -0,0 +1,108 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class BounceResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created") + @Getter + @Setter + private BigDecimal created; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reason") + @Getter + @Setter + private String reason; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private String status; + + public BounceResponse() {} + + private BounceResponse(Builder builder) { + this.created = builder.created; + this.email = builder.email; + this.reason = builder.reason; + this.status = builder.status; + } + + // Builder class for constructing object + public static class Builder { + + private BigDecimal created; + private String email; + private String reason; + private String status; + + public Builder() {} + + public Builder created(BigDecimal created) { + this.created = created; + return this; + } + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder reason(String reason) { + this.reason = reason; + return this; + } + + public Builder status(String status) { + this.status = status; + return this; + } + + public BounceResponse build() { + return new BounceResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + BounceResponse.class.getSimpleName() + "(", + ")" + ); + if (created != null) joiner.add("created=" + created); + if (email != null) joiner.add("email=" + email); + if (reason != null) joiner.add("reason=" + reason); + if (status != null) joiner.add("status=" + status); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/Classification.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/Classification.java new file mode 100644 index 00000000..163dd5fb --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/Classification.java @@ -0,0 +1,52 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Classification { + CONTENT("Content"), + + FREQUENCY_OR_VOLUME_TOO_HIGH("Frequency or Volume Too High"), + + INVALID_ADDRESS("Invalid Address"), + + MAILBOX_UNAVAILABLE("Mailbox Unavailable"), + + REPUTATION("Reputation"), + + TECHNICAL_FAILURE("Technical Failure"), + + UNCLASSIFIED("Unclassified"); + + private final String value; + + private Classification(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Classification forValue(final String value) { + return Promoter.enumFromString(value, Classification.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/Classification1.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/Classification1.java new file mode 100644 index 00000000..8bb8fd05 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/Classification1.java @@ -0,0 +1,52 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Classification1 { + CONTENT("Content"), + + FREQUENCY_OR_VOLUME_TOO_HIGH("Frequency or Volume Too High"), + + INVALID_ADDRESS("Invalid Address"), + + MAILBOX_UNAVAILABLE("Mailbox Unavailable"), + + REPUTATION("Reputation"), + + TECHNICAL_FAILURE("Technical Failure"), + + UNCLASSIFIED("Unclassified"); + + private final String value; + + private Classification1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Classification1 forValue(final String value) { + return Promoter.enumFromString(value, Classification1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/CreatAsmGroup201Response.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/CreatAsmGroup201Response.java new file mode 100644 index 00000000..9792623a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/CreatAsmGroup201Response.java @@ -0,0 +1,97 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreatAsmGroup201Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + @Getter + @Setter + private String description; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_default") + @Getter + @Setter + private Boolean isDefault; + + public CreatAsmGroup201Response() {} + + private CreatAsmGroup201Response(Builder builder) { + this.id = builder.id; + this.name = builder.name; + this.description = builder.description; + this.isDefault = builder.isDefault; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private String name; + private String description; + private Boolean isDefault; + + public Builder( + Integer id, + String name, + String description, + Boolean isDefault + ) { + this.id = id; + this.name = name; + this.description = description; + this.isDefault = isDefault; + } + + public CreatAsmGroup201Response build() { + return new CreatAsmGroup201Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreatAsmGroup201Response.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (name != null) joiner.add("name=" + name); + if (description != null) joiner.add("description=" + description); + if (isDefault != null) joiner.add("isDefault=" + isDefault); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/CreateGlobalSuppression201Response.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/CreateGlobalSuppression201Response.java new file mode 100644 index 00000000..c1432702 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/CreateGlobalSuppression201Response.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateGlobalSuppression201Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("recipient_emails") + @Getter + @Setter + private List recipientEmails; + + public CreateGlobalSuppression201Response() {} + + private CreateGlobalSuppression201Response(Builder builder) { + this.recipientEmails = builder.recipientEmails; + } + + // Builder class for constructing object + public static class Builder { + + private List recipientEmails; + + public Builder(List recipientEmails) { + this.recipientEmails = recipientEmails; + } + + public CreateGlobalSuppression201Response build() { + return new CreateGlobalSuppression201Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateGlobalSuppression201Response.class.getSimpleName() + "(", + ")" + ); + if (recipientEmails != null) joiner.add( + "recipientEmails=" + recipientEmails + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/DeleteInvalidEmailsRequest.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/DeleteInvalidEmailsRequest.java new file mode 100644 index 00000000..505f957a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/DeleteInvalidEmailsRequest.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteInvalidEmailsRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("delete_all") + @Getter + @Setter + private Boolean deleteAll; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("emails") + @Getter + @Setter + private List emails; + + public DeleteInvalidEmailsRequest() {} + + private DeleteInvalidEmailsRequest(Builder builder) { + this.deleteAll = builder.deleteAll; + this.emails = builder.emails; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean deleteAll; + private List emails; + + public Builder() {} + + public Builder deleteAll(Boolean deleteAll) { + this.deleteAll = deleteAll; + return this; + } + + public Builder emails(List emails) { + this.emails = emails; + return this; + } + + public DeleteInvalidEmailsRequest build() { + return new DeleteInvalidEmailsRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteInvalidEmailsRequest.class.getSimpleName() + "(", + ")" + ); + if (deleteAll != null) joiner.add("deleteAll=" + deleteAll); + if (emails != null) joiner.add("emails=" + emails); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/DeleteSpamReportsRequest.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/DeleteSpamReportsRequest.java new file mode 100644 index 00000000..687abaf6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/DeleteSpamReportsRequest.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteSpamReportsRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("delete_all") + @Getter + @Setter + private Boolean deleteAll; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("emails") + @Getter + @Setter + private List emails; + + public DeleteSpamReportsRequest() {} + + private DeleteSpamReportsRequest(Builder builder) { + this.deleteAll = builder.deleteAll; + this.emails = builder.emails; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean deleteAll; + private List emails; + + public Builder() {} + + public Builder deleteAll(Boolean deleteAll) { + this.deleteAll = deleteAll; + return this; + } + + public Builder emails(List emails) { + this.emails = emails; + return this; + } + + public DeleteSpamReportsRequest build() { + return new DeleteSpamReportsRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteSpamReportsRequest.class.getSimpleName() + "(", + ")" + ); + if (deleteAll != null) joiner.add("deleteAll=" + deleteAll); + if (emails != null) joiner.add("emails=" + emails); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/DeleteSuppressionBlocksRequest.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/DeleteSuppressionBlocksRequest.java new file mode 100644 index 00000000..860a834c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/DeleteSuppressionBlocksRequest.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteSuppressionBlocksRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("delete_all") + @Getter + @Setter + private Boolean deleteAll; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("emails") + @Getter + @Setter + private List emails; + + public DeleteSuppressionBlocksRequest() {} + + private DeleteSuppressionBlocksRequest(Builder builder) { + this.deleteAll = builder.deleteAll; + this.emails = builder.emails; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean deleteAll; + private List emails; + + public Builder() {} + + public Builder deleteAll(Boolean deleteAll) { + this.deleteAll = deleteAll; + return this; + } + + public Builder emails(List emails) { + this.emails = emails; + return this; + } + + public DeleteSuppressionBlocksRequest build() { + return new DeleteSuppressionBlocksRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteSuppressionBlocksRequest.class.getSimpleName() + "(", + ")" + ); + if (deleteAll != null) joiner.add("deleteAll=" + deleteAll); + if (emails != null) joiner.add("emails=" + emails); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/DeleteSuppressionBouncesRequest.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/DeleteSuppressionBouncesRequest.java new file mode 100644 index 00000000..b1fc290d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/DeleteSuppressionBouncesRequest.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteSuppressionBouncesRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("delete_all") + @Getter + @Setter + private Boolean deleteAll; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("emails") + @Getter + @Setter + private List emails; + + public DeleteSuppressionBouncesRequest() {} + + private DeleteSuppressionBouncesRequest(Builder builder) { + this.deleteAll = builder.deleteAll; + this.emails = builder.emails; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean deleteAll; + private List emails; + + public Builder() {} + + public Builder deleteAll(Boolean deleteAll) { + this.deleteAll = deleteAll; + return this; + } + + public Builder emails(List emails) { + this.emails = emails; + return this; + } + + public DeleteSuppressionBouncesRequest build() { + return new DeleteSuppressionBouncesRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteSuppressionBouncesRequest.class.getSimpleName() + "(", + ")" + ); + if (deleteAll != null) joiner.add("deleteAll=" + deleteAll); + if (emails != null) joiner.add("emails=" + emails); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ErrorResponse.java new file mode 100644 index 00000000..b59e65e7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.suppressions.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..945bd530 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetAsmGroup200Response.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetAsmGroup200Response.java new file mode 100644 index 00000000..2d564b02 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetAsmGroup200Response.java @@ -0,0 +1,134 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetAsmGroup200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + @Getter + @Setter + private String description; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_default") + @Getter + @Setter + private Boolean isDefault; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unsubscribes") + @Getter + @Setter + private Integer unsubscribes; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_email_sent_at") + @Getter + @Setter + private String lastEmailSentAt; + + public GetAsmGroup200Response() {} + + private GetAsmGroup200Response(Builder builder) { + this.name = builder.name; + this.description = builder.description; + this.isDefault = builder.isDefault; + this.id = builder.id; + this.unsubscribes = builder.unsubscribes; + this.lastEmailSentAt = builder.lastEmailSentAt; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private String description; + private Boolean isDefault; + private Integer id; + private Integer unsubscribes; + private String lastEmailSentAt; + + public Builder(Integer id) { + this.id = id; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public Builder isDefault(Boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + public Builder unsubscribes(Integer unsubscribes) { + this.unsubscribes = unsubscribes; + return this; + } + + public Builder lastEmailSentAt(String lastEmailSentAt) { + this.lastEmailSentAt = lastEmailSentAt; + return this; + } + + public GetAsmGroup200Response build() { + return new GetAsmGroup200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetAsmGroup200Response.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (description != null) joiner.add("description=" + description); + if (isDefault != null) joiner.add("isDefault=" + isDefault); + if (id != null) joiner.add("id=" + id); + if (unsubscribes != null) joiner.add("unsubscribes=" + unsubscribes); + if (lastEmailSentAt != null) joiner.add( + "lastEmailSentAt=" + lastEmailSentAt + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetAsmSuppression200Response.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetAsmSuppression200Response.java new file mode 100644 index 00000000..3435df61 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetAsmSuppression200Response.java @@ -0,0 +1,68 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.suppressions.models.GetAsmSuppression200ResponseSuppressionsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetAsmSuppression200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("suppressions") + @Getter + @Setter + private List suppressions; + + public GetAsmSuppression200Response() {} + + private GetAsmSuppression200Response(Builder builder) { + this.suppressions = builder.suppressions; + } + + // Builder class for constructing object + public static class Builder { + + private List< + GetAsmSuppression200ResponseSuppressionsInner + > suppressions; + + public Builder( + List suppressions + ) { + this.suppressions = suppressions; + } + + public GetAsmSuppression200Response build() { + return new GetAsmSuppression200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetAsmSuppression200Response.class.getSimpleName() + "(", + ")" + ); + if (suppressions != null) joiner.add("suppressions=" + suppressions); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetAsmSuppression200ResponseSuppressionsInner.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetAsmSuppression200ResponseSuppressionsInner.java new file mode 100644 index 00000000..49ccb9fa --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetAsmSuppression200ResponseSuppressionsInner.java @@ -0,0 +1,109 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetAsmSuppression200ResponseSuppressionsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + @Getter + @Setter + private String description; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_default") + @Getter + @Setter + private Boolean isDefault; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("suppressed") + @Getter + @Setter + private Boolean suppressed; + + public GetAsmSuppression200ResponseSuppressionsInner() {} + + private GetAsmSuppression200ResponseSuppressionsInner(Builder builder) { + this.description = builder.description; + this.id = builder.id; + this.isDefault = builder.isDefault; + this.name = builder.name; + this.suppressed = builder.suppressed; + } + + // Builder class for constructing object + public static class Builder { + + private String description; + private Integer id; + private Boolean isDefault; + private String name; + private Boolean suppressed; + + public Builder( + String description, + Integer id, + Boolean isDefault, + String name, + Boolean suppressed + ) { + this.description = description; + this.id = id; + this.isDefault = isDefault; + this.name = name; + this.suppressed = suppressed; + } + + public GetAsmSuppression200ResponseSuppressionsInner build() { + return new GetAsmSuppression200ResponseSuppressionsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetAsmSuppression200ResponseSuppressionsInner.class.getSimpleName() + + "(", + ")" + ); + if (description != null) joiner.add("description=" + description); + if (id != null) joiner.add("id=" + id); + if (isDefault != null) joiner.add("isDefault=" + isDefault); + if (name != null) joiner.add("name=" + name); + if (suppressed != null) joiner.add("suppressed=" + suppressed); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetSuppressionBouncesClassifications200Response.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetSuppressionBouncesClassifications200Response.java new file mode 100644 index 00000000..43e22417 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetSuppressionBouncesClassifications200Response.java @@ -0,0 +1,76 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.suppressions.models.GetSuppressionBouncesClassifications200ResponseResultInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetSuppressionBouncesClassifications200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List< + GetSuppressionBouncesClassifications200ResponseResultInner + > result; + + public GetSuppressionBouncesClassifications200Response() {} + + private GetSuppressionBouncesClassifications200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private List< + GetSuppressionBouncesClassifications200ResponseResultInner + > result; + + public Builder() {} + + public Builder result( + List< + GetSuppressionBouncesClassifications200ResponseResultInner + > result + ) { + this.result = result; + return this; + } + + public GetSuppressionBouncesClassifications200Response build() { + return new GetSuppressionBouncesClassifications200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetSuppressionBouncesClassifications200Response.class.getSimpleName() + + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetSuppressionBouncesClassifications200ResponseResultInner.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetSuppressionBouncesClassifications200ResponseResultInner.java new file mode 100644 index 00000000..036a3dcc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetSuppressionBouncesClassifications200ResponseResultInner.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.suppressions.models.GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetSuppressionBouncesClassifications200ResponseResultInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("date") + @Getter + @Setter + private String date; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("stats") + @Getter + @Setter + private List< + GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner + > stats; + + public GetSuppressionBouncesClassifications200ResponseResultInner() {} + + private GetSuppressionBouncesClassifications200ResponseResultInner( + Builder builder + ) { + this.date = builder.date; + this.stats = builder.stats; + } + + // Builder class for constructing object + public static class Builder { + + private String date; + private List< + GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner + > stats; + + public Builder() {} + + public Builder date(String date) { + this.date = date; + return this; + } + + public Builder stats( + List< + GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner + > stats + ) { + this.stats = stats; + return this; + } + + public GetSuppressionBouncesClassifications200ResponseResultInner build() { + return new GetSuppressionBouncesClassifications200ResponseResultInner( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetSuppressionBouncesClassifications200ResponseResultInner.class.getSimpleName() + + "(", + ")" + ); + if (date != null) joiner.add("date=" + date); + if (stats != null) joiner.add("stats=" + stats); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner.java new file mode 100644 index 00000000..dc127088 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner.java @@ -0,0 +1,84 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("domain") + @Getter + @Setter + private String domain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("count") + @Getter + @Setter + private Integer count; + + public GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner() {} + + private GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner( + Builder builder + ) { + this.domain = builder.domain; + this.count = builder.count; + } + + // Builder class for constructing object + public static class Builder { + + private String domain; + private Integer count; + + public Builder() {} + + public Builder domain(String domain) { + this.domain = domain; + return this; + } + + public Builder count(Integer count) { + this.count = count; + return this; + } + + public GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner build() { + return new GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner.class.getSimpleName() + + "(", + ")" + ); + if (domain != null) joiner.add("domain=" + domain); + if (count != null) joiner.add("count=" + count); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/InvalidEmail.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/InvalidEmail.java new file mode 100644 index 00000000..d6c8dfc6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/InvalidEmail.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class InvalidEmail { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created") + @Getter + @Setter + private Integer created; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reason") + @Getter + @Setter + private String reason; + + public InvalidEmail() {} + + private InvalidEmail(Builder builder) { + this.created = builder.created; + this.email = builder.email; + this.reason = builder.reason; + } + + // Builder class for constructing object + public static class Builder { + + private Integer created; + private String email; + private String reason; + + public Builder() {} + + public Builder created(Integer created) { + this.created = created; + return this; + } + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder reason(String reason) { + this.reason = reason; + return this; + } + + public InvalidEmail build() { + return new InvalidEmail(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + InvalidEmail.class.getSimpleName() + "(", + ")" + ); + if (created != null) joiner.add("created=" + created); + if (email != null) joiner.add("email=" + email); + if (reason != null) joiner.add("reason=" + reason); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ListAsmSuppression200ResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ListAsmSuppression200ResponseInner.java new file mode 100644 index 00000000..24fdaf84 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ListAsmSuppression200ResponseInner.java @@ -0,0 +1,97 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListAsmSuppression200ResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("group_id") + @Getter + @Setter + private Integer groupId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("group_name") + @Getter + @Setter + private String groupName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_at") + @Getter + @Setter + private Integer createdAt; + + public ListAsmSuppression200ResponseInner() {} + + private ListAsmSuppression200ResponseInner(Builder builder) { + this.email = builder.email; + this.groupId = builder.groupId; + this.groupName = builder.groupName; + this.createdAt = builder.createdAt; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + private Integer groupId; + private String groupName; + private Integer createdAt; + + public Builder( + String email, + Integer groupId, + String groupName, + Integer createdAt + ) { + this.email = email; + this.groupId = groupId; + this.groupName = groupName; + this.createdAt = createdAt; + } + + public ListAsmSuppression200ResponseInner build() { + return new ListAsmSuppression200ResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListAsmSuppression200ResponseInner.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + if (groupId != null) joiner.add("groupId=" + groupId); + if (groupName != null) joiner.add("groupName=" + groupName); + if (createdAt != null) joiner.add("createdAt=" + createdAt); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ListGlobalSuppression200ResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ListGlobalSuppression200ResponseInner.java new file mode 100644 index 00000000..11bd59b9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ListGlobalSuppression200ResponseInner.java @@ -0,0 +1,72 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListGlobalSuppression200ResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created") + @Getter + @Setter + private Integer created; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + public ListGlobalSuppression200ResponseInner() {} + + private ListGlobalSuppression200ResponseInner(Builder builder) { + this.created = builder.created; + this.email = builder.email; + } + + // Builder class for constructing object + public static class Builder { + + private Integer created; + private String email; + + public Builder(Integer created, String email) { + this.created = created; + this.email = email; + } + + public ListGlobalSuppression200ResponseInner build() { + return new ListGlobalSuppression200ResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListGlobalSuppression200ResponseInner.class.getSimpleName() + "(", + ")" + ); + if (created != null) joiner.add("created=" + created); + if (email != null) joiner.add("email=" + email); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ListSuppressionBouncesClassifications200Response.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ListSuppressionBouncesClassifications200Response.java new file mode 100644 index 00000000..c105415a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ListSuppressionBouncesClassifications200Response.java @@ -0,0 +1,76 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.suppressions.models.ListSuppressionBouncesClassifications200ResponseResultInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListSuppressionBouncesClassifications200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List< + ListSuppressionBouncesClassifications200ResponseResultInner + > result; + + public ListSuppressionBouncesClassifications200Response() {} + + private ListSuppressionBouncesClassifications200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private List< + ListSuppressionBouncesClassifications200ResponseResultInner + > result; + + public Builder() {} + + public Builder result( + List< + ListSuppressionBouncesClassifications200ResponseResultInner + > result + ) { + this.result = result; + return this; + } + + public ListSuppressionBouncesClassifications200Response build() { + return new ListSuppressionBouncesClassifications200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListSuppressionBouncesClassifications200Response.class.getSimpleName() + + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ListSuppressionBouncesClassifications200ResponseResultInner.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ListSuppressionBouncesClassifications200ResponseResultInner.java new file mode 100644 index 00000000..7c65f842 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ListSuppressionBouncesClassifications200ResponseResultInner.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.suppressions.models.ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListSuppressionBouncesClassifications200ResponseResultInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("date") + @Getter + @Setter + private String date; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("stats") + @Getter + @Setter + private List< + ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner + > stats; + + public ListSuppressionBouncesClassifications200ResponseResultInner() {} + + private ListSuppressionBouncesClassifications200ResponseResultInner( + Builder builder + ) { + this.date = builder.date; + this.stats = builder.stats; + } + + // Builder class for constructing object + public static class Builder { + + private String date; + private List< + ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner + > stats; + + public Builder() {} + + public Builder date(String date) { + this.date = date; + return this; + } + + public Builder stats( + List< + ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner + > stats + ) { + this.stats = stats; + return this; + } + + public ListSuppressionBouncesClassifications200ResponseResultInner build() { + return new ListSuppressionBouncesClassifications200ResponseResultInner( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListSuppressionBouncesClassifications200ResponseResultInner.class.getSimpleName() + + "(", + ")" + ); + if (date != null) joiner.add("date=" + date); + if (stats != null) joiner.add("stats=" + stats); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner.java new file mode 100644 index 00000000..07c31038 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner.java @@ -0,0 +1,87 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.suppressions.models.Classification; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("classification") + @Getter + @Setter + private Classification classification; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("count") + @Getter + @Setter + private Integer count; + + public ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner() {} + + private ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner( + Builder builder + ) { + this.classification = builder.classification; + this.count = builder.count; + } + + // Builder class for constructing object + public static class Builder { + + private Classification classification; + private Integer count; + + public Builder() {} + + public Builder classification(Classification classification) { + this.classification = classification; + return this; + } + + public Builder count(Integer count) { + this.count = count; + return this; + } + + public ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner build() { + return new ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner( + this + ); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner.class.getSimpleName() + + "(", + ")" + ); + if (classification != null) joiner.add( + "classification=" + classification + ); + if (count != null) joiner.add("count=" + count); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/RetrieveAGlobalSuppressionResponse.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/RetrieveAGlobalSuppressionResponse.java new file mode 100644 index 00000000..1ca0ba74 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/RetrieveAGlobalSuppressionResponse.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class RetrieveAGlobalSuppressionResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("recipient_email") + @Getter + @Setter + private String recipientEmail; + + public RetrieveAGlobalSuppressionResponse() {} + + private RetrieveAGlobalSuppressionResponse(Builder builder) { + this.recipientEmail = builder.recipientEmail; + } + + // Builder class for constructing object + public static class Builder { + + private String recipientEmail; + + public Builder(String recipientEmail) { + this.recipientEmail = recipientEmail; + } + + public RetrieveAGlobalSuppressionResponse build() { + return new RetrieveAGlobalSuppressionResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + RetrieveAGlobalSuppressionResponse.class.getSimpleName() + "(", + ")" + ); + if (recipientEmail != null) joiner.add( + "recipientEmail=" + recipientEmail + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/SpamReportsResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/SpamReportsResponseInner.java new file mode 100644 index 00000000..86782fe6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/SpamReportsResponseInner.java @@ -0,0 +1,82 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SpamReportsResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created") + @Getter + @Setter + private Integer created; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ip") + @Getter + @Setter + private String ip; + + public SpamReportsResponseInner() {} + + private SpamReportsResponseInner(Builder builder) { + this.created = builder.created; + this.email = builder.email; + this.ip = builder.ip; + } + + // Builder class for constructing object + public static class Builder { + + private Integer created; + private String email; + private String ip; + + public Builder(Integer created, String email, String ip) { + this.created = created; + this.email = email; + this.ip = ip; + } + + public SpamReportsResponseInner build() { + return new SpamReportsResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SpamReportsResponseInner.class.getSimpleName() + "(", + ")" + ); + if (created != null) joiner.add("created=" + created); + if (email != null) joiner.add("email=" + email); + if (ip != null) joiner.add("ip=" + ip); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/SuppressionGroup.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/SuppressionGroup.java new file mode 100644 index 00000000..405a4fe3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/SuppressionGroup.java @@ -0,0 +1,127 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SuppressionGroup { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private BigDecimal id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + @Getter + @Setter + private String description; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_email_sent_at") + @Getter + @Setter + private Integer lastEmailSentAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_default") + @Getter + @Setter + private Boolean isDefault; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unsubscribes") + @Getter + @Setter + private Integer unsubscribes; + + public SuppressionGroup() {} + + private SuppressionGroup(Builder builder) { + this.id = builder.id; + this.name = builder.name; + this.description = builder.description; + this.lastEmailSentAt = builder.lastEmailSentAt; + this.isDefault = builder.isDefault; + this.unsubscribes = builder.unsubscribes; + } + + // Builder class for constructing object + public static class Builder { + + private BigDecimal id; + private String name; + private String description; + private Integer lastEmailSentAt; + private Boolean isDefault; + private Integer unsubscribes; + + public Builder(BigDecimal id, String name, String description) { + this.id = id; + this.name = name; + this.description = description; + } + + public Builder lastEmailSentAt(Integer lastEmailSentAt) { + this.lastEmailSentAt = lastEmailSentAt; + return this; + } + + public Builder isDefault(Boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + public Builder unsubscribes(Integer unsubscribes) { + this.unsubscribes = unsubscribes; + return this; + } + + public SuppressionGroup build() { + return new SuppressionGroup(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SuppressionGroup.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (name != null) joiner.add("name=" + name); + if (description != null) joiner.add("description=" + description); + if (lastEmailSentAt != null) joiner.add( + "lastEmailSentAt=" + lastEmailSentAt + ); + if (isDefault != null) joiner.add("isDefault=" + isDefault); + if (unsubscribes != null) joiner.add("unsubscribes=" + unsubscribes); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/SuppressionGroupRequestBaseProps.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/SuppressionGroupRequestBaseProps.java new file mode 100644 index 00000000..d7fb05d5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/SuppressionGroupRequestBaseProps.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SuppressionGroupRequestBaseProps { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + @Getter + @Setter + private String description; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_default") + @Getter + @Setter + private Boolean isDefault; + + public SuppressionGroupRequestBaseProps() {} + + private SuppressionGroupRequestBaseProps(Builder builder) { + this.name = builder.name; + this.description = builder.description; + this.isDefault = builder.isDefault; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private String description; + private Boolean isDefault; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public Builder isDefault(Boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + public SuppressionGroupRequestBaseProps build() { + return new SuppressionGroupRequestBaseProps(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SuppressionGroupRequestBaseProps.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (description != null) joiner.add("description=" + description); + if (isDefault != null) joiner.add("isDefault=" + isDefault); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/SuppressionsRequest.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/SuppressionsRequest.java new file mode 100644 index 00000000..06bfe944 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/SuppressionsRequest.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SuppressionsRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("recipient_emails") + @Getter + @Setter + private List recipientEmails; + + public SuppressionsRequest() {} + + private SuppressionsRequest(Builder builder) { + this.recipientEmails = builder.recipientEmails; + } + + // Builder class for constructing object + public static class Builder { + + private List recipientEmails; + + public Builder(List recipientEmails) { + this.recipientEmails = recipientEmails; + } + + public SuppressionsRequest build() { + return new SuppressionsRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SuppressionsRequest.class.getSimpleName() + "(", + ")" + ); + if (recipientEmails != null) joiner.add( + "recipientEmails=" + recipientEmails + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/UpdateAsmGroupRequest.java b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/UpdateAsmGroupRequest.java new file mode 100644 index 00000000..ecc4f1f1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/suppressions/models/UpdateAsmGroupRequest.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Suppressions API + * The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + * + * 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.suppressions.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateAsmGroupRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + @Getter + @Setter + private String description; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_default") + @Getter + @Setter + private Boolean isDefault; + + public UpdateAsmGroupRequest() {} + + private UpdateAsmGroupRequest(Builder builder) { + this.name = builder.name; + this.description = builder.description; + this.isDefault = builder.isDefault; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private String description; + private Boolean isDefault; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public Builder isDefault(Boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + public UpdateAsmGroupRequest build() { + return new UpdateAsmGroupRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateAsmGroupRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (description != null) joiner.add("description=" + description); + if (isDefault != null) joiner.add("isDefault=" + isDefault); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/ActivateTemplateVersion.java b/src/main/java/com/sendgrid/rest/api/v3/templates/ActivateTemplateVersion.java new file mode 100644 index 00000000..9fa68868 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/ActivateTemplateVersion.java @@ -0,0 +1,100 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates; + +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.templates.models.TransactionalTemplateVersionOutput; +import com.sendgrid.util.JsonUtil; +import java.util.UUID; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ActivateTemplateVersion extends ApiKeyBase { + + private final UUID templateId; + private final UUID versionId; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = + "/v3/templates/{template_id}/versions/{version_id}/activate"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ActivateTemplateVersion creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + TransactionalTemplateVersionOutput.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (templateId != null) { + request.addPathParam("template_id", templateId.toString()); + } + if (versionId != null) { + request.addPathParam("version_id", versionId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/CreateTemplate.java b/src/main/java/com/sendgrid/rest/api/v3/templates/CreateTemplate.java new file mode 100644 index 00000000..25832c55 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/CreateTemplate.java @@ -0,0 +1,96 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates; + +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.templates.models.CreateTemplateRequest; +import com.sendgrid.rest.api.v3.templates.models.TransactionalTemplate; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateTemplate extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private CreateTemplateRequest createTemplateRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/templates"; + 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( + "CreateTemplate creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + TransactionalTemplate.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (createTemplateRequest != null) { + request.addBody(JsonUtil.toJson(createTemplateRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/CreateTemplateVersion.java b/src/main/java/com/sendgrid/rest/api/v3/templates/CreateTemplateVersion.java new file mode 100644 index 00000000..d11fe5b0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/CreateTemplateVersion.java @@ -0,0 +1,108 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates; + +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.templates.models.TransactionalTemplateVersionCreate; +import com.sendgrid.rest.api.v3.templates.models.TransactionalTemplateVersionOutput; +import com.sendgrid.util.JsonUtil; +import java.util.UUID; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateTemplateVersion extends ApiKeyBase { + + private final UUID templateId; + + @Setter + private String onBehalfOf; + + @Setter + private TransactionalTemplateVersionCreate transactionalTemplateVersionCreate; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/templates/{template_id}/versions"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "CreateTemplateVersion creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + TransactionalTemplateVersionOutput.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (templateId != null) { + request.addPathParam("template_id", templateId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (transactionalTemplateVersionCreate != null) { + request.addBody( + JsonUtil.toJson(transactionalTemplateVersionCreate) + ); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/DeleteTemplate.java b/src/main/java/com/sendgrid/rest/api/v3/templates/DeleteTemplate.java new file mode 100644 index 00000000..bc929605 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/DeleteTemplate.java @@ -0,0 +1,88 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates; + +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 lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteTemplate extends ApiKeyBase { + + private final String templateId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/templates/{template_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteTemplate creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (templateId != null) { + request.addPathParam("template_id", templateId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/DeleteTemplateVersion.java b/src/main/java/com/sendgrid/rest/api/v3/templates/DeleteTemplateVersion.java new file mode 100644 index 00000000..6af11fb7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/DeleteTemplateVersion.java @@ -0,0 +1,89 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates; + +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 java.util.UUID; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteTemplateVersion extends ApiKeyBase { + + private final UUID templateId; + private final UUID versionId; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/templates/{template_id}/versions/{version_id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteTemplateVersion creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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 (templateId != null) { + request.addPathParam("template_id", templateId.toString()); + } + if (versionId != null) { + request.addPathParam("version_id", versionId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/DuplicateTemplate.java b/src/main/java/com/sendgrid/rest/api/v3/templates/DuplicateTemplate.java new file mode 100644 index 00000000..9473b034 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/DuplicateTemplate.java @@ -0,0 +1,105 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates; + +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.templates.models.DuplicateTemplateRequest; +import com.sendgrid.rest.api.v3.templates.models.TransactionalTemplate; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DuplicateTemplate extends ApiKeyBase { + + private final String templateId; + + @Setter + private String onBehalfOf; + + @Setter + private DuplicateTemplateRequest duplicateTemplateRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/templates/{template_id}"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DuplicateTemplate creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + TransactionalTemplate.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (templateId != null) { + request.addPathParam("template_id", templateId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (duplicateTemplateRequest != null) { + request.addBody(JsonUtil.toJson(duplicateTemplateRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/GetTemplate.java b/src/main/java/com/sendgrid/rest/api/v3/templates/GetTemplate.java new file mode 100644 index 00000000..dab3a4f0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/GetTemplate.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates; + +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.templates.models.TransactionalTemplate; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetTemplate extends ApiKeyBase { + + private final String templateId; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/templates/{template_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetTemplate creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + TransactionalTemplate.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (templateId != null) { + request.addPathParam("template_id", templateId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/GetTemplateVersion.java b/src/main/java/com/sendgrid/rest/api/v3/templates/GetTemplateVersion.java new file mode 100644 index 00000000..0688c4ed --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/GetTemplateVersion.java @@ -0,0 +1,99 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates; + +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.templates.models.TransactionalTemplateVersionOutput; +import com.sendgrid.util.JsonUtil; +import java.util.UUID; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetTemplateVersion extends ApiKeyBase { + + private final UUID templateId; + private final UUID versionId; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/templates/{template_id}/versions/{version_id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetTemplateVersion creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + TransactionalTemplateVersionOutput.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (templateId != null) { + request.addPathParam("template_id", templateId.toString()); + } + if (versionId != null) { + request.addPathParam("version_id", versionId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/ListTemplate.java b/src/main/java/com/sendgrid/rest/api/v3/templates/ListTemplate.java new file mode 100644 index 00000000..6e8d3564 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/ListTemplate.java @@ -0,0 +1,123 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates; + +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.templates.models.Generations; +import com.sendgrid.rest.api.v3.templates.models.ListTemplate200Response; +import com.sendgrid.rest.api.v3.templates.models.ListTemplate400Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.math.BigDecimal; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListTemplate extends ApiKeyBase { + + @Setter + private Generations generations; + + private final BigDecimal pageSize; + + @Setter + private String pageToken; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/templates"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListTemplate 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")) { + ListTemplate400Response error = JsonUtil.fromJson( + response.getStream(), + ListTemplate400Response.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(), + ListTemplate200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (generations != null) { + request.addQueryParam("generations", generations.toString()); + } + if (pageSize != null) { + request.addQueryParam("page_size", pageSize.toString()); + } + if (pageToken != null) { + request.addQueryParam("page_token", pageToken.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/UpdateTemplate.java b/src/main/java/com/sendgrid/rest/api/v3/templates/UpdateTemplate.java new file mode 100644 index 00000000..12359326 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/UpdateTemplate.java @@ -0,0 +1,105 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates; + +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.templates.models.TransactionalTemplate; +import com.sendgrid.rest.api.v3.templates.models.UpdateTemplateRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateTemplate extends ApiKeyBase { + + private final String templateId; + + @Setter + private String onBehalfOf; + + @Setter + private UpdateTemplateRequest updateTemplateRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/templates/{template_id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateTemplate creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + TransactionalTemplate.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (templateId != null) { + request.addPathParam("template_id", templateId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateTemplateRequest != null) { + request.addBody(JsonUtil.toJson(updateTemplateRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/UpdateTemplateVersion.java b/src/main/java/com/sendgrid/rest/api/v3/templates/UpdateTemplateVersion.java new file mode 100644 index 00000000..bb6da3d4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/UpdateTemplateVersion.java @@ -0,0 +1,112 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates; + +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.templates.models.TransactionalTemplateVersionCreate; +import com.sendgrid.rest.api.v3.templates.models.TransactionalTemplateVersionOutput; +import com.sendgrid.util.JsonUtil; +import java.util.UUID; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateTemplateVersion extends ApiKeyBase { + + private final UUID templateId; + private final UUID versionId; + + @Setter + private String onBehalfOf; + + @Setter + private TransactionalTemplateVersionCreate transactionalTemplateVersionCreate; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/templates/{template_id}/versions/{version_id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateTemplateVersion creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + TransactionalTemplateVersionOutput.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (templateId != null) { + request.addPathParam("template_id", templateId.toString()); + } + if (versionId != null) { + request.addPathParam("version_id", versionId.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (transactionalTemplateVersionCreate != null) { + request.addBody( + JsonUtil.toJson(transactionalTemplateVersionCreate) + ); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/Active.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/Active.java new file mode 100644 index 00000000..62d05f3a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/Active.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Active { + _0("0"), + + _1("1"); + + private final String value; + + private Active(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Active forValue(final String value) { + return Promoter.enumFromString(value, Active.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/Active1.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/Active1.java new file mode 100644 index 00000000..e973e4cc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/Active1.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Active1 { + _0("0"), + + _1("1"); + + private final String value; + + private Active1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Active1 forValue(final String value) { + return Promoter.enumFromString(value, Active1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/CreateTemplateRequest.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/CreateTemplateRequest.java new file mode 100644 index 00000000..3f1ebbfc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/CreateTemplateRequest.java @@ -0,0 +1,77 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.templates.models.Generation; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateTemplateRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("generation") + @Getter + @Setter + private Generation generation; + + public CreateTemplateRequest() {} + + private CreateTemplateRequest(Builder builder) { + this.name = builder.name; + this.generation = builder.generation; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private Generation generation; + + public Builder(String name) { + this.name = name; + } + + public Builder generation(Generation generation) { + this.generation = generation; + return this; + } + + public CreateTemplateRequest build() { + return new CreateTemplateRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateTemplateRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (generation != null) joiner.add("generation=" + generation); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/DuplicateTemplateRequest.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/DuplicateTemplateRequest.java new file mode 100644 index 00000000..24b8d458 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/DuplicateTemplateRequest.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DuplicateTemplateRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public DuplicateTemplateRequest() {} + + private DuplicateTemplateRequest(Builder builder) { + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public DuplicateTemplateRequest build() { + return new DuplicateTemplateRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DuplicateTemplateRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/Editor.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/Editor.java new file mode 100644 index 00000000..bbf77d50 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/Editor.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Editor { + CODE("code"), + + DESIGN("design"); + + private final String value; + + private Editor(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Editor forValue(final String value) { + return Promoter.enumFromString(value, Editor.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/Editor1.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/Editor1.java new file mode 100644 index 00000000..253a09f7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/Editor1.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Editor1 { + CODE("code"), + + DESIGN("design"); + + private final String value; + + private Editor1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Editor1 forValue(final String value) { + return Promoter.enumFromString(value, Editor1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/Generation.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/Generation.java new file mode 100644 index 00000000..3096a629 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/Generation.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Generation { + LEGACY("legacy"), + + DYNAMIC("dynamic"); + + private final String value; + + private Generation(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Generation forValue(final String value) { + return Promoter.enumFromString(value, Generation.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/Generation1.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/Generation1.java new file mode 100644 index 00000000..0e5e68d2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/Generation1.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Generation1 { + LEGACY("legacy"), + + DYNAMIC("dynamic"); + + private final String value; + + private Generation1(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Generation1 forValue(final String value) { + return Promoter.enumFromString(value, Generation1.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/Generations.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/Generations.java new file mode 100644 index 00000000..ee1e7379 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/Generations.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Generations { + LEGACY("legacy"), + + DYNAMIC("dynamic"), + + LEGACY_DYNAMIC("legacy,dynamic"); + + private final String value; + + private Generations(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Generations forValue(final String value) { + return Promoter.enumFromString(value, Generations.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/ListTemplate200Response.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/ListTemplate200Response.java new file mode 100644 index 00000000..aaf1f6fc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/ListTemplate200Response.java @@ -0,0 +1,82 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.templates.models.Metadata; +import com.sendgrid.rest.api.v3.templates.models.TransactionalTemplatesTemplateLean; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListTemplate200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("_metadata") + @Getter + @Setter + private Metadata metadata; + + public ListTemplate200Response() {} + + private ListTemplate200Response(Builder builder) { + this.result = builder.result; + this.metadata = builder.metadata; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + private Metadata metadata; + + public Builder() {} + + public Builder result(List result) { + this.result = result; + return this; + } + + public Builder metadata(Metadata metadata) { + this.metadata = metadata; + return this; + } + + public ListTemplate200Response build() { + return new ListTemplate200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListTemplate200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + if (metadata != null) joiner.add("metadata=" + metadata); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/ListTemplate400Response.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/ListTemplate400Response.java new file mode 100644 index 00000000..32aaa8d9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/ListTemplate400Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.templates.models.ListTemplate400ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListTemplate400Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public ListTemplate400Response() {} + + private ListTemplate400Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public ListTemplate400Response build() { + return new ListTemplate400Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListTemplate400Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/ListTemplate400ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/ListTemplate400ResponseErrorsInner.java new file mode 100644 index 00000000..c4a50b3d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/ListTemplate400ResponseErrorsInner.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListTemplate400ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_id") + @Getter + @Setter + private String errorId; + + public ListTemplate400ResponseErrorsInner() {} + + private ListTemplate400ResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.errorId = builder.errorId; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String errorId; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder errorId(String errorId) { + this.errorId = errorId; + return this; + } + + public ListTemplate400ResponseErrorsInner build() { + return new ListTemplate400ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListTemplate400ResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (errorId != null) joiner.add("errorId=" + errorId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/Metadata.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/Metadata.java new file mode 100644 index 00000000..3222b642 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/Metadata.java @@ -0,0 +1,108 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.net.URI; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class Metadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("prev") + @Getter + @Setter + private URI prev; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("self") + @Getter + @Setter + private URI self; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next") + @Getter + @Setter + private URI next; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("count") + @Getter + @Setter + private Integer count; + + public Metadata() {} + + private Metadata(Builder builder) { + this.prev = builder.prev; + this.self = builder.self; + this.next = builder.next; + this.count = builder.count; + } + + // Builder class for constructing object + public static class Builder { + + private URI prev; + private URI self; + private URI next; + private Integer count; + + public Builder() {} + + public Builder prev(URI prev) { + this.prev = prev; + return this; + } + + public Builder self(URI self) { + this.self = self; + return this; + } + + public Builder next(URI next) { + this.next = next; + return this; + } + + public Builder count(Integer count) { + this.count = count; + return this; + } + + public Metadata build() { + return new Metadata(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + Metadata.class.getSimpleName() + "(", + ")" + ); + if (prev != null) joiner.add("prev=" + prev); + if (self != null) joiner.add("self=" + self); + if (next != null) joiner.add("next=" + next); + if (count != null) joiner.add("count=" + count); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplate.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplate.java new file mode 100644 index 00000000..583fd2dd --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplate.java @@ -0,0 +1,132 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.templates.models.Generation1; +import com.sendgrid.rest.api.v3.templates.models.TransactionalTemplateWarning; +import com.sendgrid.rest.api.v3.templates.models.TransactionalTemplatesVersionOutputLean; +import java.util.List; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class TransactionalTemplate { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private UUID id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("generation") + @Getter + @Setter + private Generation1 generation; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private String updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("versions") + @Getter + @Setter + private List versions; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("warning") + @Getter + @Setter + private TransactionalTemplateWarning warning; + + public TransactionalTemplate() {} + + private TransactionalTemplate(Builder builder) { + this.id = builder.id; + this.name = builder.name; + this.generation = builder.generation; + this.updatedAt = builder.updatedAt; + this.versions = builder.versions; + this.warning = builder.warning; + } + + // Builder class for constructing object + public static class Builder { + + private UUID id; + private String name; + private Generation1 generation; + private String updatedAt; + private List versions; + private TransactionalTemplateWarning warning; + + public Builder( + UUID id, + String name, + Generation1 generation, + String updatedAt + ) { + this.id = id; + this.name = name; + this.generation = generation; + this.updatedAt = updatedAt; + } + + public Builder versions( + List versions + ) { + this.versions = versions; + return this; + } + + public Builder warning(TransactionalTemplateWarning warning) { + this.warning = warning; + return this; + } + + public TransactionalTemplate build() { + return new TransactionalTemplate(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + TransactionalTemplate.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (name != null) joiner.add("name=" + name); + if (generation != null) joiner.add("generation=" + generation); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (versions != null) joiner.add("versions=" + versions); + if (warning != null) joiner.add("warning=" + warning); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplateVersionCreate.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplateVersionCreate.java new file mode 100644 index 00000000..89ef0a28 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplateVersionCreate.java @@ -0,0 +1,160 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.templates.models.Active; +import com.sendgrid.rest.api.v3.templates.models.Editor; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class TransactionalTemplateVersionCreate { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("active") + @Getter + @Setter + private Active active; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html_content") + @Getter + @Setter + private String htmlContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("plain_content") + @Getter + @Setter + private String plainContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("generate_plain_content") + @Getter + @Setter + private Boolean generatePlainContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subject") + @Getter + @Setter + private String subject; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("editor") + @Getter + @Setter + private Editor editor; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("test_data") + @Getter + @Setter + private String testData; + + public TransactionalTemplateVersionCreate() {} + + private TransactionalTemplateVersionCreate(Builder builder) { + this.active = builder.active; + this.name = builder.name; + this.htmlContent = builder.htmlContent; + this.plainContent = builder.plainContent; + this.generatePlainContent = builder.generatePlainContent; + this.subject = builder.subject; + this.editor = builder.editor; + this.testData = builder.testData; + } + + // Builder class for constructing object + public static class Builder { + + private Active active; + private String name; + private String htmlContent; + private String plainContent; + private Boolean generatePlainContent; + private String subject; + private Editor editor; + private String testData; + + public Builder(String name, String subject) { + this.name = name; + this.subject = subject; + } + + public Builder active(Active active) { + this.active = active; + return this; + } + + public Builder htmlContent(String htmlContent) { + this.htmlContent = htmlContent; + return this; + } + + public Builder plainContent(String plainContent) { + this.plainContent = plainContent; + return this; + } + + public Builder generatePlainContent(Boolean generatePlainContent) { + this.generatePlainContent = generatePlainContent; + return this; + } + + public Builder editor(Editor editor) { + this.editor = editor; + return this; + } + + public Builder testData(String testData) { + this.testData = testData; + return this; + } + + public TransactionalTemplateVersionCreate build() { + return new TransactionalTemplateVersionCreate(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + TransactionalTemplateVersionCreate.class.getSimpleName() + "(", + ")" + ); + if (active != null) joiner.add("active=" + active); + if (name != null) joiner.add("name=" + name); + if (htmlContent != null) joiner.add("htmlContent=" + htmlContent); + if (plainContent != null) joiner.add("plainContent=" + plainContent); + if (generatePlainContent != null) joiner.add( + "generatePlainContent=" + generatePlainContent + ); + if (subject != null) joiner.add("subject=" + subject); + if (editor != null) joiner.add("editor=" + editor); + if (testData != null) joiner.add("testData=" + testData); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplateVersionOutput.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplateVersionOutput.java new file mode 100644 index 00000000..8c4e7d93 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplateVersionOutput.java @@ -0,0 +1,233 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.templates.models.Active1; +import com.sendgrid.rest.api.v3.templates.models.Editor1; +import com.sendgrid.rest.api.v3.templates.models.TransactionalTemplateWarning; +import java.util.List; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class TransactionalTemplateVersionOutput { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("warnings") + @Getter + @Setter + private List warnings; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("active") + @Getter + @Setter + private Active1 active; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html_content") + @Getter + @Setter + private String htmlContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("plain_content") + @Getter + @Setter + private String plainContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("generate_plain_content") + @Getter + @Setter + private Boolean generatePlainContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subject") + @Getter + @Setter + private String subject; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("editor") + @Getter + @Setter + private Editor1 editor; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("test_data") + @Getter + @Setter + private String testData; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private UUID id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("template_id") + @Getter + @Setter + private String templateId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private String updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("thumbnail_url") + @Getter + @Setter + private String thumbnailUrl; + + public TransactionalTemplateVersionOutput() {} + + private TransactionalTemplateVersionOutput(Builder builder) { + this.warnings = builder.warnings; + this.active = builder.active; + this.name = builder.name; + this.htmlContent = builder.htmlContent; + this.plainContent = builder.plainContent; + this.generatePlainContent = builder.generatePlainContent; + this.subject = builder.subject; + this.editor = builder.editor; + this.testData = builder.testData; + this.id = builder.id; + this.templateId = builder.templateId; + this.updatedAt = builder.updatedAt; + this.thumbnailUrl = builder.thumbnailUrl; + } + + // Builder class for constructing object + public static class Builder { + + private List warnings; + private Active1 active; + private String name; + private String htmlContent; + private String plainContent; + private Boolean generatePlainContent; + private String subject; + private Editor1 editor; + private String testData; + private UUID id; + private String templateId; + private String updatedAt; + private String thumbnailUrl; + + public Builder(String name, String subject) { + this.name = name; + this.subject = subject; + } + + public Builder warnings(List warnings) { + this.warnings = warnings; + return this; + } + + public Builder active(Active1 active) { + this.active = active; + return this; + } + + public Builder htmlContent(String htmlContent) { + this.htmlContent = htmlContent; + return this; + } + + public Builder plainContent(String plainContent) { + this.plainContent = plainContent; + return this; + } + + public Builder generatePlainContent(Boolean generatePlainContent) { + this.generatePlainContent = generatePlainContent; + return this; + } + + public Builder editor(Editor1 editor) { + this.editor = editor; + return this; + } + + public Builder testData(String testData) { + this.testData = testData; + return this; + } + + public Builder id(UUID id) { + this.id = id; + return this; + } + + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + public Builder updatedAt(String updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + public TransactionalTemplateVersionOutput build() { + return new TransactionalTemplateVersionOutput(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + TransactionalTemplateVersionOutput.class.getSimpleName() + "(", + ")" + ); + if (warnings != null) joiner.add("warnings=" + warnings); + if (active != null) joiner.add("active=" + active); + if (name != null) joiner.add("name=" + name); + if (htmlContent != null) joiner.add("htmlContent=" + htmlContent); + if (plainContent != null) joiner.add("plainContent=" + plainContent); + if (generatePlainContent != null) joiner.add( + "generatePlainContent=" + generatePlainContent + ); + if (subject != null) joiner.add("subject=" + subject); + if (editor != null) joiner.add("editor=" + editor); + if (testData != null) joiner.add("testData=" + testData); + if (id != null) joiner.add("id=" + id); + if (templateId != null) joiner.add("templateId=" + templateId); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (thumbnailUrl != null) joiner.add("thumbnailUrl=" + thumbnailUrl); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplateWarning.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplateWarning.java new file mode 100644 index 00000000..f4264304 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplateWarning.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class TransactionalTemplateWarning { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public TransactionalTemplateWarning() {} + + private TransactionalTemplateWarning(Builder builder) { + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public TransactionalTemplateWarning build() { + return new TransactionalTemplateWarning(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + TransactionalTemplateWarning.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplatesTemplateLean.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplatesTemplateLean.java new file mode 100644 index 00000000..1ac35908 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplatesTemplateLean.java @@ -0,0 +1,117 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.templates.models.Generation1; +import com.sendgrid.rest.api.v3.templates.models.TransactionalTemplatesVersionOutputLean; +import java.util.List; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class TransactionalTemplatesTemplateLean { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private UUID id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("generation") + @Getter + @Setter + private Generation1 generation; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private String updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("versions") + @Getter + @Setter + private List versions; + + public TransactionalTemplatesTemplateLean() {} + + private TransactionalTemplatesTemplateLean(Builder builder) { + this.id = builder.id; + this.name = builder.name; + this.generation = builder.generation; + this.updatedAt = builder.updatedAt; + this.versions = builder.versions; + } + + // Builder class for constructing object + public static class Builder { + + private UUID id; + private String name; + private Generation1 generation; + private String updatedAt; + private List versions; + + public Builder( + UUID id, + String name, + Generation1 generation, + String updatedAt + ) { + this.id = id; + this.name = name; + this.generation = generation; + this.updatedAt = updatedAt; + } + + public Builder versions( + List versions + ) { + this.versions = versions; + return this; + } + + public TransactionalTemplatesTemplateLean build() { + return new TransactionalTemplatesTemplateLean(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + TransactionalTemplatesTemplateLean.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (name != null) joiner.add("name=" + name); + if (generation != null) joiner.add("generation=" + generation); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (versions != null) joiner.add("versions=" + versions); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplatesVersionOutputLean.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplatesVersionOutputLean.java new file mode 100644 index 00000000..23c409cc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/TransactionalTemplatesVersionOutputLean.java @@ -0,0 +1,210 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.templates.models.Active1; +import com.sendgrid.rest.api.v3.templates.models.Editor1; +import java.util.StringJoiner; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class TransactionalTemplatesVersionOutputLean { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private UUID id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("template_id") + @Getter + @Setter + private String templateId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("active") + @Getter + @Setter + private Active1 active; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("subject") + @Getter + @Setter + private String subject; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_at") + @Getter + @Setter + private String updatedAt; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("generate_plain_content") + @Getter + @Setter + private Boolean generatePlainContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html_content") + @Getter + @Setter + private String htmlContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("plain_content") + @Getter + @Setter + private String plainContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("editor") + @Getter + @Setter + private Editor1 editor; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("thumbnail_url") + @Getter + @Setter + private String thumbnailUrl; + + public TransactionalTemplatesVersionOutputLean() {} + + private TransactionalTemplatesVersionOutputLean(Builder builder) { + this.id = builder.id; + this.templateId = builder.templateId; + this.active = builder.active; + this.name = builder.name; + this.subject = builder.subject; + this.updatedAt = builder.updatedAt; + this.generatePlainContent = builder.generatePlainContent; + this.htmlContent = builder.htmlContent; + this.plainContent = builder.plainContent; + this.editor = builder.editor; + this.thumbnailUrl = builder.thumbnailUrl; + } + + // Builder class for constructing object + public static class Builder { + + private UUID id; + private String templateId; + private Active1 active; + private String name; + private String subject; + private String updatedAt; + private Boolean generatePlainContent; + private String htmlContent; + private String plainContent; + private Editor1 editor; + private String thumbnailUrl; + + public Builder() {} + + public Builder id(UUID id) { + this.id = id; + return this; + } + + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + public Builder active(Active1 active) { + this.active = active; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder subject(String subject) { + this.subject = subject; + return this; + } + + public Builder updatedAt(String updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder generatePlainContent(Boolean generatePlainContent) { + this.generatePlainContent = generatePlainContent; + return this; + } + + public Builder htmlContent(String htmlContent) { + this.htmlContent = htmlContent; + return this; + } + + public Builder plainContent(String plainContent) { + this.plainContent = plainContent; + return this; + } + + public Builder editor(Editor1 editor) { + this.editor = editor; + return this; + } + + public Builder thumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; + return this; + } + + public TransactionalTemplatesVersionOutputLean build() { + return new TransactionalTemplatesVersionOutputLean(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + TransactionalTemplatesVersionOutputLean.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (templateId != null) joiner.add("templateId=" + templateId); + if (active != null) joiner.add("active=" + active); + if (name != null) joiner.add("name=" + name); + if (subject != null) joiner.add("subject=" + subject); + if (updatedAt != null) joiner.add("updatedAt=" + updatedAt); + if (generatePlainContent != null) joiner.add( + "generatePlainContent=" + generatePlainContent + ); + if (htmlContent != null) joiner.add("htmlContent=" + htmlContent); + if (plainContent != null) joiner.add("plainContent=" + plainContent); + if (editor != null) joiner.add("editor=" + editor); + if (thumbnailUrl != null) joiner.add("thumbnailUrl=" + thumbnailUrl); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/templates/models/UpdateTemplateRequest.java b/src/main/java/com/sendgrid/rest/api/v3/templates/models/UpdateTemplateRequest.java new file mode 100644 index 00000000..56bd5736 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/templates/models/UpdateTemplateRequest.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Templates API + * The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + * + * 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.templates.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateTemplateRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + public UpdateTemplateRequest() {} + + private UpdateTemplateRequest(Builder builder) { + this.name = builder.name; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public UpdateTemplateRequest build() { + return new UpdateTemplateRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateTemplateRequest.class.getSimpleName() + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/ListClickTrackingSetting.java b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/ListClickTrackingSetting.java new file mode 100644 index 00000000..02db6750 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/ListClickTrackingSetting.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Tracking Settings API + * The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + * + * 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.trackingsettings; + +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.trackingsettings.models.ClickTracking; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListClickTrackingSetting extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/tracking_settings/click"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListClickTrackingSetting creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), ClickTracking.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/ListGoogleAnalyticsTrackingSetting.java b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/ListGoogleAnalyticsTrackingSetting.java new file mode 100644 index 00000000..29ef8e5b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/ListGoogleAnalyticsTrackingSetting.java @@ -0,0 +1,85 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Tracking Settings API + * The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + * + * 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.trackingsettings; + +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.trackingsettings.models.GoogleAnalyticsSettings; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListGoogleAnalyticsTrackingSetting extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/tracking_settings/google_analytics"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListGoogleAnalyticsTrackingSetting creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + GoogleAnalyticsSettings.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/ListOpenTrackingSetting.java b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/ListOpenTrackingSetting.java new file mode 100644 index 00000000..5a395703 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/ListOpenTrackingSetting.java @@ -0,0 +1,85 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Tracking Settings API + * The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + * + * 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.trackingsettings; + +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.trackingsettings.models.ListOpenTrackingSetting200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListOpenTrackingSetting extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/tracking_settings/open"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListOpenTrackingSetting creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + ListOpenTrackingSetting200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/ListSubscriptionTrackingSetting.java b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/ListSubscriptionTrackingSetting.java new file mode 100644 index 00000000..2e140d5d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/ListSubscriptionTrackingSetting.java @@ -0,0 +1,85 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Tracking Settings API + * The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + * + * 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.trackingsettings; + +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.trackingsettings.models.SubscriptionTrackingSettings; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListSubscriptionTrackingSetting extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/tracking_settings/subscription"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListSubscriptionTrackingSetting creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + SubscriptionTrackingSettings.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/ListTrackingSetting.java b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/ListTrackingSetting.java new file mode 100644 index 00000000..14d55a0c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/ListTrackingSetting.java @@ -0,0 +1,85 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Tracking Settings API + * The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + * + * 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.trackingsettings; + +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.trackingsettings.models.ListTrackingSetting200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListTrackingSetting extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/tracking_settings"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListTrackingSetting creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + ListTrackingSetting200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/UpdateClickTrackingSetting.java b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/UpdateClickTrackingSetting.java new file mode 100644 index 00000000..61431015 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/UpdateClickTrackingSetting.java @@ -0,0 +1,91 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Tracking Settings API + * The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + * + * 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.trackingsettings; + +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.trackingsettings.models.ClickTracking; +import com.sendgrid.rest.api.v3.trackingsettings.models.UpdateClickTrackingSettingRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateClickTrackingSetting extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private UpdateClickTrackingSettingRequest updateClickTrackingSettingRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/tracking_settings/click"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateClickTrackingSetting creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), ClickTracking.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateClickTrackingSettingRequest != null) { + request.addBody(JsonUtil.toJson(updateClickTrackingSettingRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/UpdateGoogleAnalyticsTrackingSetting.java b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/UpdateGoogleAnalyticsTrackingSetting.java new file mode 100644 index 00000000..817ba122 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/UpdateGoogleAnalyticsTrackingSetting.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Tracking Settings API + * The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + * + * 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.trackingsettings; + +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.trackingsettings.models.GoogleAnalyticsSettings; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateGoogleAnalyticsTrackingSetting extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private GoogleAnalyticsSettings googleAnalyticsSettings; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/tracking_settings/google_analytics"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateGoogleAnalyticsTrackingSetting creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + GoogleAnalyticsSettings.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (googleAnalyticsSettings != null) { + request.addBody(JsonUtil.toJson(googleAnalyticsSettings)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/UpdateOpenTrackingSetting.java b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/UpdateOpenTrackingSetting.java new file mode 100644 index 00000000..4c63cc48 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/UpdateOpenTrackingSetting.java @@ -0,0 +1,96 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Tracking Settings API + * The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + * + * 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.trackingsettings; + +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.trackingsettings.models.ListOpenTrackingSetting200Response; +import com.sendgrid.rest.api.v3.trackingsettings.models.UpdateOpenTrackingSettingRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateOpenTrackingSetting extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private UpdateOpenTrackingSettingRequest updateOpenTrackingSettingRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/tracking_settings/open"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateOpenTrackingSetting creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + ListOpenTrackingSetting200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateOpenTrackingSettingRequest != null) { + request.addBody(JsonUtil.toJson(updateOpenTrackingSettingRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/UpdateSubscriptionTrackingSetting.java b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/UpdateSubscriptionTrackingSetting.java new file mode 100644 index 00000000..0d638e67 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/UpdateSubscriptionTrackingSetting.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Tracking Settings API + * The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + * + * 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.trackingsettings; + +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.trackingsettings.models.SubscriptionTrackingSettings; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateSubscriptionTrackingSetting extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private SubscriptionTrackingSettings subscriptionTrackingSettings; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/tracking_settings/subscription"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateSubscriptionTrackingSetting creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + SubscriptionTrackingSettings.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (subscriptionTrackingSettings != null) { + request.addBody(JsonUtil.toJson(subscriptionTrackingSettings)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/ClickTracking.java b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/ClickTracking.java new file mode 100644 index 00000000..857bfa2f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/ClickTracking.java @@ -0,0 +1,72 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Tracking Settings API + * The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + * + * 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.trackingsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ClickTracking { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enable_text") + @Getter + @Setter + private Boolean enableText; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + public ClickTracking() {} + + private ClickTracking(Builder builder) { + this.enableText = builder.enableText; + this.enabled = builder.enabled; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enableText; + private Boolean enabled; + + public Builder(Boolean enableText, Boolean enabled) { + this.enableText = enableText; + this.enabled = enabled; + } + + public ClickTracking build() { + return new ClickTracking(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ClickTracking.class.getSimpleName() + "(", + ")" + ); + if (enableText != null) joiner.add("enableText=" + enableText); + if (enabled != null) joiner.add("enabled=" + enabled); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/GoogleAnalyticsSettings.java b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/GoogleAnalyticsSettings.java new file mode 100644 index 00000000..96f48296 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/GoogleAnalyticsSettings.java @@ -0,0 +1,135 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Tracking Settings API + * The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + * + * 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.trackingsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GoogleAnalyticsSettings { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("utm_campaign") + @Getter + @Setter + private String utmCampaign; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("utm_content") + @Getter + @Setter + private String utmContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("utm_medium") + @Getter + @Setter + private String utmMedium; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("utm_source") + @Getter + @Setter + private String utmSource; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("utm_term") + @Getter + @Setter + private String utmTerm; + + public GoogleAnalyticsSettings() {} + + private GoogleAnalyticsSettings(Builder builder) { + this.enabled = builder.enabled; + this.utmCampaign = builder.utmCampaign; + this.utmContent = builder.utmContent; + this.utmMedium = builder.utmMedium; + this.utmSource = builder.utmSource; + this.utmTerm = builder.utmTerm; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + private String utmCampaign; + private String utmContent; + private String utmMedium; + private String utmSource; + private String utmTerm; + + public Builder() {} + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public Builder utmCampaign(String utmCampaign) { + this.utmCampaign = utmCampaign; + return this; + } + + public Builder utmContent(String utmContent) { + this.utmContent = utmContent; + return this; + } + + public Builder utmMedium(String utmMedium) { + this.utmMedium = utmMedium; + return this; + } + + public Builder utmSource(String utmSource) { + this.utmSource = utmSource; + return this; + } + + public Builder utmTerm(String utmTerm) { + this.utmTerm = utmTerm; + return this; + } + + public GoogleAnalyticsSettings build() { + return new GoogleAnalyticsSettings(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GoogleAnalyticsSettings.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + if (utmCampaign != null) joiner.add("utmCampaign=" + utmCampaign); + if (utmContent != null) joiner.add("utmContent=" + utmContent); + if (utmMedium != null) joiner.add("utmMedium=" + utmMedium); + if (utmSource != null) joiner.add("utmSource=" + utmSource); + if (utmTerm != null) joiner.add("utmTerm=" + utmTerm); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/ListOpenTrackingSetting200Response.java b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/ListOpenTrackingSetting200Response.java new file mode 100644 index 00000000..cde0b388 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/ListOpenTrackingSetting200Response.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Tracking Settings API + * The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + * + * 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.trackingsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListOpenTrackingSetting200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + public ListOpenTrackingSetting200Response() {} + + private ListOpenTrackingSetting200Response(Builder builder) { + this.enabled = builder.enabled; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + + public Builder(Boolean enabled) { + this.enabled = enabled; + } + + public ListOpenTrackingSetting200Response build() { + return new ListOpenTrackingSetting200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListOpenTrackingSetting200Response.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/ListTrackingSetting200Response.java b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/ListTrackingSetting200Response.java new file mode 100644 index 00000000..71238513 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/ListTrackingSetting200Response.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Tracking Settings API + * The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + * + * 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.trackingsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.trackingsettings.models.ListTrackingSetting200ResponseResultInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListTrackingSetting200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + public ListTrackingSetting200Response() {} + + private ListTrackingSetting200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + + public Builder() {} + + public Builder result( + List result + ) { + this.result = result; + return this; + } + + public ListTrackingSetting200Response build() { + return new ListTrackingSetting200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListTrackingSetting200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/ListTrackingSetting200ResponseResultInner.java b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/ListTrackingSetting200ResponseResultInner.java new file mode 100644 index 00000000..9e7f3df8 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/ListTrackingSetting200ResponseResultInner.java @@ -0,0 +1,108 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Tracking Settings API + * The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + * + * 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.trackingsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListTrackingSetting200ResponseResultInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("title") + @Getter + @Setter + private String title; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + @Getter + @Setter + private String description; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + public ListTrackingSetting200ResponseResultInner() {} + + private ListTrackingSetting200ResponseResultInner(Builder builder) { + this.name = builder.name; + this.title = builder.title; + this.description = builder.description; + this.enabled = builder.enabled; + } + + // Builder class for constructing object + public static class Builder { + + private String name; + private String title; + private String description; + private Boolean enabled; + + public Builder() {} + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder title(String title) { + this.title = title; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public ListTrackingSetting200ResponseResultInner build() { + return new ListTrackingSetting200ResponseResultInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListTrackingSetting200ResponseResultInner.class.getSimpleName() + + "(", + ")" + ); + if (name != null) joiner.add("name=" + name); + if (title != null) joiner.add("title=" + title); + if (description != null) joiner.add("description=" + description); + if (enabled != null) joiner.add("enabled=" + enabled); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/SubscriptionTrackingSettings.java b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/SubscriptionTrackingSettings.java new file mode 100644 index 00000000..617a22b0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/SubscriptionTrackingSettings.java @@ -0,0 +1,136 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Tracking Settings API + * The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + * + * 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.trackingsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.net.URI; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class SubscriptionTrackingSettings { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("html_content") + @Getter + @Setter + private String htmlContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("landing") + @Getter + @Setter + private String landing; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("plain_content") + @Getter + @Setter + private String plainContent; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("replace") + @Getter + @Setter + private String replace; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("url") + @Getter + @Setter + private URI url; + + public SubscriptionTrackingSettings() {} + + private SubscriptionTrackingSettings(Builder builder) { + this.enabled = builder.enabled; + this.htmlContent = builder.htmlContent; + this.landing = builder.landing; + this.plainContent = builder.plainContent; + this.replace = builder.replace; + this.url = builder.url; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + private String htmlContent; + private String landing; + private String plainContent; + private String replace; + private URI url; + + public Builder() {} + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public Builder htmlContent(String htmlContent) { + this.htmlContent = htmlContent; + return this; + } + + public Builder landing(String landing) { + this.landing = landing; + return this; + } + + public Builder plainContent(String plainContent) { + this.plainContent = plainContent; + return this; + } + + public Builder replace(String replace) { + this.replace = replace; + return this; + } + + public Builder url(URI url) { + this.url = url; + return this; + } + + public SubscriptionTrackingSettings build() { + return new SubscriptionTrackingSettings(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + SubscriptionTrackingSettings.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + if (htmlContent != null) joiner.add("htmlContent=" + htmlContent); + if (landing != null) joiner.add("landing=" + landing); + if (plainContent != null) joiner.add("plainContent=" + plainContent); + if (replace != null) joiner.add("replace=" + replace); + if (url != null) joiner.add("url=" + url); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/UpdateClickTrackingSettingRequest.java b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/UpdateClickTrackingSettingRequest.java new file mode 100644 index 00000000..53dd0074 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/UpdateClickTrackingSettingRequest.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Tracking Settings API + * The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + * + * 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.trackingsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateClickTrackingSettingRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + public UpdateClickTrackingSettingRequest() {} + + private UpdateClickTrackingSettingRequest(Builder builder) { + this.enabled = builder.enabled; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + + public Builder() {} + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public UpdateClickTrackingSettingRequest build() { + return new UpdateClickTrackingSettingRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateClickTrackingSettingRequest.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/UpdateOpenTrackingSettingRequest.java b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/UpdateOpenTrackingSettingRequest.java new file mode 100644 index 00000000..8b38388e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/trackingsettings/models/UpdateOpenTrackingSettingRequest.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Tracking Settings API + * The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + * + * 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.trackingsettings.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateOpenTrackingSettingRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + public UpdateOpenTrackingSettingRequest() {} + + private UpdateOpenTrackingSettingRequest(Builder builder) { + this.enabled = builder.enabled; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + + public Builder() {} + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public UpdateOpenTrackingSettingRequest build() { + return new UpdateOpenTrackingSettingRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateOpenTrackingSettingRequest.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/ListAccount.java b/src/main/java/com/sendgrid/rest/api/v3/user/ListAccount.java new file mode 100644 index 00000000..d9116c25 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/ListAccount.java @@ -0,0 +1,85 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user; + +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.user.models.GETUserAccountResponse; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListAccount extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/account"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListAccount creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + GETUserAccountResponse.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/ListCredit.java b/src/main/java/com/sendgrid/rest/api/v3/user/ListCredit.java new file mode 100644 index 00000000..2d119cdf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/ListCredit.java @@ -0,0 +1,85 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user; + +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.user.models.ListCredit200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListCredit extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/credits"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListCredit creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + ListCredit200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/ListEmail.java b/src/main/java/com/sendgrid/rest/api/v3/user/ListEmail.java new file mode 100644 index 00000000..e38d90bc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/ListEmail.java @@ -0,0 +1,82 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user; + +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.user.models.ListEmail200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListEmail extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/email"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListEmail creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), ListEmail200Response.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/ListProfile.java b/src/main/java/com/sendgrid/rest/api/v3/user/ListProfile.java new file mode 100644 index 00000000..da88356f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/ListProfile.java @@ -0,0 +1,85 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user; + +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.user.models.GETUserProfileResponse; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListProfile extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/profile"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListProfile creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + GETUserProfileResponse.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/ListUsername.java b/src/main/java/com/sendgrid/rest/api/v3/user/ListUsername.java new file mode 100644 index 00000000..5eee84f3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/ListUsername.java @@ -0,0 +1,85 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user; + +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.user.models.ListUsername200Response; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListUsername extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/username"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListUsername creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + ListUsername200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/UpdateEmail.java b/src/main/java/com/sendgrid/rest/api/v3/user/UpdateEmail.java new file mode 100644 index 00000000..c90cb22e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/UpdateEmail.java @@ -0,0 +1,96 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user; + +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.user.models.UpdateEmail200Response; +import com.sendgrid.rest.api.v3.user.models.UpdateEmailRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateEmail extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private UpdateEmailRequest updateEmailRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/email"; + Request request = new Request( + HttpMethod.PUT, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateEmail creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + UpdateEmail200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateEmailRequest != null) { + request.addBody(JsonUtil.toJson(updateEmailRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/UpdatePassword.java b/src/main/java/com/sendgrid/rest/api/v3/user/UpdatePassword.java new file mode 100644 index 00000000..4c27e96c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/UpdatePassword.java @@ -0,0 +1,90 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user; + +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.user.models.UpdatePasswordRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdatePassword extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private UpdatePasswordRequest updatePasswordRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/user/password"; + Request request = new Request( + HttpMethod.PUT, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdatePassword creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), Object.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updatePasswordRequest != null) { + request.addBody(JsonUtil.toJson(updatePasswordRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/UpdateProfile.java b/src/main/java/com/sendgrid/rest/api/v3/user/UpdateProfile.java new file mode 100644 index 00000000..e57fa253 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/UpdateProfile.java @@ -0,0 +1,105 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user; + +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.user.models.ErrorResponse; +import com.sendgrid.rest.api.v3.user.models.UserProfile; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateProfile extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private UserProfile userProfile; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/user/profile"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateProfile 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.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(), UserProfile.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (userProfile != null) { + request.addBody(JsonUtil.toJson(userProfile)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/UpdateUsername.java b/src/main/java/com/sendgrid/rest/api/v3/user/UpdateUsername.java new file mode 100644 index 00000000..3fdb853f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/UpdateUsername.java @@ -0,0 +1,96 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user; + +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.user.models.UpdateUsername200Response; +import com.sendgrid.rest.api.v3.user.models.UpdateUsernameRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateUsername extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private UpdateUsernameRequest updateUsernameRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/username"; + Request request = new Request( + HttpMethod.PUT, + path, + Domains.API.toString() + ); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateUsername creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + UpdateUsername200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateUsernameRequest != null) { + request.addBody(JsonUtil.toJson(updateUsernameRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/user/models/ErrorResponse.java new file mode 100644 index 00000000..37b24092 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.user.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/user/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..0225e73b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/models/GETUserAccountResponse.java b/src/main/java/com/sendgrid/rest/api/v3/user/models/GETUserAccountResponse.java new file mode 100644 index 00000000..f168fc56 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/models/GETUserAccountResponse.java @@ -0,0 +1,74 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.user.models.Type; +import java.math.BigDecimal; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GETUserAccountResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private Type type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reputation") + @Getter + @Setter + private BigDecimal reputation; + + public GETUserAccountResponse() {} + + private GETUserAccountResponse(Builder builder) { + this.type = builder.type; + this.reputation = builder.reputation; + } + + // Builder class for constructing object + public static class Builder { + + private Type type; + private BigDecimal reputation; + + public Builder(Type type, BigDecimal reputation) { + this.type = type; + this.reputation = reputation; + } + + public GETUserAccountResponse build() { + return new GETUserAccountResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GETUserAccountResponse.class.getSimpleName() + "(", + ")" + ); + if (type != null) joiner.add("type=" + type); + if (reputation != null) joiner.add("reputation=" + reputation); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/models/GETUserProfileResponse.java b/src/main/java/com/sendgrid/rest/api/v3/user/models/GETUserProfileResponse.java new file mode 100644 index 00000000..4149eaed --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/models/GETUserProfileResponse.java @@ -0,0 +1,177 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GETUserProfileResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address") + @Getter + @Setter + private String address; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address2") + @Getter + @Setter + private String address2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city") + @Getter + @Setter + private String city; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("company") + @Getter + @Setter + private String company; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country") + @Getter + @Setter + private String country; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("phone") + @Getter + @Setter + private String phone; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state") + @Getter + @Setter + private String state; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("website") + @Getter + @Setter + private String website; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("zip") + @Getter + @Setter + private String zip; + + public GETUserProfileResponse() {} + + private GETUserProfileResponse(Builder builder) { + this.address = builder.address; + this.address2 = builder.address2; + this.city = builder.city; + this.company = builder.company; + this.country = builder.country; + this.firstName = builder.firstName; + this.lastName = builder.lastName; + this.phone = builder.phone; + this.state = builder.state; + this.website = builder.website; + this.zip = builder.zip; + } + + // Builder class for constructing object + public static class Builder { + + private String address; + private String address2; + private String city; + private String company; + private String country; + private String firstName; + private String lastName; + private String phone; + private String state; + private String website; + private String zip; + + public Builder( + String address, + String city, + String company, + String country, + String firstName, + String lastName, + String phone, + String state, + String website, + String zip + ) { + this.address = address; + this.city = city; + this.company = company; + this.country = country; + this.firstName = firstName; + this.lastName = lastName; + this.phone = phone; + this.state = state; + this.website = website; + this.zip = zip; + } + + public Builder address2(String address2) { + this.address2 = address2; + return this; + } + + public GETUserProfileResponse build() { + return new GETUserProfileResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GETUserProfileResponse.class.getSimpleName() + "(", + ")" + ); + if (address != null) joiner.add("address=" + address); + if (address2 != null) joiner.add("address2=" + address2); + if (city != null) joiner.add("city=" + city); + if (company != null) joiner.add("company=" + company); + if (country != null) joiner.add("country=" + country); + if (firstName != null) joiner.add("firstName=" + firstName); + if (lastName != null) joiner.add("lastName=" + lastName); + if (phone != null) joiner.add("phone=" + phone); + if (state != null) joiner.add("state=" + state); + if (website != null) joiner.add("website=" + website); + if (zip != null) joiner.add("zip=" + zip); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/models/ListCredit200Response.java b/src/main/java/com/sendgrid/rest/api/v3/user/models/ListCredit200Response.java new file mode 100644 index 00000000..a44b89ca --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/models/ListCredit200Response.java @@ -0,0 +1,132 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListCredit200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("remain") + @Getter + @Setter + private Integer remain; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("total") + @Getter + @Setter + private Integer total; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("overage") + @Getter + @Setter + private Integer overage; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("used") + @Getter + @Setter + private Integer used; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_reset") + @Getter + @Setter + private String lastReset; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("next_reset") + @Getter + @Setter + private String nextReset; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reset_frequency") + @Getter + @Setter + private String resetFrequency; + + public ListCredit200Response() {} + + private ListCredit200Response(Builder builder) { + this.remain = builder.remain; + this.total = builder.total; + this.overage = builder.overage; + this.used = builder.used; + this.lastReset = builder.lastReset; + this.nextReset = builder.nextReset; + this.resetFrequency = builder.resetFrequency; + } + + // Builder class for constructing object + public static class Builder { + + private Integer remain; + private Integer total; + private Integer overage; + private Integer used; + private String lastReset; + private String nextReset; + private String resetFrequency; + + public Builder( + Integer remain, + Integer total, + Integer overage, + Integer used, + String lastReset, + String nextReset, + String resetFrequency + ) { + this.remain = remain; + this.total = total; + this.overage = overage; + this.used = used; + this.lastReset = lastReset; + this.nextReset = nextReset; + this.resetFrequency = resetFrequency; + } + + public ListCredit200Response build() { + return new ListCredit200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListCredit200Response.class.getSimpleName() + "(", + ")" + ); + if (remain != null) joiner.add("remain=" + remain); + if (total != null) joiner.add("total=" + total); + if (overage != null) joiner.add("overage=" + overage); + if (used != null) joiner.add("used=" + used); + if (lastReset != null) joiner.add("lastReset=" + lastReset); + if (nextReset != null) joiner.add("nextReset=" + nextReset); + if (resetFrequency != null) joiner.add( + "resetFrequency=" + resetFrequency + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/models/ListEmail200Response.java b/src/main/java/com/sendgrid/rest/api/v3/user/models/ListEmail200Response.java new file mode 100644 index 00000000..3cc0bcdb --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/models/ListEmail200Response.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListEmail200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + public ListEmail200Response() {} + + private ListEmail200Response(Builder builder) { + this.email = builder.email; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + + public Builder(String email) { + this.email = email; + } + + public ListEmail200Response build() { + return new ListEmail200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListEmail200Response.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/models/ListUsername200Response.java b/src/main/java/com/sendgrid/rest/api/v3/user/models/ListUsername200Response.java new file mode 100644 index 00000000..04d9c8db --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/models/ListUsername200Response.java @@ -0,0 +1,72 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListUsername200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("user_id") + @Getter + @Setter + private Integer userId; + + public ListUsername200Response() {} + + private ListUsername200Response(Builder builder) { + this.username = builder.username; + this.userId = builder.userId; + } + + // Builder class for constructing object + public static class Builder { + + private String username; + private Integer userId; + + public Builder(String username, Integer userId) { + this.username = username; + this.userId = userId; + } + + public ListUsername200Response build() { + return new ListUsername200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListUsername200Response.class.getSimpleName() + "(", + ")" + ); + if (username != null) joiner.add("username=" + username); + if (userId != null) joiner.add("userId=" + userId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/models/Type.java b/src/main/java/com/sendgrid/rest/api/v3/user/models/Type.java new file mode 100644 index 00000000..532e32dc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/models/Type.java @@ -0,0 +1,42 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum Type { + FREE("free"), + + PAID("paid"); + + private final String value; + + private Type(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Type forValue(final String value) { + return Promoter.enumFromString(value, Type.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/models/UpdateEmail200Response.java b/src/main/java/com/sendgrid/rest/api/v3/user/models/UpdateEmail200Response.java new file mode 100644 index 00000000..393f069c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/models/UpdateEmail200Response.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateEmail200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + public UpdateEmail200Response() {} + + private UpdateEmail200Response(Builder builder) { + this.email = builder.email; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + + public Builder(String email) { + this.email = email; + } + + public UpdateEmail200Response build() { + return new UpdateEmail200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateEmail200Response.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/models/UpdateEmailRequest.java b/src/main/java/com/sendgrid/rest/api/v3/user/models/UpdateEmailRequest.java new file mode 100644 index 00000000..d1898bdd --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/models/UpdateEmailRequest.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateEmailRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + public UpdateEmailRequest() {} + + private UpdateEmailRequest(Builder builder) { + this.email = builder.email; + } + + // Builder class for constructing object + public static class Builder { + + private String email; + + public Builder() {} + + public Builder email(String email) { + this.email = email; + return this; + } + + public UpdateEmailRequest build() { + return new UpdateEmailRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateEmailRequest.class.getSimpleName() + "(", + ")" + ); + if (email != null) joiner.add("email=" + email); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/models/UpdatePasswordRequest.java b/src/main/java/com/sendgrid/rest/api/v3/user/models/UpdatePasswordRequest.java new file mode 100644 index 00000000..7ff77a5d --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/models/UpdatePasswordRequest.java @@ -0,0 +1,72 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdatePasswordRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("new_password") + @Getter + @Setter + private String newPassword; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("old_password") + @Getter + @Setter + private String oldPassword; + + public UpdatePasswordRequest() {} + + private UpdatePasswordRequest(Builder builder) { + this.newPassword = builder.newPassword; + this.oldPassword = builder.oldPassword; + } + + // Builder class for constructing object + public static class Builder { + + private String newPassword; + private String oldPassword; + + public Builder(String newPassword, String oldPassword) { + this.newPassword = newPassword; + this.oldPassword = oldPassword; + } + + public UpdatePasswordRequest build() { + return new UpdatePasswordRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdatePasswordRequest.class.getSimpleName() + "(", + ")" + ); + if (newPassword != null) joiner.add("newPassword=" + newPassword); + if (oldPassword != null) joiner.add("oldPassword=" + oldPassword); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/models/UpdateUsername200Response.java b/src/main/java/com/sendgrid/rest/api/v3/user/models/UpdateUsername200Response.java new file mode 100644 index 00000000..c608333b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/models/UpdateUsername200Response.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateUsername200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + public UpdateUsername200Response() {} + + private UpdateUsername200Response(Builder builder) { + this.username = builder.username; + } + + // Builder class for constructing object + public static class Builder { + + private String username; + + public Builder(String username) { + this.username = username; + } + + public UpdateUsername200Response build() { + return new UpdateUsername200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateUsername200Response.class.getSimpleName() + "(", + ")" + ); + if (username != null) joiner.add("username=" + username); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/models/UpdateUsernameRequest.java b/src/main/java/com/sendgrid/rest/api/v3/user/models/UpdateUsernameRequest.java new file mode 100644 index 00000000..f05acb16 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/models/UpdateUsernameRequest.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateUsernameRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("username") + @Getter + @Setter + private String username; + + public UpdateUsernameRequest() {} + + private UpdateUsernameRequest(Builder builder) { + this.username = builder.username; + } + + // Builder class for constructing object + public static class Builder { + + private String username; + + public Builder() {} + + public Builder username(String username) { + this.username = username; + return this; + } + + public UpdateUsernameRequest build() { + return new UpdateUsernameRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateUsernameRequest.class.getSimpleName() + "(", + ")" + ); + if (username != null) joiner.add("username=" + username); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/user/models/UserProfile.java b/src/main/java/com/sendgrid/rest/api/v3/user/models/UserProfile.java new file mode 100644 index 00000000..49d1b100 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/user/models/UserProfile.java @@ -0,0 +1,205 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid User API + * The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + * + * 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.user.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UserProfile { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address") + @Getter + @Setter + private String address; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address2") + @Getter + @Setter + private String address2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city") + @Getter + @Setter + private String city; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("company") + @Getter + @Setter + private String company; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country") + @Getter + @Setter + private String country; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("phone") + @Getter + @Setter + private String phone; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state") + @Getter + @Setter + private String state; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("website") + @Getter + @Setter + private String website; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("zip") + @Getter + @Setter + private String zip; + + public UserProfile() {} + + private UserProfile(Builder builder) { + this.address = builder.address; + this.address2 = builder.address2; + this.city = builder.city; + this.company = builder.company; + this.country = builder.country; + this.firstName = builder.firstName; + this.lastName = builder.lastName; + this.phone = builder.phone; + this.state = builder.state; + this.website = builder.website; + this.zip = builder.zip; + } + + // Builder class for constructing object + public static class Builder { + + private String address; + private String address2; + private String city; + private String company; + private String country; + private String firstName; + private String lastName; + private String phone; + private String state; + private String website; + private String zip; + + public Builder() {} + + public Builder address(String address) { + this.address = address; + return this; + } + + public Builder address2(String address2) { + this.address2 = address2; + return this; + } + + public Builder city(String city) { + this.city = city; + return this; + } + + public Builder company(String company) { + this.company = company; + return this; + } + + public Builder country(String country) { + this.country = country; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = firstName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = lastName; + return this; + } + + public Builder phone(String phone) { + this.phone = phone; + return this; + } + + public Builder state(String state) { + this.state = state; + return this; + } + + public Builder website(String website) { + this.website = website; + return this; + } + + public Builder zip(String zip) { + this.zip = zip; + return this; + } + + public UserProfile build() { + return new UserProfile(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UserProfile.class.getSimpleName() + "(", + ")" + ); + if (address != null) joiner.add("address=" + address); + if (address2 != null) joiner.add("address2=" + address2); + if (city != null) joiner.add("city=" + city); + if (company != null) joiner.add("company=" + company); + if (country != null) joiner.add("country=" + country); + if (firstName != null) joiner.add("firstName=" + firstName); + if (lastName != null) joiner.add("lastName=" + lastName); + if (phone != null) joiner.add("phone=" + phone); + if (state != null) joiner.add("state=" + state); + if (website != null) joiner.add("website=" + website); + if (zip != null) joiner.add("zip=" + zip); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/CreateVerifiedSender.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/CreateVerifiedSender.java new file mode 100644 index 00000000..f8e059ad --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/CreateVerifiedSender.java @@ -0,0 +1,154 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders; + +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.verifiedsenders.models.CreateVerifiedSender400Response; +import com.sendgrid.rest.api.v3.verifiedsenders.models.ErrorResponse; +import com.sendgrid.rest.api.v3.verifiedsenders.models.VerifiedSenderRequest; +import com.sendgrid.rest.api.v3.verifiedsenders.models.VerifiedSenderResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateVerifiedSender extends ApiKeyBase { + + @Setter + private VerifiedSenderRequest verifiedSenderRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/verified_senders"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "CreateVerifiedSender 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")) { + CreateVerifiedSender400Response error = JsonUtil.fromJson( + response.getStream(), + CreateVerifiedSender400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + VerifiedSenderResponse.class + ), + response.getHeaders() + ); + } + + private void addBody(final Request request) { + if (verifiedSenderRequest != null) { + request.addBody(JsonUtil.toJson(verifiedSenderRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/DeleteVerifiedSender.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/DeleteVerifiedSender.java new file mode 100644 index 00000000..efe6c23e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/DeleteVerifiedSender.java @@ -0,0 +1,133 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders; + +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.verifiedsenders.models.DeleteVerifiedSender403Response; +import com.sendgrid.rest.api.v3.verifiedsenders.models.DeleteVerifiedSender404Response; +import com.sendgrid.rest.api.v3.verifiedsenders.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class DeleteVerifiedSender extends ApiKeyBase { + + private final String id; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/verified_senders/{id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteVerifiedSender 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + DeleteVerifiedSender403Response error = JsonUtil.fromJson( + response.getStream(), + DeleteVerifiedSender403Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + DeleteVerifiedSender404Response error = JsonUtil.fromJson( + response.getStream(), + DeleteVerifiedSender404Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/ListVerifiedSender.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/ListVerifiedSender.java new file mode 100644 index 00000000..baac9981 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/ListVerifiedSender.java @@ -0,0 +1,152 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders; + +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.verifiedsenders.models.ErrorResponse; +import com.sendgrid.rest.api.v3.verifiedsenders.models.ListVerifiedSender200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import java.math.BigDecimal; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListVerifiedSender extends ApiKeyBase { + + @Setter + private BigDecimal limit; + + @Setter + private BigDecimal lastSeenID; + + @Setter + private Integer id; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/verified_senders"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListVerifiedSender 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + ListVerifiedSender200Response.class + ), + response.getHeaders() + ); + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (lastSeenID != null) { + request.addQueryParam("lastSeenID", lastSeenID.toString()); + } + if (id != null) { + request.addQueryParam("id", id.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/ListVerifiedSenderDomain.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/ListVerifiedSenderDomain.java new file mode 100644 index 00000000..63823d4a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/ListVerifiedSenderDomain.java @@ -0,0 +1,128 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders; + +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.verifiedsenders.models.ErrorResponse; +import com.sendgrid.rest.api.v3.verifiedsenders.models.ListVerifiedSenderDomain200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListVerifiedSenderDomain extends ApiKeyBase { + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/verified_senders/domains"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListVerifiedSenderDomain 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + ListVerifiedSenderDomain200Response.class + ), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/ListVerifiedSenderStepsCompleted.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/ListVerifiedSenderStepsCompleted.java new file mode 100644 index 00000000..40d45a0e --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/ListVerifiedSenderStepsCompleted.java @@ -0,0 +1,128 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders; + +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.verifiedsenders.models.ErrorResponse; +import com.sendgrid.rest.api.v3.verifiedsenders.models.ListVerifiedSenderStepsCompleted200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ListVerifiedSenderStepsCompleted extends ApiKeyBase { + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/verified_senders/steps_completed"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListVerifiedSenderStepsCompleted 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + ListVerifiedSenderStepsCompleted200Response.class + ), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/ResendVerifiedSender.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/ResendVerifiedSender.java new file mode 100644 index 00000000..2f4aae93 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/ResendVerifiedSender.java @@ -0,0 +1,145 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders; + +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.verifiedsenders.models.DeleteVerifiedSender404Response; +import com.sendgrid.rest.api.v3.verifiedsenders.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class ResendVerifiedSender extends ApiKeyBase { + + private final String id; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/verified_senders/resend/{id}"; + Request request = new Request( + HttpMethod.POST, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ResendVerifiedSender 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")) { + DeleteVerifiedSender404Response error = JsonUtil.fromJson( + response.getStream(), + DeleteVerifiedSender404Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + DeleteVerifiedSender404Response error = JsonUtil.fromJson( + response.getStream(), + DeleteVerifiedSender404Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/UpdateVerifiedSender.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/UpdateVerifiedSender.java new file mode 100644 index 00000000..988213bf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/UpdateVerifiedSender.java @@ -0,0 +1,164 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders; + +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.verifiedsenders.models.CreateVerifiedSender400Response; +import com.sendgrid.rest.api.v3.verifiedsenders.models.DeleteVerifiedSender404Response; +import com.sendgrid.rest.api.v3.verifiedsenders.models.ErrorResponse; +import com.sendgrid.rest.api.v3.verifiedsenders.models.VerifiedSenderRequest; +import com.sendgrid.rest.api.v3.verifiedsenders.models.VerifiedSenderResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateVerifiedSender extends ApiKeyBase { + + private final String id; + + @Setter + private VerifiedSenderRequest verifiedSenderRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/verified_senders/{id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateVerifiedSender 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")) { + CreateVerifiedSender400Response error = JsonUtil.fromJson( + response.getStream(), + CreateVerifiedSender400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "401")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + DeleteVerifiedSender404Response error = JsonUtil.fromJson( + response.getStream(), + DeleteVerifiedSender404Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + DeleteVerifiedSender404Response error = JsonUtil.fromJson( + response.getStream(), + DeleteVerifiedSender404Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + VerifiedSenderResponse.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addBody(final Request request) { + if (verifiedSenderRequest != null) { + request.addBody(JsonUtil.toJson(verifiedSenderRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/VerifySenderToken.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/VerifySenderToken.java new file mode 100644 index 00000000..e3d49fd9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/VerifySenderToken.java @@ -0,0 +1,128 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders; + +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.verifiedsenders.models.DeleteVerifiedSender404Response; +import com.sendgrid.rest.api.v3.verifiedsenders.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class VerifySenderToken extends ApiKeyBase { + + private final String token; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/verified_senders/verify/{token}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "VerifySenderToken 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + DeleteVerifiedSender404Response error = JsonUtil.fromJson( + response.getStream(), + DeleteVerifiedSender404Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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 (token != null) { + request.addPathParam("token", token.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/CreateVerifiedSender400Response.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/CreateVerifiedSender400Response.java new file mode 100644 index 00000000..d56a4342 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/CreateVerifiedSender400Response.java @@ -0,0 +1,66 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.verifiedsenders.models.CreateVerifiedSender400ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateVerifiedSender400Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public CreateVerifiedSender400Response() {} + + private CreateVerifiedSender400Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder( + List errors + ) { + this.errors = errors; + } + + public CreateVerifiedSender400Response build() { + return new CreateVerifiedSender400Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateVerifiedSender400Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/CreateVerifiedSender400ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/CreateVerifiedSender400ResponseErrorsInner.java new file mode 100644 index 00000000..c5087c93 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/CreateVerifiedSender400ResponseErrorsInner.java @@ -0,0 +1,87 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateVerifiedSender400ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_id") + @Getter + @Setter + private String errorId; + + public CreateVerifiedSender400ResponseErrorsInner() {} + + private CreateVerifiedSender400ResponseErrorsInner(Builder builder) { + this.field = builder.field; + this.message = builder.message; + this.errorId = builder.errorId; + } + + // Builder class for constructing object + public static class Builder { + + private String field; + private String message; + private String errorId; + + public Builder(String message, String errorId) { + this.message = message; + this.errorId = errorId; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public CreateVerifiedSender400ResponseErrorsInner build() { + return new CreateVerifiedSender400ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateVerifiedSender400ResponseErrorsInner.class.getSimpleName() + + "(", + ")" + ); + if (field != null) joiner.add("field=" + field); + if (message != null) joiner.add("message=" + message); + if (errorId != null) joiner.add("errorId=" + errorId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/DeleteVerifiedSender403Response.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/DeleteVerifiedSender403Response.java new file mode 100644 index 00000000..d3c07f8c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/DeleteVerifiedSender403Response.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.verifiedsenders.models.DeleteVerifiedSender403ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteVerifiedSender403Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public DeleteVerifiedSender403Response() {} + + private DeleteVerifiedSender403Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors( + List errors + ) { + this.errors = errors; + return this; + } + + public DeleteVerifiedSender403Response build() { + return new DeleteVerifiedSender403Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteVerifiedSender403Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/DeleteVerifiedSender403ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/DeleteVerifiedSender403ResponseErrorsInner.java new file mode 100644 index 00000000..a9d2e1db --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/DeleteVerifiedSender403ResponseErrorsInner.java @@ -0,0 +1,73 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteVerifiedSender403ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_id") + @Getter + @Setter + private String errorId; + + public DeleteVerifiedSender403ResponseErrorsInner() {} + + private DeleteVerifiedSender403ResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.errorId = builder.errorId; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String errorId; + + public Builder(String message, String errorId) { + this.message = message; + this.errorId = errorId; + } + + public DeleteVerifiedSender403ResponseErrorsInner build() { + return new DeleteVerifiedSender403ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteVerifiedSender403ResponseErrorsInner.class.getSimpleName() + + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (errorId != null) joiner.add("errorId=" + errorId); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/DeleteVerifiedSender404Response.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/DeleteVerifiedSender404Response.java new file mode 100644 index 00000000..ac3b30e6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/DeleteVerifiedSender404Response.java @@ -0,0 +1,66 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.verifiedsenders.models.DeleteVerifiedSender403ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class DeleteVerifiedSender404Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public DeleteVerifiedSender404Response() {} + + private DeleteVerifiedSender404Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder( + List errors + ) { + this.errors = errors; + } + + public DeleteVerifiedSender404Response build() { + return new DeleteVerifiedSender404Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + DeleteVerifiedSender404Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ErrorResponse.java new file mode 100644 index 00000000..970d9a06 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.verifiedsenders.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..706c4b92 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ListVerifiedSender200Response.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ListVerifiedSender200Response.java new file mode 100644 index 00000000..30abe82b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ListVerifiedSender200Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.verifiedsenders.models.VerifiedSenderResponse; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListVerifiedSender200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("results") + @Getter + @Setter + private List results; + + public ListVerifiedSender200Response() {} + + private ListVerifiedSender200Response(Builder builder) { + this.results = builder.results; + } + + // Builder class for constructing object + public static class Builder { + + private List results; + + public Builder() {} + + public Builder results(List results) { + this.results = results; + return this; + } + + public ListVerifiedSender200Response build() { + return new ListVerifiedSender200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListVerifiedSender200Response.class.getSimpleName() + "(", + ")" + ); + if (results != null) joiner.add("results=" + results); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ListVerifiedSenderDomain200Response.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ListVerifiedSenderDomain200Response.java new file mode 100644 index 00000000..ff417899 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ListVerifiedSenderDomain200Response.java @@ -0,0 +1,63 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.verifiedsenders.models.ListVerifiedSenderDomain200ResponseResults; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListVerifiedSenderDomain200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("results") + @Getter + @Setter + private ListVerifiedSenderDomain200ResponseResults results; + + public ListVerifiedSenderDomain200Response() {} + + private ListVerifiedSenderDomain200Response(Builder builder) { + this.results = builder.results; + } + + // Builder class for constructing object + public static class Builder { + + private ListVerifiedSenderDomain200ResponseResults results; + + public Builder(ListVerifiedSenderDomain200ResponseResults results) { + this.results = results; + } + + public ListVerifiedSenderDomain200Response build() { + return new ListVerifiedSenderDomain200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListVerifiedSenderDomain200Response.class.getSimpleName() + "(", + ")" + ); + if (results != null) joiner.add("results=" + results); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ListVerifiedSenderDomain200ResponseResults.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ListVerifiedSenderDomain200ResponseResults.java new file mode 100644 index 00000000..dd09563f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ListVerifiedSenderDomain200ResponseResults.java @@ -0,0 +1,74 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListVerifiedSenderDomain200ResponseResults { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("soft_failures") + @Getter + @Setter + private List softFailures; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("hard_failures") + @Getter + @Setter + private List hardFailures; + + public ListVerifiedSenderDomain200ResponseResults() {} + + private ListVerifiedSenderDomain200ResponseResults(Builder builder) { + this.softFailures = builder.softFailures; + this.hardFailures = builder.hardFailures; + } + + // Builder class for constructing object + public static class Builder { + + private List softFailures; + private List hardFailures; + + public Builder(List softFailures, List hardFailures) { + this.softFailures = softFailures; + this.hardFailures = hardFailures; + } + + public ListVerifiedSenderDomain200ResponseResults build() { + return new ListVerifiedSenderDomain200ResponseResults(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListVerifiedSenderDomain200ResponseResults.class.getSimpleName() + + "(", + ")" + ); + if (softFailures != null) joiner.add("softFailures=" + softFailures); + if (hardFailures != null) joiner.add("hardFailures=" + hardFailures); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ListVerifiedSenderStepsCompleted200Response.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ListVerifiedSenderStepsCompleted200Response.java new file mode 100644 index 00000000..c2a6ef02 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ListVerifiedSenderStepsCompleted200Response.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.verifiedsenders.models.ListVerifiedSenderStepsCompleted200ResponseResults; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListVerifiedSenderStepsCompleted200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("results") + @Getter + @Setter + private ListVerifiedSenderStepsCompleted200ResponseResults results; + + public ListVerifiedSenderStepsCompleted200Response() {} + + private ListVerifiedSenderStepsCompleted200Response(Builder builder) { + this.results = builder.results; + } + + // Builder class for constructing object + public static class Builder { + + private ListVerifiedSenderStepsCompleted200ResponseResults results; + + public Builder() {} + + public Builder results( + ListVerifiedSenderStepsCompleted200ResponseResults results + ) { + this.results = results; + return this; + } + + public ListVerifiedSenderStepsCompleted200Response build() { + return new ListVerifiedSenderStepsCompleted200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListVerifiedSenderStepsCompleted200Response.class.getSimpleName() + + "(", + ")" + ); + if (results != null) joiner.add("results=" + results); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ListVerifiedSenderStepsCompleted200ResponseResults.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ListVerifiedSenderStepsCompleted200ResponseResults.java new file mode 100644 index 00000000..ec9a8005 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/ListVerifiedSenderStepsCompleted200ResponseResults.java @@ -0,0 +1,86 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListVerifiedSenderStepsCompleted200ResponseResults { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sender_verified") + @Getter + @Setter + private Boolean senderVerified; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("domain_verified") + @Getter + @Setter + private Boolean domainVerified; + + public ListVerifiedSenderStepsCompleted200ResponseResults() {} + + private ListVerifiedSenderStepsCompleted200ResponseResults( + Builder builder + ) { + this.senderVerified = builder.senderVerified; + this.domainVerified = builder.domainVerified; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean senderVerified; + private Boolean domainVerified; + + public Builder() {} + + public Builder senderVerified(Boolean senderVerified) { + this.senderVerified = senderVerified; + return this; + } + + public Builder domainVerified(Boolean domainVerified) { + this.domainVerified = domainVerified; + return this; + } + + public ListVerifiedSenderStepsCompleted200ResponseResults build() { + return new ListVerifiedSenderStepsCompleted200ResponseResults(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListVerifiedSenderStepsCompleted200ResponseResults.class.getSimpleName() + + "(", + ")" + ); + if (senderVerified != null) joiner.add( + "senderVerified=" + senderVerified + ); + if (domainVerified != null) joiner.add( + "domainVerified=" + domainVerified + ); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/VerifiedSenderRequest.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/VerifiedSenderRequest.java new file mode 100644 index 00000000..86786f8c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/VerifiedSenderRequest.java @@ -0,0 +1,194 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class VerifiedSenderRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("nickname") + @Getter + @Setter + private String nickname; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("from_email") + @Getter + @Setter + private String fromEmail; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("from_name") + @Getter + @Setter + private String fromName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reply_to") + @Getter + @Setter + private String replyTo; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reply_to_name") + @Getter + @Setter + private String replyToName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address") + @Getter + @Setter + private String address; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address2") + @Getter + @Setter + private String address2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state") + @Getter + @Setter + private String state; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city") + @Getter + @Setter + private String city; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("zip") + @Getter + @Setter + private String zip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country") + @Getter + @Setter + private String country; + + public VerifiedSenderRequest() {} + + private VerifiedSenderRequest(Builder builder) { + this.nickname = builder.nickname; + this.fromEmail = builder.fromEmail; + this.fromName = builder.fromName; + this.replyTo = builder.replyTo; + this.replyToName = builder.replyToName; + this.address = builder.address; + this.address2 = builder.address2; + this.state = builder.state; + this.city = builder.city; + this.zip = builder.zip; + this.country = builder.country; + } + + // Builder class for constructing object + public static class Builder { + + private String nickname; + private String fromEmail; + private String fromName; + private String replyTo; + private String replyToName; + private String address; + private String address2; + private String state; + private String city; + private String zip; + private String country; + + public Builder(String nickname, String fromEmail, String replyTo) { + this.nickname = nickname; + this.fromEmail = fromEmail; + this.replyTo = replyTo; + } + + public Builder fromName(String fromName) { + this.fromName = fromName; + return this; + } + + public Builder replyToName(String replyToName) { + this.replyToName = replyToName; + return this; + } + + public Builder address(String address) { + this.address = address; + return this; + } + + public Builder address2(String address2) { + this.address2 = address2; + return this; + } + + public Builder state(String state) { + this.state = state; + return this; + } + + public Builder city(String city) { + this.city = city; + return this; + } + + public Builder zip(String zip) { + this.zip = zip; + return this; + } + + public Builder country(String country) { + this.country = country; + return this; + } + + public VerifiedSenderRequest build() { + return new VerifiedSenderRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + VerifiedSenderRequest.class.getSimpleName() + "(", + ")" + ); + if (nickname != null) joiner.add("nickname=" + nickname); + if (fromEmail != null) joiner.add("fromEmail=" + fromEmail); + if (fromName != null) joiner.add("fromName=" + fromName); + if (replyTo != null) joiner.add("replyTo=" + replyTo); + if (replyToName != null) joiner.add("replyToName=" + replyToName); + if (address != null) joiner.add("address=" + address); + if (address2 != null) joiner.add("address2=" + address2); + if (state != null) joiner.add("state=" + state); + if (city != null) joiner.add("city=" + city); + if (zip != null) joiner.add("zip=" + zip); + if (country != null) joiner.add("country=" + country); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/VerifiedSenderResponse.java b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/VerifiedSenderResponse.java new file mode 100644 index 00000000..48f19cf6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/verifiedsenders/models/VerifiedSenderResponse.java @@ -0,0 +1,247 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Verified Senders API + * The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + * + * 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.verifiedsenders.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class VerifiedSenderResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private Integer id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("nickname") + @Getter + @Setter + private String nickname; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("from_email") + @Getter + @Setter + private String fromEmail; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("from_name") + @Getter + @Setter + private String fromName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reply_to") + @Getter + @Setter + private String replyTo; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reply_to_name") + @Getter + @Setter + private String replyToName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address") + @Getter + @Setter + private String address; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address2") + @Getter + @Setter + private String address2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state") + @Getter + @Setter + private String state; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city") + @Getter + @Setter + private String city; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("zip") + @Getter + @Setter + private String zip; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country") + @Getter + @Setter + private String country; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("verified") + @Getter + @Setter + private Boolean verified; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("locked") + @Getter + @Setter + private Boolean locked; + + public VerifiedSenderResponse() {} + + private VerifiedSenderResponse(Builder builder) { + this.id = builder.id; + this.nickname = builder.nickname; + this.fromEmail = builder.fromEmail; + this.fromName = builder.fromName; + this.replyTo = builder.replyTo; + this.replyToName = builder.replyToName; + this.address = builder.address; + this.address2 = builder.address2; + this.state = builder.state; + this.city = builder.city; + this.zip = builder.zip; + this.country = builder.country; + this.verified = builder.verified; + this.locked = builder.locked; + } + + // Builder class for constructing object + public static class Builder { + + private Integer id; + private String nickname; + private String fromEmail; + private String fromName; + private String replyTo; + private String replyToName; + private String address; + private String address2; + private String state; + private String city; + private String zip; + private String country; + private Boolean verified; + private Boolean locked; + + public Builder() {} + + public Builder id(Integer id) { + this.id = id; + return this; + } + + public Builder nickname(String nickname) { + this.nickname = nickname; + return this; + } + + public Builder fromEmail(String fromEmail) { + this.fromEmail = fromEmail; + return this; + } + + public Builder fromName(String fromName) { + this.fromName = fromName; + return this; + } + + public Builder replyTo(String replyTo) { + this.replyTo = replyTo; + return this; + } + + public Builder replyToName(String replyToName) { + this.replyToName = replyToName; + return this; + } + + public Builder address(String address) { + this.address = address; + return this; + } + + public Builder address2(String address2) { + this.address2 = address2; + return this; + } + + public Builder state(String state) { + this.state = state; + return this; + } + + public Builder city(String city) { + this.city = city; + return this; + } + + public Builder zip(String zip) { + this.zip = zip; + return this; + } + + public Builder country(String country) { + this.country = country; + return this; + } + + public Builder verified(Boolean verified) { + this.verified = verified; + return this; + } + + public Builder locked(Boolean locked) { + this.locked = locked; + return this; + } + + public VerifiedSenderResponse build() { + return new VerifiedSenderResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + VerifiedSenderResponse.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (nickname != null) joiner.add("nickname=" + nickname); + if (fromEmail != null) joiner.add("fromEmail=" + fromEmail); + if (fromName != null) joiner.add("fromName=" + fromName); + if (replyTo != null) joiner.add("replyTo=" + replyTo); + if (replyToName != null) joiner.add("replyToName=" + replyToName); + if (address != null) joiner.add("address=" + address); + if (address2 != null) joiner.add("address2=" + address2); + if (state != null) joiner.add("state=" + state); + if (city != null) joiner.add("city=" + city); + if (zip != null) joiner.add("zip=" + zip); + if (country != null) joiner.add("country=" + country); + if (verified != null) joiner.add("verified=" + verified); + if (locked != null) joiner.add("locked=" + locked); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/CreateEventWebhook.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/CreateEventWebhook.java new file mode 100644 index 00000000..8ebdb027 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/CreateEventWebhook.java @@ -0,0 +1,111 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks; + +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.webhooks.models.CreateEventWebhook400Response; +import com.sendgrid.rest.api.v3.webhooks.models.EventWebhookRequest; +import com.sendgrid.rest.api.v3.webhooks.models.EventWebhookUnsignedResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateEventWebhook extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private EventWebhookRequest eventWebhookRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/webhooks/event/settings"; + 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( + "CreateEventWebhook 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")) { + CreateEventWebhook400Response error = JsonUtil.fromJson( + response.getStream(), + CreateEventWebhook400Response.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(), + EventWebhookUnsignedResponse.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (eventWebhookRequest != null) { + request.addBody(JsonUtil.toJson(eventWebhookRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/CreateParseSetting.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/CreateParseSetting.java new file mode 100644 index 00000000..459e00df --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/CreateParseSetting.java @@ -0,0 +1,144 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks; + +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.webhooks.models.ErrorResponse; +import com.sendgrid.rest.api.v3.webhooks.models.ParseSetting; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class CreateParseSetting extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private ParseSetting parseSetting; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/user/webhooks/parse/settings"; + 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( + "CreateParseSetting 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), ParseSetting.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (parseSetting != null) { + request.addBody(JsonUtil.toJson(parseSetting)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/DeleteEventWebhook.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/DeleteEventWebhook.java new file mode 100644 index 00000000..f72e0d8f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/DeleteEventWebhook.java @@ -0,0 +1,99 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks; + +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.webhooks.models.GetSignedEventWebhook404Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteEventWebhook extends ApiKeyBase { + + private final String id; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/user/webhooks/event/settings/{id}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteEventWebhook creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + GetSignedEventWebhook404Response error = JsonUtil.fromJson( + response.getStream(), + GetSignedEventWebhook404Response.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 (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/DeleteParseSetting.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/DeleteParseSetting.java new file mode 100644 index 00000000..ddee0cc0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/DeleteParseSetting.java @@ -0,0 +1,142 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks; + +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.webhooks.models.ErrorResponse; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class DeleteParseSetting extends ApiKeyBase { + + private final String hostname; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/user/webhooks/parse/settings/{hostname}"; + Request request = new Request( + HttpMethod.DELETE, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "DeleteParseSetting 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), Object.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (hostname != null) { + request.addPathParam("hostname", hostname.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/GetEventWebhook.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/GetEventWebhook.java new file mode 100644 index 00000000..98d524a4 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/GetEventWebhook.java @@ -0,0 +1,119 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks; + +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.webhooks.models.EventWebhookNoDatesResponse; +import com.sendgrid.rest.api.v3.webhooks.models.GetSignedEventWebhook404Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetEventWebhook extends ApiKeyBase { + + private final String id; + + @Setter + private String include; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/webhooks/event/settings/{id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetEventWebhook creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + GetSignedEventWebhook404Response error = JsonUtil.fromJson( + response.getStream(), + GetSignedEventWebhook404Response.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(), + EventWebhookNoDatesResponse.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (include != null) { + request.addQueryParam("include", include.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/GetParseSetting.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/GetParseSetting.java new file mode 100644 index 00000000..3b99fe32 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/GetParseSetting.java @@ -0,0 +1,143 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks; + +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.webhooks.models.ErrorResponse; +import com.sendgrid.rest.api.v3.webhooks.models.ParseSetting; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetParseSetting extends ApiKeyBase { + + private final String hostname; + + @Setter + private String onBehalfOf; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/user/webhooks/parse/settings/{hostname}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetParseSetting 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), ParseSetting.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (hostname != null) { + request.addPathParam("hostname", hostname.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/GetSignedEventWebhook.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/GetSignedEventWebhook.java new file mode 100644 index 00000000..cf9f60cc --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/GetSignedEventWebhook.java @@ -0,0 +1,109 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks; + +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.webhooks.models.GetSignedEventWebhook200Response; +import com.sendgrid.rest.api.v3.webhooks.models.GetSignedEventWebhook404Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class GetSignedEventWebhook extends ApiKeyBase { + + private final String id; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/webhooks/event/settings/signed/{id}"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "GetSignedEventWebhook creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + GetSignedEventWebhook404Response error = JsonUtil.fromJson( + response.getStream(), + GetSignedEventWebhook404Response.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(), + GetSignedEventWebhook200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/ListEventWebhook.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/ListEventWebhook.java new file mode 100644 index 00000000..34d7f6d7 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/ListEventWebhook.java @@ -0,0 +1,95 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks; + +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.webhooks.models.EventWebhookAllResponse; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListEventWebhook extends ApiKeyBase { + + @Setter + private String include; + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/webhooks/event/settings/all"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListEventWebhook creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), + EventWebhookAllResponse.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (include != null) { + request.addQueryParam("include", include.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/ListParseSetting.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/ListParseSetting.java new file mode 100644 index 00000000..48fd1e4c --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/ListParseSetting.java @@ -0,0 +1,139 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks; + +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.webhooks.models.ErrorResponse; +import com.sendgrid.rest.api.v3.webhooks.models.ListParseSetting200Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListParseSetting extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/webhooks/parse/settings"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListParseSetting 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), + ListParseSetting200Response.class + ), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/ListParseStatic.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/ListParseStatic.java new file mode 100644 index 00000000..543065bf --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/ListParseStatic.java @@ -0,0 +1,117 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks; + +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.webhooks.models.AggregatedBy; +import com.sendgrid.rest.api.v3.webhooks.models.ListParseStatic200ResponseInner; +import com.sendgrid.util.JsonUtil; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class ListParseStatic extends ApiKeyBase { + + @Setter + private String limit; + + @Setter + private String offset; + + @Setter + private AggregatedBy aggregatedBy; + + private final String startDate; + + @Setter + private String endDate; + + @Setter + private String onBehalfOf; + + public ApiResponse> send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/webhooks/parse/stats"; + Request request = new Request( + HttpMethod.GET, + path, + Domains.API.toString() + ); + addQueryParams(request); + addHeaderParams(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ListParseStatic creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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(), List.class), + response.getHeaders() + ); + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (limit != null) { + request.addQueryParam("limit", limit.toString()); + } + if (offset != null) { + request.addQueryParam("offset", offset.toString()); + } + if (aggregatedBy != null) { + request.addQueryParam("aggregated_by", aggregatedBy.toString()); + } + if (startDate != null) { + request.addQueryParam("start_date", startDate.toString()); + } + if (endDate != null) { + request.addQueryParam("end_date", endDate.toString()); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/TestEventWebhook.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/TestEventWebhook.java new file mode 100644 index 00000000..8720ed28 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/TestEventWebhook.java @@ -0,0 +1,86 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks; + +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.webhooks.models.EventWebhookTestRequest; +import com.sendgrid.util.JsonUtil; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class TestEventWebhook extends ApiKeyBase { + + @Setter + private String onBehalfOf; + + @Setter + private EventWebhookTestRequest eventWebhookTestRequest; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/user/webhooks/event/test"; + 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( + "TestEventWebhook creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + 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 addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (eventWebhookTestRequest != null) { + request.addBody(JsonUtil.toJson(eventWebhookTestRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/UpdateEventWebhook.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/UpdateEventWebhook.java new file mode 100644 index 00000000..424c6da3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/UpdateEventWebhook.java @@ -0,0 +1,144 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks; + +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.webhooks.models.CreateEventWebhook400Response; +import com.sendgrid.rest.api.v3.webhooks.models.EventWebhookRequest; +import com.sendgrid.rest.api.v3.webhooks.models.EventWebhookUnsignedResponse; +import com.sendgrid.rest.api.v3.webhooks.models.GetSignedEventWebhook404Response; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateEventWebhook extends ApiKeyBase { + + private final String id; + + @Setter + private String include; + + @Setter + private String onBehalfOf; + + @Setter + private EventWebhookRequest eventWebhookRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/webhooks/event/settings/{id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addQueryParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateEventWebhook 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")) { + CreateEventWebhook400Response error = JsonUtil.fromJson( + response.getStream(), + CreateEventWebhook400Response.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + GetSignedEventWebhook404Response error = JsonUtil.fromJson( + response.getStream(), + GetSignedEventWebhook404Response.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(), + EventWebhookUnsignedResponse.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addQueryParams(Request request) { + if (include != null) { + request.addQueryParam("include", include.toString()); + } + } + + private void addBody(final Request request) { + if (eventWebhookRequest != null) { + request.addBody(JsonUtil.toJson(eventWebhookRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/UpdateParseSetting.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/UpdateParseSetting.java new file mode 100644 index 00000000..26c3770b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/UpdateParseSetting.java @@ -0,0 +1,153 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks; + +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.webhooks.models.ErrorResponse; +import com.sendgrid.rest.api.v3.webhooks.models.ParseSetting; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateParseSetting extends ApiKeyBase { + + private final String hostname; + + @Setter + private String onBehalfOf; + + @Setter + private ParseSetting parseSetting; + + public ApiResponse send(final ApiKeyRestClient client) { + String path = "/v3/user/webhooks/parse/settings/{hostname}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateParseSetting 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")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "403")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "404")) { + ErrorResponse error = JsonUtil.fromJson( + response.getStream(), + ErrorResponse.class + ); + throw new ApiErrorResponse( + statusCode, + null, + error, + response.getHeaders() + ); + } + + if (Matcher.matches(Integer.toString(statusCode), "500")) { + 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(), ParseSetting.class), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (hostname != null) { + request.addPathParam("hostname", hostname.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (parseSetting != null) { + request.addBody(JsonUtil.toJson(parseSetting)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/UpdateSignedEventWebhook.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/UpdateSignedEventWebhook.java new file mode 100644 index 00000000..d76c9ed0 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/UpdateSignedEventWebhook.java @@ -0,0 +1,120 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks; + +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.webhooks.models.GetSignedEventWebhook200Response; +import com.sendgrid.rest.api.v3.webhooks.models.GetSignedEventWebhook404Response; +import com.sendgrid.rest.api.v3.webhooks.models.UpdateSignedEventWebhookRequest; +import com.sendgrid.util.JsonUtil; +import com.sendgrid.util.Matcher; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +@RequiredArgsConstructor +public class UpdateSignedEventWebhook extends ApiKeyBase { + + private final String id; + + @Setter + private String onBehalfOf; + + @Setter + private UpdateSignedEventWebhookRequest updateSignedEventWebhookRequest; + + public ApiResponse send( + final ApiKeyRestClient client + ) { + String path = "/v3/user/webhooks/event/settings/signed/{id}"; + Request request = new Request( + HttpMethod.PATCH, + path, + Domains.API.toString() + ); + addPathParams(request); + addHeaderParams(request); + addBody(request); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "UpdateSignedEventWebhook creation failed: Unable to connect to server" + ); + } else if ( + !ApplicationConstants.SUCCESS.test(response.getStatusCode()) + ) { + int statusCode = response.getStatusCode(); + if (Matcher.matches(Integer.toString(statusCode), "404")) { + GetSignedEventWebhook404Response error = JsonUtil.fromJson( + response.getStream(), + GetSignedEventWebhook404Response.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(), + GetSignedEventWebhook200Response.class + ), + response.getHeaders() + ); + } + + private void addPathParams(Request request) { + if (id != null) { + request.addPathParam("id", id.toString()); + } + } + + private void addHeaderParams(Request request) { + if (onBehalfOf != null) { + request.addHeaderParam("on-behalf-of", onBehalfOf.toString()); + } + } + + private void addBody(final Request request) { + if (updateSignedEventWebhookRequest != null) { + request.addBody(JsonUtil.toJson(updateSignedEventWebhookRequest)); + } + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/AggregatedBy.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/AggregatedBy.java new file mode 100644 index 00000000..31fc7d47 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/AggregatedBy.java @@ -0,0 +1,44 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.sendgrid.converter.Promoter; + +public enum AggregatedBy { + DAY("day"), + + WEEK("week"), + + MONTH("month"); + + private final String value; + + private AggregatedBy(final String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static AggregatedBy forValue(final String value) { + return Promoter.enumFromString(value, AggregatedBy.values()); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/CreateEventWebhook400Response.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/CreateEventWebhook400Response.java new file mode 100644 index 00000000..46884fbe --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/CreateEventWebhook400Response.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.webhooks.models.CreateEventWebhook400ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateEventWebhook400Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public CreateEventWebhook400Response() {} + + private CreateEventWebhook400Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors( + List errors + ) { + this.errors = errors; + return this; + } + + public CreateEventWebhook400Response build() { + return new CreateEventWebhook400Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateEventWebhook400Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/CreateEventWebhook400ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/CreateEventWebhook400ResponseErrorsInner.java new file mode 100644 index 00000000..d56d0672 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/CreateEventWebhook400ResponseErrorsInner.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class CreateEventWebhook400ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("url") + @Getter + @Setter + private String url; + + public CreateEventWebhook400ResponseErrorsInner() {} + + private CreateEventWebhook400ResponseErrorsInner(Builder builder) { + this.id = builder.id; + this.message = builder.message; + this.url = builder.url; + } + + // Builder class for constructing object + public static class Builder { + + private String id; + private String message; + private String url; + + public Builder() {} + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder url(String url) { + this.url = url; + return this; + } + + public CreateEventWebhook400ResponseErrorsInner build() { + return new CreateEventWebhook400ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + CreateEventWebhook400ResponseErrorsInner.class.getSimpleName() + + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (message != null) joiner.add("message=" + message); + if (url != null) joiner.add("url=" + url); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ErrorResponse.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ErrorResponse.java new file mode 100644 index 00000000..4bbe69a5 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ErrorResponse.java @@ -0,0 +1,81 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.webhooks.models.ErrorResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public ErrorResponse() {} + + private ErrorResponse(Builder builder) { + this.errors = builder.errors; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + private String id; + + public Builder() {} + + public Builder errors(List errors) { + this.errors = errors; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public ErrorResponse build() { + return new ErrorResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponse.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ErrorResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ErrorResponseErrorsInner.java new file mode 100644 index 00000000..3a74160b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ErrorResponseErrorsInner.java @@ -0,0 +1,93 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ErrorResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("help") + @Getter + @Setter + private Object help; + + public ErrorResponseErrorsInner() {} + + private ErrorResponseErrorsInner(Builder builder) { + this.message = builder.message; + this.field = builder.field; + this.help = builder.help; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + private String field; + private Object help; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder field(String field) { + this.field = field; + return this; + } + + public Builder help(Object help) { + this.help = help; + return this; + } + + public ErrorResponseErrorsInner build() { + return new ErrorResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ErrorResponseErrorsInner.class.getSimpleName() + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + if (field != null) joiner.add("field=" + field); + if (help != null) joiner.add("help=" + help); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookAllResponse.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookAllResponse.java new file mode 100644 index 00000000..342df500 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookAllResponse.java @@ -0,0 +1,82 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.webhooks.models.EventWebhookSignedResponse; +import java.math.BigDecimal; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class EventWebhookAllResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("max_allowed") + @Getter + @Setter + private BigDecimal maxAllowed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("webhooks") + @Getter + @Setter + private List webhooks; + + public EventWebhookAllResponse() {} + + private EventWebhookAllResponse(Builder builder) { + this.maxAllowed = builder.maxAllowed; + this.webhooks = builder.webhooks; + } + + // Builder class for constructing object + public static class Builder { + + private BigDecimal maxAllowed; + private List webhooks; + + public Builder() {} + + public Builder maxAllowed(BigDecimal maxAllowed) { + this.maxAllowed = maxAllowed; + return this; + } + + public Builder webhooks(List webhooks) { + this.webhooks = webhooks; + return this; + } + + public EventWebhookAllResponse build() { + return new EventWebhookAllResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + EventWebhookAllResponse.class.getSimpleName() + "(", + ")" + ); + if (maxAllowed != null) joiner.add("maxAllowed=" + maxAllowed); + if (webhooks != null) joiner.add("webhooks=" + webhooks); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookBaseResponseProps.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookBaseResponseProps.java new file mode 100644 index 00000000..fb5564d9 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookBaseResponseProps.java @@ -0,0 +1,281 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class EventWebhookBaseResponseProps { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("url") + @Getter + @Setter + private String url; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("account_status_change") + @Getter + @Setter + private Boolean accountStatusChange; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("group_resubscribe") + @Getter + @Setter + private Boolean groupResubscribe; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("delivered") + @Getter + @Setter + private Boolean delivered; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("group_unsubscribe") + @Getter + @Setter + private Boolean groupUnsubscribe; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_report") + @Getter + @Setter + private Boolean spamReport; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounce") + @Getter + @Setter + private Boolean bounce; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("deferred") + @Getter + @Setter + private Boolean deferred; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unsubscribe") + @Getter + @Setter + private Boolean unsubscribe; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("processed") + @Getter + @Setter + private Boolean processed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("open") + @Getter + @Setter + private Boolean open; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("click") + @Getter + @Setter + private Boolean click; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("dropped") + @Getter + @Setter + private Boolean dropped; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("friendly_name") + @Getter + @Setter + private String friendlyName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + public EventWebhookBaseResponseProps() {} + + private EventWebhookBaseResponseProps(Builder builder) { + this.enabled = builder.enabled; + this.url = builder.url; + this.accountStatusChange = builder.accountStatusChange; + this.groupResubscribe = builder.groupResubscribe; + this.delivered = builder.delivered; + this.groupUnsubscribe = builder.groupUnsubscribe; + this.spamReport = builder.spamReport; + this.bounce = builder.bounce; + this.deferred = builder.deferred; + this.unsubscribe = builder.unsubscribe; + this.processed = builder.processed; + this.open = builder.open; + this.click = builder.click; + this.dropped = builder.dropped; + this.friendlyName = builder.friendlyName; + this.id = builder.id; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + private String url; + private Boolean accountStatusChange; + private Boolean groupResubscribe; + private Boolean delivered; + private Boolean groupUnsubscribe; + private Boolean spamReport; + private Boolean bounce; + private Boolean deferred; + private Boolean unsubscribe; + private Boolean processed; + private Boolean open; + private Boolean click; + private Boolean dropped; + private String friendlyName; + private String id; + + public Builder() {} + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public Builder url(String url) { + this.url = url; + return this; + } + + public Builder accountStatusChange(Boolean accountStatusChange) { + this.accountStatusChange = accountStatusChange; + return this; + } + + public Builder groupResubscribe(Boolean groupResubscribe) { + this.groupResubscribe = groupResubscribe; + return this; + } + + public Builder delivered(Boolean delivered) { + this.delivered = delivered; + return this; + } + + public Builder groupUnsubscribe(Boolean groupUnsubscribe) { + this.groupUnsubscribe = groupUnsubscribe; + return this; + } + + public Builder spamReport(Boolean spamReport) { + this.spamReport = spamReport; + return this; + } + + public Builder bounce(Boolean bounce) { + this.bounce = bounce; + return this; + } + + public Builder deferred(Boolean deferred) { + this.deferred = deferred; + return this; + } + + public Builder unsubscribe(Boolean unsubscribe) { + this.unsubscribe = unsubscribe; + return this; + } + + public Builder processed(Boolean processed) { + this.processed = processed; + return this; + } + + public Builder open(Boolean open) { + this.open = open; + return this; + } + + public Builder click(Boolean click) { + this.click = click; + return this; + } + + public Builder dropped(Boolean dropped) { + this.dropped = dropped; + return this; + } + + public Builder friendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public EventWebhookBaseResponseProps build() { + return new EventWebhookBaseResponseProps(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + EventWebhookBaseResponseProps.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + if (url != null) joiner.add("url=" + url); + if (accountStatusChange != null) joiner.add( + "accountStatusChange=" + accountStatusChange + ); + if (groupResubscribe != null) joiner.add( + "groupResubscribe=" + groupResubscribe + ); + if (delivered != null) joiner.add("delivered=" + delivered); + if (groupUnsubscribe != null) joiner.add( + "groupUnsubscribe=" + groupUnsubscribe + ); + if (spamReport != null) joiner.add("spamReport=" + spamReport); + if (bounce != null) joiner.add("bounce=" + bounce); + if (deferred != null) joiner.add("deferred=" + deferred); + if (unsubscribe != null) joiner.add("unsubscribe=" + unsubscribe); + if (processed != null) joiner.add("processed=" + processed); + if (open != null) joiner.add("open=" + open); + if (click != null) joiner.add("click=" + click); + if (dropped != null) joiner.add("dropped=" + dropped); + if (friendlyName != null) joiner.add("friendlyName=" + friendlyName); + if (id != null) joiner.add("id=" + id); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookDateResponseProps.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookDateResponseProps.java new file mode 100644 index 00000000..2a4e1732 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookDateResponseProps.java @@ -0,0 +1,80 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class EventWebhookDateResponseProps { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_date") + @Getter + @Setter + private OffsetDateTime createdDate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_date") + @Getter + @Setter + private OffsetDateTime updatedDate; + + public EventWebhookDateResponseProps() {} + + private EventWebhookDateResponseProps(Builder builder) { + this.createdDate = builder.createdDate; + this.updatedDate = builder.updatedDate; + } + + // Builder class for constructing object + public static class Builder { + + private OffsetDateTime createdDate; + private OffsetDateTime updatedDate; + + public Builder() {} + + public Builder createdDate(OffsetDateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + public Builder updatedDate(OffsetDateTime updatedDate) { + this.updatedDate = updatedDate; + return this; + } + + public EventWebhookDateResponseProps build() { + return new EventWebhookDateResponseProps(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + EventWebhookDateResponseProps.class.getSimpleName() + "(", + ")" + ); + if (createdDate != null) joiner.add("createdDate=" + createdDate); + if (updatedDate != null) joiner.add("updatedDate=" + updatedDate); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookNoDatesResponse.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookNoDatesResponse.java new file mode 100644 index 00000000..8b0aa266 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookNoDatesResponse.java @@ -0,0 +1,323 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class EventWebhookNoDatesResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("url") + @Getter + @Setter + private String url; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("account_status_change") + @Getter + @Setter + private Boolean accountStatusChange; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("group_resubscribe") + @Getter + @Setter + private Boolean groupResubscribe; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("delivered") + @Getter + @Setter + private Boolean delivered; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("group_unsubscribe") + @Getter + @Setter + private Boolean groupUnsubscribe; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_report") + @Getter + @Setter + private Boolean spamReport; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounce") + @Getter + @Setter + private Boolean bounce; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("deferred") + @Getter + @Setter + private Boolean deferred; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unsubscribe") + @Getter + @Setter + private Boolean unsubscribe; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("processed") + @Getter + @Setter + private Boolean processed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("open") + @Getter + @Setter + private Boolean open; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("click") + @Getter + @Setter + private Boolean click; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("dropped") + @Getter + @Setter + private Boolean dropped; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("friendly_name") + @Getter + @Setter + private String friendlyName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("oauth_client_id") + @Getter + @Setter + private String oauthClientId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("oauth_token_url") + @Getter + @Setter + private String oauthTokenUrl; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("public_key") + @Getter + @Setter + private String publicKey; + + public EventWebhookNoDatesResponse() {} + + private EventWebhookNoDatesResponse(Builder builder) { + this.enabled = builder.enabled; + this.url = builder.url; + this.accountStatusChange = builder.accountStatusChange; + this.groupResubscribe = builder.groupResubscribe; + this.delivered = builder.delivered; + this.groupUnsubscribe = builder.groupUnsubscribe; + this.spamReport = builder.spamReport; + this.bounce = builder.bounce; + this.deferred = builder.deferred; + this.unsubscribe = builder.unsubscribe; + this.processed = builder.processed; + this.open = builder.open; + this.click = builder.click; + this.dropped = builder.dropped; + this.friendlyName = builder.friendlyName; + this.id = builder.id; + this.oauthClientId = builder.oauthClientId; + this.oauthTokenUrl = builder.oauthTokenUrl; + this.publicKey = builder.publicKey; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + private String url; + private Boolean accountStatusChange; + private Boolean groupResubscribe; + private Boolean delivered; + private Boolean groupUnsubscribe; + private Boolean spamReport; + private Boolean bounce; + private Boolean deferred; + private Boolean unsubscribe; + private Boolean processed; + private Boolean open; + private Boolean click; + private Boolean dropped; + private String friendlyName; + private String id; + private String oauthClientId; + private String oauthTokenUrl; + private String publicKey; + + public Builder() {} + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public Builder url(String url) { + this.url = url; + return this; + } + + public Builder accountStatusChange(Boolean accountStatusChange) { + this.accountStatusChange = accountStatusChange; + return this; + } + + public Builder groupResubscribe(Boolean groupResubscribe) { + this.groupResubscribe = groupResubscribe; + return this; + } + + public Builder delivered(Boolean delivered) { + this.delivered = delivered; + return this; + } + + public Builder groupUnsubscribe(Boolean groupUnsubscribe) { + this.groupUnsubscribe = groupUnsubscribe; + return this; + } + + public Builder spamReport(Boolean spamReport) { + this.spamReport = spamReport; + return this; + } + + public Builder bounce(Boolean bounce) { + this.bounce = bounce; + return this; + } + + public Builder deferred(Boolean deferred) { + this.deferred = deferred; + return this; + } + + public Builder unsubscribe(Boolean unsubscribe) { + this.unsubscribe = unsubscribe; + return this; + } + + public Builder processed(Boolean processed) { + this.processed = processed; + return this; + } + + public Builder open(Boolean open) { + this.open = open; + return this; + } + + public Builder click(Boolean click) { + this.click = click; + return this; + } + + public Builder dropped(Boolean dropped) { + this.dropped = dropped; + return this; + } + + public Builder friendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder oauthClientId(String oauthClientId) { + this.oauthClientId = oauthClientId; + return this; + } + + public Builder oauthTokenUrl(String oauthTokenUrl) { + this.oauthTokenUrl = oauthTokenUrl; + return this; + } + + public Builder publicKey(String publicKey) { + this.publicKey = publicKey; + return this; + } + + public EventWebhookNoDatesResponse build() { + return new EventWebhookNoDatesResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + EventWebhookNoDatesResponse.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + if (url != null) joiner.add("url=" + url); + if (accountStatusChange != null) joiner.add( + "accountStatusChange=" + accountStatusChange + ); + if (groupResubscribe != null) joiner.add( + "groupResubscribe=" + groupResubscribe + ); + if (delivered != null) joiner.add("delivered=" + delivered); + if (groupUnsubscribe != null) joiner.add( + "groupUnsubscribe=" + groupUnsubscribe + ); + if (spamReport != null) joiner.add("spamReport=" + spamReport); + if (bounce != null) joiner.add("bounce=" + bounce); + if (deferred != null) joiner.add("deferred=" + deferred); + if (unsubscribe != null) joiner.add("unsubscribe=" + unsubscribe); + if (processed != null) joiner.add("processed=" + processed); + if (open != null) joiner.add("open=" + open); + if (click != null) joiner.add("click=" + click); + if (dropped != null) joiner.add("dropped=" + dropped); + if (friendlyName != null) joiner.add("friendlyName=" + friendlyName); + if (id != null) joiner.add("id=" + id); + if (oauthClientId != null) joiner.add("oauthClientId=" + oauthClientId); + if (oauthTokenUrl != null) joiner.add("oauthTokenUrl=" + oauthTokenUrl); + if (publicKey != null) joiner.add("publicKey=" + publicKey); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookOauthResponseProps.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookOauthResponseProps.java new file mode 100644 index 00000000..72bcd689 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookOauthResponseProps.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class EventWebhookOauthResponseProps { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("oauth_client_id") + @Getter + @Setter + private String oauthClientId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("oauth_token_url") + @Getter + @Setter + private String oauthTokenUrl; + + public EventWebhookOauthResponseProps() {} + + private EventWebhookOauthResponseProps(Builder builder) { + this.oauthClientId = builder.oauthClientId; + this.oauthTokenUrl = builder.oauthTokenUrl; + } + + // Builder class for constructing object + public static class Builder { + + private String oauthClientId; + private String oauthTokenUrl; + + public Builder() {} + + public Builder oauthClientId(String oauthClientId) { + this.oauthClientId = oauthClientId; + return this; + } + + public Builder oauthTokenUrl(String oauthTokenUrl) { + this.oauthTokenUrl = oauthTokenUrl; + return this; + } + + public EventWebhookOauthResponseProps build() { + return new EventWebhookOauthResponseProps(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + EventWebhookOauthResponseProps.class.getSimpleName() + "(", + ")" + ); + if (oauthClientId != null) joiner.add("oauthClientId=" + oauthClientId); + if (oauthTokenUrl != null) joiner.add("oauthTokenUrl=" + oauthTokenUrl); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookRequest.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookRequest.java new file mode 100644 index 00000000..60c7bad6 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookRequest.java @@ -0,0 +1,292 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class EventWebhookRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("url") + @Getter + @Setter + private String url; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("group_resubscribe") + @Getter + @Setter + private Boolean groupResubscribe; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("delivered") + @Getter + @Setter + private Boolean delivered; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("group_unsubscribe") + @Getter + @Setter + private Boolean groupUnsubscribe; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_report") + @Getter + @Setter + private Boolean spamReport; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounce") + @Getter + @Setter + private Boolean bounce; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("deferred") + @Getter + @Setter + private Boolean deferred; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unsubscribe") + @Getter + @Setter + private Boolean unsubscribe; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("processed") + @Getter + @Setter + private Boolean processed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("open") + @Getter + @Setter + private Boolean open; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("click") + @Getter + @Setter + private Boolean click; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("dropped") + @Getter + @Setter + private Boolean dropped; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("friendly_name") + @Getter + @Setter + private String friendlyName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("oauth_client_id") + @Getter + @Setter + private String oauthClientId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("oauth_client_secret") + @Getter + @Setter + private String oauthClientSecret; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("oauth_token_url") + @Getter + @Setter + private String oauthTokenUrl; + + public EventWebhookRequest() {} + + private EventWebhookRequest(Builder builder) { + this.enabled = builder.enabled; + this.url = builder.url; + this.groupResubscribe = builder.groupResubscribe; + this.delivered = builder.delivered; + this.groupUnsubscribe = builder.groupUnsubscribe; + this.spamReport = builder.spamReport; + this.bounce = builder.bounce; + this.deferred = builder.deferred; + this.unsubscribe = builder.unsubscribe; + this.processed = builder.processed; + this.open = builder.open; + this.click = builder.click; + this.dropped = builder.dropped; + this.friendlyName = builder.friendlyName; + this.oauthClientId = builder.oauthClientId; + this.oauthClientSecret = builder.oauthClientSecret; + this.oauthTokenUrl = builder.oauthTokenUrl; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + private String url; + private Boolean groupResubscribe; + private Boolean delivered; + private Boolean groupUnsubscribe; + private Boolean spamReport; + private Boolean bounce; + private Boolean deferred; + private Boolean unsubscribe; + private Boolean processed; + private Boolean open; + private Boolean click; + private Boolean dropped; + private String friendlyName; + private String oauthClientId; + private String oauthClientSecret; + private String oauthTokenUrl; + + public Builder(String url) { + this.url = url; + } + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public Builder groupResubscribe(Boolean groupResubscribe) { + this.groupResubscribe = groupResubscribe; + return this; + } + + public Builder delivered(Boolean delivered) { + this.delivered = delivered; + return this; + } + + public Builder groupUnsubscribe(Boolean groupUnsubscribe) { + this.groupUnsubscribe = groupUnsubscribe; + return this; + } + + public Builder spamReport(Boolean spamReport) { + this.spamReport = spamReport; + return this; + } + + public Builder bounce(Boolean bounce) { + this.bounce = bounce; + return this; + } + + public Builder deferred(Boolean deferred) { + this.deferred = deferred; + return this; + } + + public Builder unsubscribe(Boolean unsubscribe) { + this.unsubscribe = unsubscribe; + return this; + } + + public Builder processed(Boolean processed) { + this.processed = processed; + return this; + } + + public Builder open(Boolean open) { + this.open = open; + return this; + } + + public Builder click(Boolean click) { + this.click = click; + return this; + } + + public Builder dropped(Boolean dropped) { + this.dropped = dropped; + return this; + } + + public Builder friendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + public Builder oauthClientId(String oauthClientId) { + this.oauthClientId = oauthClientId; + return this; + } + + public Builder oauthClientSecret(String oauthClientSecret) { + this.oauthClientSecret = oauthClientSecret; + return this; + } + + public Builder oauthTokenUrl(String oauthTokenUrl) { + this.oauthTokenUrl = oauthTokenUrl; + return this; + } + + public EventWebhookRequest build() { + return new EventWebhookRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + EventWebhookRequest.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + if (url != null) joiner.add("url=" + url); + if (groupResubscribe != null) joiner.add( + "groupResubscribe=" + groupResubscribe + ); + if (delivered != null) joiner.add("delivered=" + delivered); + if (groupUnsubscribe != null) joiner.add( + "groupUnsubscribe=" + groupUnsubscribe + ); + if (spamReport != null) joiner.add("spamReport=" + spamReport); + if (bounce != null) joiner.add("bounce=" + bounce); + if (deferred != null) joiner.add("deferred=" + deferred); + if (unsubscribe != null) joiner.add("unsubscribe=" + unsubscribe); + if (processed != null) joiner.add("processed=" + processed); + if (open != null) joiner.add("open=" + open); + if (click != null) joiner.add("click=" + click); + if (dropped != null) joiner.add("dropped=" + dropped); + if (friendlyName != null) joiner.add("friendlyName=" + friendlyName); + if (oauthClientId != null) joiner.add("oauthClientId=" + oauthClientId); + if (oauthClientSecret != null) joiner.add( + "oauthClientSecret=" + oauthClientSecret + ); + if (oauthTokenUrl != null) joiner.add("oauthTokenUrl=" + oauthTokenUrl); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookSignedResponse.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookSignedResponse.java new file mode 100644 index 00000000..960b3f7b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookSignedResponse.java @@ -0,0 +1,352 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class EventWebhookSignedResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("url") + @Getter + @Setter + private String url; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("account_status_change") + @Getter + @Setter + private Boolean accountStatusChange; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("group_resubscribe") + @Getter + @Setter + private Boolean groupResubscribe; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("delivered") + @Getter + @Setter + private Boolean delivered; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("group_unsubscribe") + @Getter + @Setter + private Boolean groupUnsubscribe; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_report") + @Getter + @Setter + private Boolean spamReport; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounce") + @Getter + @Setter + private Boolean bounce; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("deferred") + @Getter + @Setter + private Boolean deferred; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unsubscribe") + @Getter + @Setter + private Boolean unsubscribe; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("processed") + @Getter + @Setter + private Boolean processed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("open") + @Getter + @Setter + private Boolean open; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("click") + @Getter + @Setter + private Boolean click; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("dropped") + @Getter + @Setter + private Boolean dropped; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("friendly_name") + @Getter + @Setter + private String friendlyName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_date") + @Getter + @Setter + private OffsetDateTime createdDate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_date") + @Getter + @Setter + private OffsetDateTime updatedDate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("oauth_client_id") + @Getter + @Setter + private String oauthClientId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("oauth_token_url") + @Getter + @Setter + private String oauthTokenUrl; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("public_key") + @Getter + @Setter + private String publicKey; + + public EventWebhookSignedResponse() {} + + private EventWebhookSignedResponse(Builder builder) { + this.enabled = builder.enabled; + this.url = builder.url; + this.accountStatusChange = builder.accountStatusChange; + this.groupResubscribe = builder.groupResubscribe; + this.delivered = builder.delivered; + this.groupUnsubscribe = builder.groupUnsubscribe; + this.spamReport = builder.spamReport; + this.bounce = builder.bounce; + this.deferred = builder.deferred; + this.unsubscribe = builder.unsubscribe; + this.processed = builder.processed; + this.open = builder.open; + this.click = builder.click; + this.dropped = builder.dropped; + this.friendlyName = builder.friendlyName; + this.id = builder.id; + this.createdDate = builder.createdDate; + this.updatedDate = builder.updatedDate; + this.oauthClientId = builder.oauthClientId; + this.oauthTokenUrl = builder.oauthTokenUrl; + this.publicKey = builder.publicKey; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + private String url; + private Boolean accountStatusChange; + private Boolean groupResubscribe; + private Boolean delivered; + private Boolean groupUnsubscribe; + private Boolean spamReport; + private Boolean bounce; + private Boolean deferred; + private Boolean unsubscribe; + private Boolean processed; + private Boolean open; + private Boolean click; + private Boolean dropped; + private String friendlyName; + private String id; + private OffsetDateTime createdDate; + private OffsetDateTime updatedDate; + private String oauthClientId; + private String oauthTokenUrl; + private String publicKey; + + public Builder() {} + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public Builder url(String url) { + this.url = url; + return this; + } + + public Builder accountStatusChange(Boolean accountStatusChange) { + this.accountStatusChange = accountStatusChange; + return this; + } + + public Builder groupResubscribe(Boolean groupResubscribe) { + this.groupResubscribe = groupResubscribe; + return this; + } + + public Builder delivered(Boolean delivered) { + this.delivered = delivered; + return this; + } + + public Builder groupUnsubscribe(Boolean groupUnsubscribe) { + this.groupUnsubscribe = groupUnsubscribe; + return this; + } + + public Builder spamReport(Boolean spamReport) { + this.spamReport = spamReport; + return this; + } + + public Builder bounce(Boolean bounce) { + this.bounce = bounce; + return this; + } + + public Builder deferred(Boolean deferred) { + this.deferred = deferred; + return this; + } + + public Builder unsubscribe(Boolean unsubscribe) { + this.unsubscribe = unsubscribe; + return this; + } + + public Builder processed(Boolean processed) { + this.processed = processed; + return this; + } + + public Builder open(Boolean open) { + this.open = open; + return this; + } + + public Builder click(Boolean click) { + this.click = click; + return this; + } + + public Builder dropped(Boolean dropped) { + this.dropped = dropped; + return this; + } + + public Builder friendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder createdDate(OffsetDateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + public Builder updatedDate(OffsetDateTime updatedDate) { + this.updatedDate = updatedDate; + return this; + } + + public Builder oauthClientId(String oauthClientId) { + this.oauthClientId = oauthClientId; + return this; + } + + public Builder oauthTokenUrl(String oauthTokenUrl) { + this.oauthTokenUrl = oauthTokenUrl; + return this; + } + + public Builder publicKey(String publicKey) { + this.publicKey = publicKey; + return this; + } + + public EventWebhookSignedResponse build() { + return new EventWebhookSignedResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + EventWebhookSignedResponse.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + if (url != null) joiner.add("url=" + url); + if (accountStatusChange != null) joiner.add( + "accountStatusChange=" + accountStatusChange + ); + if (groupResubscribe != null) joiner.add( + "groupResubscribe=" + groupResubscribe + ); + if (delivered != null) joiner.add("delivered=" + delivered); + if (groupUnsubscribe != null) joiner.add( + "groupUnsubscribe=" + groupUnsubscribe + ); + if (spamReport != null) joiner.add("spamReport=" + spamReport); + if (bounce != null) joiner.add("bounce=" + bounce); + if (deferred != null) joiner.add("deferred=" + deferred); + if (unsubscribe != null) joiner.add("unsubscribe=" + unsubscribe); + if (processed != null) joiner.add("processed=" + processed); + if (open != null) joiner.add("open=" + open); + if (click != null) joiner.add("click=" + click); + if (dropped != null) joiner.add("dropped=" + dropped); + if (friendlyName != null) joiner.add("friendlyName=" + friendlyName); + if (id != null) joiner.add("id=" + id); + if (createdDate != null) joiner.add("createdDate=" + createdDate); + if (updatedDate != null) joiner.add("updatedDate=" + updatedDate); + if (oauthClientId != null) joiner.add("oauthClientId=" + oauthClientId); + if (oauthTokenUrl != null) joiner.add("oauthTokenUrl=" + oauthTokenUrl); + if (publicKey != null) joiner.add("publicKey=" + publicKey); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookSignedResponseProp.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookSignedResponseProp.java new file mode 100644 index 00000000..931cf851 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookSignedResponseProp.java @@ -0,0 +1,65 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class EventWebhookSignedResponseProp { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("public_key") + @Getter + @Setter + private String publicKey; + + public EventWebhookSignedResponseProp() {} + + private EventWebhookSignedResponseProp(Builder builder) { + this.publicKey = builder.publicKey; + } + + // Builder class for constructing object + public static class Builder { + + private String publicKey; + + public Builder() {} + + public Builder publicKey(String publicKey) { + this.publicKey = publicKey; + return this; + } + + public EventWebhookSignedResponseProp build() { + return new EventWebhookSignedResponseProp(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + EventWebhookSignedResponseProp.class.getSimpleName() + "(", + ")" + ); + if (publicKey != null) joiner.add("publicKey=" + publicKey); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookTestRequest.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookTestRequest.java new file mode 100644 index 00000000..d02bfe57 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookTestRequest.java @@ -0,0 +1,120 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class EventWebhookTestRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("url") + @Getter + @Setter + private String url; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("oauth_client_id") + @Getter + @Setter + private String oauthClientId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("oauth_client_secret") + @Getter + @Setter + private String oauthClientSecret; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("oauth_token_url") + @Getter + @Setter + private String oauthTokenUrl; + + public EventWebhookTestRequest() {} + + private EventWebhookTestRequest(Builder builder) { + this.id = builder.id; + this.url = builder.url; + this.oauthClientId = builder.oauthClientId; + this.oauthClientSecret = builder.oauthClientSecret; + this.oauthTokenUrl = builder.oauthTokenUrl; + } + + // Builder class for constructing object + public static class Builder { + + private String id; + private String url; + private String oauthClientId; + private String oauthClientSecret; + private String oauthTokenUrl; + + public Builder(String url) { + this.url = url; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder oauthClientId(String oauthClientId) { + this.oauthClientId = oauthClientId; + return this; + } + + public Builder oauthClientSecret(String oauthClientSecret) { + this.oauthClientSecret = oauthClientSecret; + return this; + } + + public Builder oauthTokenUrl(String oauthTokenUrl) { + this.oauthTokenUrl = oauthTokenUrl; + return this; + } + + public EventWebhookTestRequest build() { + return new EventWebhookTestRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + EventWebhookTestRequest.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (url != null) joiner.add("url=" + url); + if (oauthClientId != null) joiner.add("oauthClientId=" + oauthClientId); + if (oauthClientSecret != null) joiner.add( + "oauthClientSecret=" + oauthClientSecret + ); + if (oauthTokenUrl != null) joiner.add("oauthTokenUrl=" + oauthTokenUrl); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookUnsignedResponse.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookUnsignedResponse.java new file mode 100644 index 00000000..f0aec680 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/EventWebhookUnsignedResponse.java @@ -0,0 +1,338 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class EventWebhookUnsignedResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("url") + @Getter + @Setter + private String url; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("account_status_change") + @Getter + @Setter + private Boolean accountStatusChange; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("group_resubscribe") + @Getter + @Setter + private Boolean groupResubscribe; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("delivered") + @Getter + @Setter + private Boolean delivered; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("group_unsubscribe") + @Getter + @Setter + private Boolean groupUnsubscribe; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_report") + @Getter + @Setter + private Boolean spamReport; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bounce") + @Getter + @Setter + private Boolean bounce; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("deferred") + @Getter + @Setter + private Boolean deferred; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("unsubscribe") + @Getter + @Setter + private Boolean unsubscribe; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("processed") + @Getter + @Setter + private Boolean processed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("open") + @Getter + @Setter + private Boolean open; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("click") + @Getter + @Setter + private Boolean click; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("dropped") + @Getter + @Setter + private Boolean dropped; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("friendly_name") + @Getter + @Setter + private String friendlyName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("created_date") + @Getter + @Setter + private OffsetDateTime createdDate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updated_date") + @Getter + @Setter + private OffsetDateTime updatedDate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("oauth_client_id") + @Getter + @Setter + private String oauthClientId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("oauth_token_url") + @Getter + @Setter + private String oauthTokenUrl; + + public EventWebhookUnsignedResponse() {} + + private EventWebhookUnsignedResponse(Builder builder) { + this.enabled = builder.enabled; + this.url = builder.url; + this.accountStatusChange = builder.accountStatusChange; + this.groupResubscribe = builder.groupResubscribe; + this.delivered = builder.delivered; + this.groupUnsubscribe = builder.groupUnsubscribe; + this.spamReport = builder.spamReport; + this.bounce = builder.bounce; + this.deferred = builder.deferred; + this.unsubscribe = builder.unsubscribe; + this.processed = builder.processed; + this.open = builder.open; + this.click = builder.click; + this.dropped = builder.dropped; + this.friendlyName = builder.friendlyName; + this.id = builder.id; + this.createdDate = builder.createdDate; + this.updatedDate = builder.updatedDate; + this.oauthClientId = builder.oauthClientId; + this.oauthTokenUrl = builder.oauthTokenUrl; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + private String url; + private Boolean accountStatusChange; + private Boolean groupResubscribe; + private Boolean delivered; + private Boolean groupUnsubscribe; + private Boolean spamReport; + private Boolean bounce; + private Boolean deferred; + private Boolean unsubscribe; + private Boolean processed; + private Boolean open; + private Boolean click; + private Boolean dropped; + private String friendlyName; + private String id; + private OffsetDateTime createdDate; + private OffsetDateTime updatedDate; + private String oauthClientId; + private String oauthTokenUrl; + + public Builder() {} + + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public Builder url(String url) { + this.url = url; + return this; + } + + public Builder accountStatusChange(Boolean accountStatusChange) { + this.accountStatusChange = accountStatusChange; + return this; + } + + public Builder groupResubscribe(Boolean groupResubscribe) { + this.groupResubscribe = groupResubscribe; + return this; + } + + public Builder delivered(Boolean delivered) { + this.delivered = delivered; + return this; + } + + public Builder groupUnsubscribe(Boolean groupUnsubscribe) { + this.groupUnsubscribe = groupUnsubscribe; + return this; + } + + public Builder spamReport(Boolean spamReport) { + this.spamReport = spamReport; + return this; + } + + public Builder bounce(Boolean bounce) { + this.bounce = bounce; + return this; + } + + public Builder deferred(Boolean deferred) { + this.deferred = deferred; + return this; + } + + public Builder unsubscribe(Boolean unsubscribe) { + this.unsubscribe = unsubscribe; + return this; + } + + public Builder processed(Boolean processed) { + this.processed = processed; + return this; + } + + public Builder open(Boolean open) { + this.open = open; + return this; + } + + public Builder click(Boolean click) { + this.click = click; + return this; + } + + public Builder dropped(Boolean dropped) { + this.dropped = dropped; + return this; + } + + public Builder friendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder createdDate(OffsetDateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + public Builder updatedDate(OffsetDateTime updatedDate) { + this.updatedDate = updatedDate; + return this; + } + + public Builder oauthClientId(String oauthClientId) { + this.oauthClientId = oauthClientId; + return this; + } + + public Builder oauthTokenUrl(String oauthTokenUrl) { + this.oauthTokenUrl = oauthTokenUrl; + return this; + } + + public EventWebhookUnsignedResponse build() { + return new EventWebhookUnsignedResponse(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + EventWebhookUnsignedResponse.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + if (url != null) joiner.add("url=" + url); + if (accountStatusChange != null) joiner.add( + "accountStatusChange=" + accountStatusChange + ); + if (groupResubscribe != null) joiner.add( + "groupResubscribe=" + groupResubscribe + ); + if (delivered != null) joiner.add("delivered=" + delivered); + if (groupUnsubscribe != null) joiner.add( + "groupUnsubscribe=" + groupUnsubscribe + ); + if (spamReport != null) joiner.add("spamReport=" + spamReport); + if (bounce != null) joiner.add("bounce=" + bounce); + if (deferred != null) joiner.add("deferred=" + deferred); + if (unsubscribe != null) joiner.add("unsubscribe=" + unsubscribe); + if (processed != null) joiner.add("processed=" + processed); + if (open != null) joiner.add("open=" + open); + if (click != null) joiner.add("click=" + click); + if (dropped != null) joiner.add("dropped=" + dropped); + if (friendlyName != null) joiner.add("friendlyName=" + friendlyName); + if (id != null) joiner.add("id=" + id); + if (createdDate != null) joiner.add("createdDate=" + createdDate); + if (updatedDate != null) joiner.add("updatedDate=" + updatedDate); + if (oauthClientId != null) joiner.add("oauthClientId=" + oauthClientId); + if (oauthTokenUrl != null) joiner.add("oauthTokenUrl=" + oauthTokenUrl); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/GetSignedEventWebhook200Response.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/GetSignedEventWebhook200Response.java new file mode 100644 index 00000000..01baaf4f --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/GetSignedEventWebhook200Response.java @@ -0,0 +1,79 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetSignedEventWebhook200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + @Setter + private String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("public_key") + @Getter + @Setter + private String publicKey; + + public GetSignedEventWebhook200Response() {} + + private GetSignedEventWebhook200Response(Builder builder) { + this.id = builder.id; + this.publicKey = builder.publicKey; + } + + // Builder class for constructing object + public static class Builder { + + private String id; + private String publicKey; + + public Builder() {} + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder publicKey(String publicKey) { + this.publicKey = publicKey; + return this; + } + + public GetSignedEventWebhook200Response build() { + return new GetSignedEventWebhook200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetSignedEventWebhook200Response.class.getSimpleName() + "(", + ")" + ); + if (id != null) joiner.add("id=" + id); + if (publicKey != null) joiner.add("publicKey=" + publicKey); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/GetSignedEventWebhook404Response.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/GetSignedEventWebhook404Response.java new file mode 100644 index 00000000..815275de --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/GetSignedEventWebhook404Response.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.webhooks.models.GetSignedEventWebhook404ResponseErrorsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetSignedEventWebhook404Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("errors") + @Getter + @Setter + private List errors; + + public GetSignedEventWebhook404Response() {} + + private GetSignedEventWebhook404Response(Builder builder) { + this.errors = builder.errors; + } + + // Builder class for constructing object + public static class Builder { + + private List errors; + + public Builder() {} + + public Builder errors( + List errors + ) { + this.errors = errors; + return this; + } + + public GetSignedEventWebhook404Response build() { + return new GetSignedEventWebhook404Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetSignedEventWebhook404Response.class.getSimpleName() + "(", + ")" + ); + if (errors != null) joiner.add("errors=" + errors); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/GetSignedEventWebhook404ResponseErrorsInner.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/GetSignedEventWebhook404ResponseErrorsInner.java new file mode 100644 index 00000000..c94e329b --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/GetSignedEventWebhook404ResponseErrorsInner.java @@ -0,0 +1,66 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class GetSignedEventWebhook404ResponseErrorsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("message") + @Getter + @Setter + private String message; + + public GetSignedEventWebhook404ResponseErrorsInner() {} + + private GetSignedEventWebhook404ResponseErrorsInner(Builder builder) { + this.message = builder.message; + } + + // Builder class for constructing object + public static class Builder { + + private String message; + + public Builder() {} + + public Builder message(String message) { + this.message = message; + return this; + } + + public GetSignedEventWebhook404ResponseErrorsInner build() { + return new GetSignedEventWebhook404ResponseErrorsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + GetSignedEventWebhook404ResponseErrorsInner.class.getSimpleName() + + "(", + ")" + ); + if (message != null) joiner.add("message=" + message); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ListParseSetting200Response.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ListParseSetting200Response.java new file mode 100644 index 00000000..67cb3958 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ListParseSetting200Response.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.webhooks.models.ParseSetting; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListParseSetting200Response { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("result") + @Getter + @Setter + private List result; + + public ListParseSetting200Response() {} + + private ListParseSetting200Response(Builder builder) { + this.result = builder.result; + } + + // Builder class for constructing object + public static class Builder { + + private List result; + + public Builder() {} + + public Builder result(List result) { + this.result = result; + return this; + } + + public ListParseSetting200Response build() { + return new ListParseSetting200Response(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListParseSetting200Response.class.getSimpleName() + "(", + ")" + ); + if (result != null) joiner.add("result=" + result); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ListParseStatic200ResponseInner.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ListParseStatic200ResponseInner.java new file mode 100644 index 00000000..131cc5f3 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ListParseStatic200ResponseInner.java @@ -0,0 +1,77 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.webhooks.models.ListParseStatic200ResponseInnerStatsInner; +import java.util.List; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListParseStatic200ResponseInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("date") + @Getter + @Setter + private String date; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("stats") + @Getter + @Setter + private List stats; + + public ListParseStatic200ResponseInner() {} + + private ListParseStatic200ResponseInner(Builder builder) { + this.date = builder.date; + this.stats = builder.stats; + } + + // Builder class for constructing object + public static class Builder { + + private String date; + private List stats; + + public Builder( + String date, + List stats + ) { + this.date = date; + this.stats = stats; + } + + public ListParseStatic200ResponseInner build() { + return new ListParseStatic200ResponseInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListParseStatic200ResponseInner.class.getSimpleName() + "(", + ")" + ); + if (date != null) joiner.add("date=" + date); + if (stats != null) joiner.add("stats=" + stats); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ListParseStatic200ResponseInnerStatsInner.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ListParseStatic200ResponseInnerStatsInner.java new file mode 100644 index 00000000..5ad97b7a --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ListParseStatic200ResponseInnerStatsInner.java @@ -0,0 +1,69 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.sendgrid.rest.api.v3.webhooks.models.ListParseStatic200ResponseInnerStatsInnerMetrics; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListParseStatic200ResponseInnerStatsInner { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metrics") + @Getter + @Setter + private ListParseStatic200ResponseInnerStatsInnerMetrics metrics; + + public ListParseStatic200ResponseInnerStatsInner() {} + + private ListParseStatic200ResponseInnerStatsInner(Builder builder) { + this.metrics = builder.metrics; + } + + // Builder class for constructing object + public static class Builder { + + private ListParseStatic200ResponseInnerStatsInnerMetrics metrics; + + public Builder() {} + + public Builder metrics( + ListParseStatic200ResponseInnerStatsInnerMetrics metrics + ) { + this.metrics = metrics; + return this; + } + + public ListParseStatic200ResponseInnerStatsInner build() { + return new ListParseStatic200ResponseInnerStatsInner(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListParseStatic200ResponseInnerStatsInner.class.getSimpleName() + + "(", + ")" + ); + if (metrics != null) joiner.add("metrics=" + metrics); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ListParseStatic200ResponseInnerStatsInnerMetrics.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ListParseStatic200ResponseInnerStatsInnerMetrics.java new file mode 100644 index 00000000..8abbc490 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ListParseStatic200ResponseInnerStatsInnerMetrics.java @@ -0,0 +1,64 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ListParseStatic200ResponseInnerStatsInnerMetrics { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("received") + @Getter + @Setter + private BigDecimal received; + + public ListParseStatic200ResponseInnerStatsInnerMetrics() {} + + private ListParseStatic200ResponseInnerStatsInnerMetrics(Builder builder) { + this.received = builder.received; + } + + // Builder class for constructing object + public static class Builder { + + private BigDecimal received; + + public Builder(BigDecimal received) { + this.received = received; + } + + public ListParseStatic200ResponseInnerStatsInnerMetrics build() { + return new ListParseStatic200ResponseInnerStatsInnerMetrics(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ListParseStatic200ResponseInnerStatsInnerMetrics.class.getSimpleName() + + "(", + ")" + ); + if (received != null) joiner.add("received=" + received); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ParseSetting.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ParseSetting.java new file mode 100644 index 00000000..845f32c2 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/ParseSetting.java @@ -0,0 +1,107 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class ParseSetting { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("url") + @Getter + @Setter + private String url; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("hostname") + @Getter + @Setter + private String hostname; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("spam_check") + @Getter + @Setter + private Boolean spamCheck; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("send_raw") + @Getter + @Setter + private Boolean sendRaw; + + public ParseSetting() {} + + private ParseSetting(Builder builder) { + this.url = builder.url; + this.hostname = builder.hostname; + this.spamCheck = builder.spamCheck; + this.sendRaw = builder.sendRaw; + } + + // Builder class for constructing object + public static class Builder { + + private String url; + private String hostname; + private Boolean spamCheck; + private Boolean sendRaw; + + public Builder() {} + + public Builder url(String url) { + this.url = url; + return this; + } + + public Builder hostname(String hostname) { + this.hostname = hostname; + return this; + } + + public Builder spamCheck(Boolean spamCheck) { + this.spamCheck = spamCheck; + return this; + } + + public Builder sendRaw(Boolean sendRaw) { + this.sendRaw = sendRaw; + return this; + } + + public ParseSetting build() { + return new ParseSetting(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + ParseSetting.class.getSimpleName() + "(", + ")" + ); + if (url != null) joiner.add("url=" + url); + if (hostname != null) joiner.add("hostname=" + hostname); + if (spamCheck != null) joiner.add("spamCheck=" + spamCheck); + if (sendRaw != null) joiner.add("sendRaw=" + sendRaw); + return joiner.toString(); + } +} diff --git a/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/UpdateSignedEventWebhookRequest.java b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/UpdateSignedEventWebhookRequest.java new file mode 100644 index 00000000..1421b6d1 --- /dev/null +++ b/src/main/java/com/sendgrid/rest/api/v3/webhooks/models/UpdateSignedEventWebhookRequest.java @@ -0,0 +1,62 @@ +/* + * This code was generated by + * + * SENDGRID-OAI-GENERATOR + * + * Twilio SendGrid Webhook Configuration API + * The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + * + * 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.webhooks.models; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.StringJoiner; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +public class UpdateSignedEventWebhookRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("enabled") + @Getter + @Setter + private Boolean enabled; + + public UpdateSignedEventWebhookRequest() {} + + private UpdateSignedEventWebhookRequest(Builder builder) { + this.enabled = builder.enabled; + } + + // Builder class for constructing object + public static class Builder { + + private Boolean enabled; + + public Builder(Boolean enabled) { + this.enabled = enabled; + } + + public UpdateSignedEventWebhookRequest build() { + return new UpdateSignedEventWebhookRequest(this); + } + } + + @Override + public String toString() { + StringJoiner joiner = new StringJoiner( + ", ", + UpdateSignedEventWebhookRequest.class.getSimpleName() + "(", + ")" + ); + if (enabled != null) joiner.add("enabled=" + enabled); + return joiner.toString(); + } +} diff --git a/src/test/java/com/sendgrid/SendGridTest.java b/src/test/java/com/sendgrid/SendGridTest.java index c9d13a41..da81f915 100644 --- a/src/test/java/com/sendgrid/SendGridTest.java +++ b/src/test/java/com/sendgrid/SendGridTest.java @@ -43,7 +43,7 @@ public void testConstructWithClient() throws IOException { @Test public void testLibraryVersion() { SendGrid sg = new SendGrid(SENDGRID_API_KEY); - Assert.assertEquals(sg.getLibraryVersion(), "5.0.0-rc.0"); + Assert.assertEquals(sg.getLibraryVersion(), "5.0.0-rc.1"); } @Test