Skip to content
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
@@ -0,0 +1,7 @@
package com.plivo.api.exceptions;

public class TooManyRequestsException extends PlivoRestException {
public TooManyRequestsException(String message) {
super(message);
}
}
3 changes: 3 additions & 0 deletions src/main/java/com/plivo/api/models/base/BaseRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.ResourceNotFoundException;
import com.plivo.api.exceptions.ServerException;
import com.plivo.api.exceptions.TooManyRequestsException;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
Expand Down Expand Up @@ -88,6 +89,8 @@ protected void handleResponse(Response response) throws PlivoRestException, IOEx
throw new ResourceNotFoundException(response.errorBody().string());
case 405:
throw new InvalidRequestException(response.errorBody().string());
case 429:
throw new TooManyRequestsException(response.errorBody().string());
case 500:
throw new ServerException(response.errorBody().string());
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/plivo/api/models/number/NumberCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

public class NumberCreator extends Creator<NumberCreateResponse> {

private List<String> numbers = new ArrayList<>();
private String numbers;
private String carrier;
private String region;
private NumberType numberType;
Expand All @@ -22,12 +22,12 @@ public class NumberCreator extends Creator<NumberCreateResponse> {
throw new IllegalStateException("carrier, numbers and region are required");
}

this.numbers = numbers;
this.numbers = String.join(",", numbers);
this.carrier = carrier;
this.region = region;
}

public List<String> numbers() {
public String numbers() {
return this.numbers;
}

Expand Down