Skip to content

Commit

Permalink
remove null check validation for unixtime as they are treated as long…
Browse files Browse the repository at this point in the history
… in java
  • Loading branch information
amarzavery committed Apr 28, 2016
1 parent f0dff3d commit 5a032ae
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,9 @@ public interface IntOperations {
* @param intBody the long value
* @throws ErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @throws IllegalArgumentException exception thrown from invalid parameters
* @return the {@link ServiceResponse} object if successful.
*/
ServiceResponse<Void> putUnixTimeDate(long intBody) throws ErrorException, IOException, IllegalArgumentException;
ServiceResponse<Void> putUnixTimeDate(long intBody) throws ErrorException, IOException;

/**
* Put datetime encoded as Unix time.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,13 +620,9 @@ private ServiceResponse<Long> getUnixTimeDelegate(Response<ResponseBody> respons
* @param intBody the long value
* @throws ErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @throws IllegalArgumentException exception thrown from invalid parameters
* @return the {@link ServiceResponse} object if successful.
*/
public ServiceResponse<Void> putUnixTimeDate(long intBody) throws ErrorException, IOException, IllegalArgumentException {
if (intBody == null) {
throw new IllegalArgumentException("Parameter intBody is required and cannot be null.");
}
public ServiceResponse<Void> putUnixTimeDate(long intBody) throws ErrorException, IOException {
Call<ResponseBody> call = service.putUnixTimeDate(intBody);
return putUnixTimeDateDelegate(call.execute());
}
Expand All @@ -643,10 +639,6 @@ public ServiceCall putUnixTimeDateAsync(long intBody, final ServiceCallback<Void
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
if (intBody == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter intBody is required and cannot be null."));
return null;
}
Call<ResponseBody> call = service.putUnixTimeDate(intBody);
final ServiceCall serviceCall = new ServiceCall(call);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
Expand All @@ -662,7 +654,7 @@ public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response)
return serviceCall;
}

private ServiceResponse<Void> putUnixTimeDateDelegate(Response<ResponseBody> response) throws ErrorException, IOException, IllegalArgumentException {
private ServiceResponse<Void> putUnixTimeDateDelegate(Response<ResponseBody> response) throws ErrorException, IOException {
return new ServiceResponseBuilder<Void, ErrorException>(this.client.getMapperAdapter())
.register(200, new TypeToken<Void>() { }.getType())
.registerError(ErrorException.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,10 +508,9 @@ public interface PathsOperations {
* @param unixTimeUrlPath Unix time encoded value
* @throws ErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @throws IllegalArgumentException exception thrown from invalid parameters
* @return the {@link ServiceResponse} object if successful.
*/
ServiceResponse<Void> unixTimeUrl(long unixTimeUrlPath) throws ErrorException, IOException, IllegalArgumentException;
ServiceResponse<Void> unixTimeUrl(long unixTimeUrlPath) throws ErrorException, IOException;

/**
* Get the date 2016-04-13 encoded value as '1460505600' (Unix time).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1428,13 +1428,9 @@ private ServiceResponse<Void> arrayCsvInPathDelegate(Response<ResponseBody> resp
* @param unixTimeUrlPath Unix time encoded value
* @throws ErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @throws IllegalArgumentException exception thrown from invalid parameters
* @return the {@link ServiceResponse} object if successful.
*/
public ServiceResponse<Void> unixTimeUrl(long unixTimeUrlPath) throws ErrorException, IOException, IllegalArgumentException {
if (unixTimeUrlPath == null) {
throw new IllegalArgumentException("Parameter unixTimeUrlPath is required and cannot be null.");
}
public ServiceResponse<Void> unixTimeUrl(long unixTimeUrlPath) throws ErrorException, IOException {
Call<ResponseBody> call = service.unixTimeUrl(unixTimeUrlPath);
return unixTimeUrlDelegate(call.execute());
}
Expand All @@ -1451,10 +1447,6 @@ public ServiceCall unixTimeUrlAsync(long unixTimeUrlPath, final ServiceCallback<
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
if (unixTimeUrlPath == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter unixTimeUrlPath is required and cannot be null."));
return null;
}
Call<ResponseBody> call = service.unixTimeUrl(unixTimeUrlPath);
final ServiceCall serviceCall = new ServiceCall(call);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
Expand All @@ -1470,7 +1462,7 @@ public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response)
return serviceCall;
}

private ServiceResponse<Void> unixTimeUrlDelegate(Response<ResponseBody> response) throws ErrorException, IOException, IllegalArgumentException {
private ServiceResponse<Void> unixTimeUrlDelegate(Response<ResponseBody> response) throws ErrorException, IOException {
return new ServiceResponseBuilder<Void, ErrorException>(this.client.getMapperAdapter())
.register(200, new TypeToken<Void>() { }.getType())
.registerError(ErrorException.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ public IEnumerable<ParameterModel> RequiredNullableParameters
!param.Type.IsPrimaryType(KnownPrimaryType.Double) &&
!param.Type.IsPrimaryType(KnownPrimaryType.Boolean) &&
!param.Type.IsPrimaryType(KnownPrimaryType.Long) &&
!param.Type.IsPrimaryType(KnownPrimaryType.UnixTime) &&
!param.IsConstant && param.IsRequired)
{
yield return param;
Expand Down

0 comments on commit 5a032ae

Please sign in to comment.