Skip to content

Commit

Permalink
mvn spotless applied.
Browse files Browse the repository at this point in the history
  • Loading branch information
ib-tjuhasz committed Dec 12, 2024
1 parent adaa85e commit 9153c12
Show file tree
Hide file tree
Showing 13 changed files with 2,074 additions and 2,095 deletions.
73 changes: 39 additions & 34 deletions src/main/java/com/infobip/api/FormsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* or contact us @ [email protected].
*/


package com.infobip.api;

import com.fasterxml.jackson.core.type.TypeReference;
Expand All @@ -16,7 +15,6 @@
import com.infobip.model.FormsResponseContent;
import com.infobip.model.FormsStatus;
import com.infobip.model.FormsStatusResponse;

import java.util.Map;
import java.util.Objects;

Expand All @@ -38,8 +36,8 @@ public FormsApi(ApiClient apiClient) {

private RequestDefinition getFormDefinition(String id) {
RequestDefinition.Builder builder = RequestDefinition.builder("GET", "/forms/1/forms/{id}")
.requiresAuthentication(true)
.accept("application/json");
.requiresAuthentication(true)
.accept("application/json");

if (id != null) {
builder.addPathParameter(new Parameter("id", id));
Expand All @@ -57,7 +55,6 @@ private GetFormRequest(String id) {
this.id = Objects.requireNonNull(id, "The required parameter 'id' is missing.");
}


/**
* Executes the getForm request.
*
Expand All @@ -66,7 +63,7 @@ private GetFormRequest(String id) {
*/
public FormsResponseContent execute() throws ApiException {
RequestDefinition getFormDefinition = getFormDefinition(id);
return apiClient.execute(getFormDefinition, new TypeReference<FormsResponseContent>(){}.getType());
return apiClient.execute(getFormDefinition, new TypeReference<FormsResponseContent>() {}.getType());
}

/**
Expand All @@ -77,25 +74,28 @@ public FormsResponseContent execute() throws ApiException {
*/
public okhttp3.Call executeAsync(ApiCallback<FormsResponseContent> callback) {
RequestDefinition getFormDefinition = getFormDefinition(id);
return apiClient.executeAsync(getFormDefinition, new TypeReference<FormsResponseContent>(){}.getType(), callback);
return apiClient.executeAsync(
getFormDefinition, new TypeReference<FormsResponseContent>() {}.getType(), callback);
}
}

/**
* Get form.
* <p>
* Use this method to get a form by its ID.
*
*
* @param id ID of a form (required)
* @return GetFormRequest
*/
public GetFormRequest getForm(String id) {
return new GetFormRequest(id);
}
private RequestDefinition getFormsDefinition(Integer offset, Integer limit, String formType, FormsStatus formStatus) {

private RequestDefinition getFormsDefinition(
Integer offset, Integer limit, String formType, FormsStatus formStatus) {
RequestDefinition.Builder builder = RequestDefinition.builder("GET", "/forms/1/forms")
.requiresAuthentication(true)
.accept("application/json");
.requiresAuthentication(true)
.accept("application/json");

if (offset != null) {
builder.addQueryParameter(new Parameter("offset", offset));
Expand All @@ -121,8 +121,7 @@ public class GetFormsRequest {
private String formType;
private FormsStatus formStatus;

private GetFormsRequest() {
}
private GetFormsRequest() {}

/**
* Sets offset.
Expand Down Expand Up @@ -168,7 +167,6 @@ public GetFormsRequest formStatus(FormsStatus formStatus) {
return this;
}


/**
* Executes the getForms request.
*
Expand All @@ -177,7 +175,7 @@ public GetFormsRequest formStatus(FormsStatus formStatus) {
*/
public FormsResponse execute() throws ApiException {
RequestDefinition getFormsDefinition = getFormsDefinition(offset, limit, formType, formStatus);
return apiClient.execute(getFormsDefinition, new TypeReference<FormsResponse>(){}.getType());
return apiClient.execute(getFormsDefinition, new TypeReference<FormsResponse>() {}.getType());
}

/**
Expand All @@ -188,24 +186,26 @@ public FormsResponse execute() throws ApiException {
*/
public okhttp3.Call executeAsync(ApiCallback<FormsResponse> callback) {
RequestDefinition getFormsDefinition = getFormsDefinition(offset, limit, formType, formStatus);
return apiClient.executeAsync(getFormsDefinition, new TypeReference<FormsResponse>(){}.getType(), callback);
return apiClient.executeAsync(
getFormsDefinition, new TypeReference<FormsResponse>() {}.getType(), callback);
}
}

/**
* Get forms.
* <p>
* Use this method to get a list of forms.
*
*
* @return GetFormsRequest
*/
public GetFormsRequest getForms() {
return new GetFormsRequest();
}

private RequestDefinition incrementViewCountDefinition(String id) {
RequestDefinition.Builder builder = RequestDefinition.builder("POST", "/forms/1/forms/{id}/views")
.requiresAuthentication(true)
.accept("application/json");
.requiresAuthentication(true)
.accept("application/json");

if (id != null) {
builder.addPathParameter(new Parameter("id", id));
Expand All @@ -223,7 +223,6 @@ private IncrementViewCountRequest(String id) {
this.id = Objects.requireNonNull(id, "The required parameter 'id' is missing.");
}


/**
* Executes the incrementViewCount request.
*
Expand All @@ -232,7 +231,8 @@ private IncrementViewCountRequest(String id) {
*/
public FormsStatusResponse execute() throws ApiException {
RequestDefinition incrementViewCountDefinition = incrementViewCountDefinition(id);
return apiClient.execute(incrementViewCountDefinition, new TypeReference<FormsStatusResponse>(){}.getType());
return apiClient.execute(
incrementViewCountDefinition, new TypeReference<FormsStatusResponse>() {}.getType());
}

/**
Expand All @@ -243,27 +243,30 @@ public FormsStatusResponse execute() throws ApiException {
*/
public okhttp3.Call executeAsync(ApiCallback<FormsStatusResponse> callback) {
RequestDefinition incrementViewCountDefinition = incrementViewCountDefinition(id);
return apiClient.executeAsync(incrementViewCountDefinition, new TypeReference<FormsStatusResponse>(){}.getType(), callback);
return apiClient.executeAsync(
incrementViewCountDefinition, new TypeReference<FormsStatusResponse>() {}.getType(), callback);
}
}

/**
* Increment form view count.
* <p>
* Use this method to increase the view counter of a specific form. It&#39;s used for proper statistics calculation. Statistics are available on the form performance page on the Portal.
*
*
* @param id ID of a form (required)
* @return IncrementViewCountRequest
*/
public IncrementViewCountRequest incrementViewCount(String id) {
return new IncrementViewCountRequest(id);
}
private RequestDefinition submitFormDataDefinition(String id, Map<String, Object> requestBody, String ibSubmissionSource, String ibSubmissionFormCampaign) {

private RequestDefinition submitFormDataDefinition(
String id, Map<String, Object> requestBody, String ibSubmissionSource, String ibSubmissionFormCampaign) {
RequestDefinition.Builder builder = RequestDefinition.builder("POST", "/forms/1/forms/{id}/data")
.body(requestBody)
.requiresAuthentication(true)
.accept("application/json")
.contentType("application/json");
.body(requestBody)
.requiresAuthentication(true)
.accept("application/json")
.contentType("application/json");

if (id != null) {
builder.addPathParameter(new Parameter("id", id));
Expand Down Expand Up @@ -313,16 +316,16 @@ public SubmitFormDataRequest ibSubmissionFormCampaign(String ibSubmissionFormCam
return this;
}


/**
* Executes the submitFormData request.
*
* @return FormsStatusResponse The deserialized response.
* @throws ApiException If the API call fails or an error occurs during the request or response processing.
*/
public FormsStatusResponse execute() throws ApiException {
RequestDefinition submitFormDataDefinition = submitFormDataDefinition(id, requestBody, ibSubmissionSource, ibSubmissionFormCampaign);
return apiClient.execute(submitFormDataDefinition, new TypeReference<FormsStatusResponse>(){}.getType());
RequestDefinition submitFormDataDefinition =
submitFormDataDefinition(id, requestBody, ibSubmissionSource, ibSubmissionFormCampaign);
return apiClient.execute(submitFormDataDefinition, new TypeReference<FormsStatusResponse>() {}.getType());
}

/**
Expand All @@ -332,16 +335,18 @@ public FormsStatusResponse execute() throws ApiException {
* @return The {@link okhttp3.Call} associated with the API request.
*/
public okhttp3.Call executeAsync(ApiCallback<FormsStatusResponse> callback) {
RequestDefinition submitFormDataDefinition = submitFormDataDefinition(id, requestBody, ibSubmissionSource, ibSubmissionFormCampaign);
return apiClient.executeAsync(submitFormDataDefinition, new TypeReference<FormsStatusResponse>(){}.getType(), callback);
RequestDefinition submitFormDataDefinition =
submitFormDataDefinition(id, requestBody, ibSubmissionSource, ibSubmissionFormCampaign);
return apiClient.executeAsync(
submitFormDataDefinition, new TypeReference<FormsStatusResponse>() {}.getType(), callback);
}
}

/**
* Submit form data.
* <p>
* Use this method to submit form data.
*
*
* @param id ID of a form (required)
* @param requestBody Form Data (required)
* @return SubmitFormDataRequest
Expand Down
Loading

0 comments on commit 9153c12

Please sign in to comment.