Skip to content

Java - update to delete allowed status #697

Merged
shrutiburman merged 2 commits intotwilio-java-generation-modernisationfrom
DII-2122-java-delete-status
Nov 11, 2025
Merged

Java - update to delete allowed status #697
shrutiburman merged 2 commits intotwilio-java-generation-modernisationfrom
DII-2122-java-delete-status

Conversation

@shrutiburman
Copy link
Contributor

Fixes # https://twilio-engineering.atlassian.net/browse/DII-2123

A short description of what this PR does.

Checklist

  • I acknowledge that all my contributions will be made under the project's license
  • Run make test-docker
  • Verify affected language:
    • Generate twilio-go from our OpenAPI specification using the build_twilio_go.py using python examples/build_twilio_go.py path/to/twilio-oai/spec/yaml path/to/twilio-go and inspect the diff
    • Run make test in twilio-go
    • Create a pull request in twilio-go
    • Provide a link below to the pull request
  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have read the Contribution Guidelines and my PR follows them
  • I have titled the PR appropriately
  • I have updated my branch with the main branch
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation about the functionality in the appropriate .md file
  • I have added inline documentation to the code I modified

If you have questions, please create a GitHub Issue in this repository.

public boolean delete(final TwilioRestClient client) {
{{>common/generateUri}}


Copy link
Contributor Author

Choose a reason for hiding this comment

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

Essentially, this is the expected change in Deleter files.

path = path.replace("{"+"TestInteger"+"}", this.pathTestInteger.toString());


Predicate<Integer> deleteStatues = i -> i != null && i >= 200 && i < 300;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Effective change -->

throw new ApiException(restException);
}
return response.getStatusCode() == 204;
return deleteStatues.test(response.getStatusCode());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Effective change -->

@manisha1997
Copy link
Contributor

Can you create a preview PR in twilio-java with this?

@shrutiburman
Copy link
Contributor Author

Can you create a preview PR in twilio-java with this?

Is there a cmd or way to do that? Do you want to see the resultant changes? We can see that in here too, I have marked the change with comment "effective change" in file examples/java/src/main/java/com/twilio/rest/api/v2010/account/CallDeleter.java

{{>common/generateUri}}


Predicate<Integer> deleteStatues = i -> i != null && i >= 200 && i < 300;
Copy link
Contributor

Choose a reason for hiding this comment

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

This repeats itself at all classes. What if we create a static method of this and use that?
Less code duplication

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line is only applicable in case of Delete operations, its present in the deleter files only, not reused. dont see any point of making it a public method.

@manisha1997
Copy link
Contributor

I generated the preview PR - twilio/twilio-java#922

@shrutiburman
Copy link
Contributor Author

I generated the preview PR - twilio/twilio-java#922
mvn test gist from the repo-

image

@shrutiburman shrutiburman merged commit 9e4b097 into twilio-java-generation-modernisation Nov 11, 2025
1 of 2 checks passed
@shrutiburman shrutiburman deleted the DII-2122-java-delete-status branch November 11, 2025 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants