Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve lint issues #434

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;


import java.util.Map;
import java.time.LocalDate;
import java.math.BigDecimal;
Expand All @@ -73,7 +70,6 @@
@ToString
public class Account extends Resource {
private static final long serialVersionUID = 13844008145741L;

public static AccountCreator creator(){
return new AccountCreator();
}
Expand All @@ -92,17 +88,19 @@ public static AccountFetcher fetcher(final String pathSid){
return new AccountFetcher(pathSid);
}



public static AccountReader reader(){
return new AccountReader();
}


public static AccountUpdater updater(final Account.Status status){
return new AccountUpdater(status);
}
public static AccountUpdater updater(final String pathSid, final Account.Status status){
return new AccountUpdater(pathSid, status);
}

/**
* Converts a JSON String into a Account object using the provided ObjectMapper.
*
Expand Down Expand Up @@ -153,6 +151,7 @@ private Status(final String value) {
this.value = value;
}

@Override
public String toString() {
return value;
}
Expand All @@ -172,6 +171,7 @@ private XTwilioWebhookEnabled(final String value) {
this.value = value;
}

@Override
public String toString() {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,21 @@
import com.twilio.http.Response;
import com.twilio.http.TwilioRestClient;
import com.twilio.rest.Domains;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.time.LocalDate;
import com.twilio.converter.Converter;
import java.time.ZonedDateTime;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.net.URI;
import java.time.format.DateTimeFormatter;
import com.twilio.converter.DateConverter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import lombok.ToString;

import java.net.URI;

public class AccountCreator extends Creator<Account>{
Expand Down Expand Up @@ -88,7 +82,7 @@ public AccountCreator setTwiml(final String twiml){

@Override
public Account create(final TwilioRestClient client){
String path = "/2010-04-01/Accounts.json";
String path = String.format("%s", "/2010-04-01/Accounts.json");
Comment on lines -91 to +85
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? Is there an example that requires the format call?



Request request = new Request(
Expand All @@ -112,25 +106,20 @@ public Account create(final TwilioRestClient client){
return Account.fromJson(response.getStream(), client.getObjectMapper());
}
private void addPostParams(final Request request) {
if (recordingStatusCallback != null) {
request.addPostParam("RecordingStatusCallback", recordingStatusCallback.toString());
request.addPostParam("RecordingStatusCallback", String.valueOf(recordingStatusCallback));

}
if (recordingStatusCallbackEvent != null) {
for (String prop : recordingStatusCallbackEvent) {
request.addPostParam("RecordingStatusCallbackEvent", prop);
}

}
if (twiml != null) {
request.addPostParam("Twiml", twiml.toString());

}
request.addPostParam("Twiml", String.valueOf(twiml));

}
private void addHeaderParams(final Request request) {
if (xTwilioWebhookEnabled != null) {
request.addHeaderParam("X-Twilio-Webhook-Enabled", xTwilioWebhookEnabled.toString());

}
private void addHeaderParams(final Request request) {
request.addHeaderParam("X-Twilio-Webhook-Enabled", String.valueOf(xTwilioWebhookEnabled));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public AccountDeleter(final String pathSid){

@Override
public boolean delete(final TwilioRestClient client) {
String path = "/2010-04-01/Accounts/{Sid}.json";
String path = String.format("%s", "/2010-04-01/Accounts/{Sid}.json");

this.pathSid = this.pathSid == null ? client.getAccountSid() : this.pathSid;
path = path.replace("{"+"Sid"+"}", this.pathSid.toString());
path = path.replace("{"+"Sid"+"}", this.pathSid);

Request request = new Request(
HttpMethod.DELETE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ public AccountFetcher(final String pathSid){

@Override
public Account fetch(final TwilioRestClient client) {
String path = "/2010-04-01/Accounts/{Sid}.json";
String path = String.format("%s", "/2010-04-01/Accounts/{Sid}.json");

this.pathSid = this.pathSid == null ? client.getAccountSid() : this.pathSid;
path = path.replace("{"+"Sid"+"}", this.pathSid.toString());
path = path.replace("{"+"Sid"+"}", this.pathSid);

Request request = new Request(
HttpMethod.GET,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,8 @@ else if (dateCreatedAfter != null || dateCreatedBefore != null) {
request.addQueryParam("Date.Test", DateConverter.dateStringFromLocalDate(dateTest));
}

if (pageSize != null) {

request.addQueryParam("PageSize", pageSize.toString());
}
request.addQueryParam("PageSize", String.valueOf(pageSize));

if(getPageSize() != null) {
request.addQueryParam("PageSize", Integer.toString(getPageSize()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ public AccountUpdater setPauseBehavior(final String pauseBehavior){

@Override
public Account update(final TwilioRestClient client){
String path = "/2010-04-01/Accounts/{Sid}.json";
String path = String.format("%s", "/2010-04-01/Accounts/{Sid}.json");

this.pathSid = this.pathSid == null ? client.getAccountSid() : this.pathSid;
path = path.replace("{"+"Sid"+"}", this.pathSid.toString());
path = path.replace("{"+"Sid"+"}", this.pathSid);
path = path.replace("{"+"Status"+"}", this.status.toString());


Request request = new Request(
HttpMethod.POST,
Domains.API.toString(),
Expand All @@ -94,13 +95,10 @@ public Account update(final TwilioRestClient client){
return Account.fromJson(response.getStream(), client.getObjectMapper());
}
private void addPostParams(final Request request) {
if (pauseBehavior != null) {
request.addPostParam("PauseBehavior", pauseBehavior);
request.addPostParam("PauseBehavior", String.valueOf(pauseBehavior));

}
if (status != null) {
request.addPostParam("Status", status.toString());
request.addPostParam("Status", String.valueOf(status));

}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;


import java.util.Map;
import java.time.LocalDate;
import java.math.BigDecimal;
Expand All @@ -73,7 +70,6 @@
@ToString
public class Call extends Resource {
private static final long serialVersionUID = 22261732607075L;

public static CallCreator creator(final String requiredStringProperty, final HttpMethod testMethod){
return new CallCreator(requiredStringProperty, testMethod);
}
Expand All @@ -95,6 +91,7 @@ public static CallFetcher fetcher(final String pathAccountSid, final Integer pat
return new CallFetcher(pathAccountSid, pathTestInteger);
}


/**
* Converts a JSON String into a Call object using the provided ObjectMapper.
*
Expand Down Expand Up @@ -145,6 +142,7 @@ private Status(final String value) {
this.value = value;
}

@Override
public String toString() {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,21 @@
import com.twilio.http.Response;
import com.twilio.http.TwilioRestClient;
import com.twilio.rest.Domains;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.time.LocalDate;
import com.twilio.converter.Converter;
import java.time.ZonedDateTime;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.net.URI;
import java.time.format.DateTimeFormatter;
import com.twilio.converter.DateConverter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import lombok.ToString;

import java.net.URI;

public class CallCreator extends Creator<Call>{
Expand Down Expand Up @@ -95,13 +89,15 @@ public CallCreator setTestArrayOfUri(final String testArrayOfUri){

@Override
public Call create(final TwilioRestClient client){
String path = "/2010-04-01/Accounts/{AccountSid}/Calls.json";
String path = String.format("%s", "/2010-04-01/Accounts/{AccountSid}/Calls.json");

this.pathAccountSid = this.pathAccountSid == null ? client.getAccountSid() : this.pathAccountSid;
path = path.replace("{"+"AccountSid"+"}", this.pathAccountSid.toString());
path = path.replace("{"+"RequiredStringProperty"+"}", this.requiredStringProperty.toString());
path = path.replace("{"+"AccountSid"+"}", this.pathAccountSid);
path = path.replace("{"+"RequiredStringProperty"+"}", this.requiredStringProperty);

path = path.replace("{"+"TestMethod"+"}", this.testMethod.toString());


Request request = new Request(
HttpMethod.POST,
Domains.API.toString(),
Expand All @@ -122,25 +118,22 @@ public Call create(final TwilioRestClient client){
return Call.fromJson(response.getStream(), client.getObjectMapper());
}
private void addPostParams(final Request request) {
if (requiredStringProperty != null) {
request.addPostParam("RequiredStringProperty", requiredStringProperty);
request.addPostParam("RequiredStringProperty", String.valueOf(requiredStringProperty));

}
if (testArrayOfStrings != null) {
for (String prop : testArrayOfStrings) {
request.addPostParam("TestArrayOfStrings", prop);
}

}

if (testArrayOfUri != null) {
for (URI prop : testArrayOfUri) {
request.addPostParam("TestArrayOfUri", prop.toString());
request.addPostParam("TestArrayOfUri", String.valueOf(prop));
}

}
if (testMethod != null) {
request.addPostParam("TestMethod", testMethod.toString());

}
request.addPostParam("TestMethod", String.valueOf(testMethod));

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ public CallDeleter(final String pathAccountSid, final Integer pathTestInteger){

@Override
public boolean delete(final TwilioRestClient client) {
String path = "/2010-04-01/Accounts/{AccountSid}/Calls/{TestInteger}.json";
String path = String.format("%s", "/2010-04-01/Accounts/{AccountSid}/Calls/{TestInteger}.json");

this.pathAccountSid = this.pathAccountSid == null ? client.getAccountSid() : this.pathAccountSid;
path = path.replace("{"+"AccountSid"+"}", this.pathAccountSid.toString());
path = path.replace("{"+"AccountSid"+"}", this.pathAccountSid);
path = path.replace("{"+"TestInteger"+"}", this.pathTestInteger.toString());


Request request = new Request(
HttpMethod.DELETE,
Domains.API.toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ public CallFetcher(final String pathAccountSid, final Integer pathTestInteger){

@Override
public Call fetch(final TwilioRestClient client) {
String path = "/2010-04-01/Accounts/{AccountSid}/Calls/{TestInteger}.json";
String path = String.format("%s", "/2010-04-01/Accounts/{AccountSid}/Calls/{TestInteger}.json");

this.pathAccountSid = this.pathAccountSid == null ? client.getAccountSid() : this.pathAccountSid;
path = path.replace("{"+"AccountSid"+"}", this.pathAccountSid.toString());
path = path.replace("{"+"AccountSid"+"}", this.pathAccountSid);
path = path.replace("{"+"TestInteger"+"}", this.pathTestInteger.toString());


Request request = new Request(
HttpMethod.GET,
Domains.API.toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;


import java.util.Map;
import java.time.LocalDate;
import java.math.BigDecimal;
Expand Down Expand Up @@ -80,7 +77,6 @@ public static FeedbackCallSummaryUpdater updater(final String pathSid, final Loc
public static FeedbackCallSummaryUpdater updater(final String pathAccountSid, final String pathSid, final LocalDate endDate, final LocalDate startDate){
return new FeedbackCallSummaryUpdater(pathAccountSid, pathSid, endDate, startDate);
}

/**
* Converts a JSON String into a FeedbackCallSummary object using the provided ObjectMapper.
*
Expand Down Expand Up @@ -131,6 +127,7 @@ private Status(final String value) {
this.value = value;
}

@Override
public String toString() {
return value;
}
Expand Down
Loading