Skip to content

Commit

Permalink
Add warrant token support (#28)
Browse files Browse the repository at this point in the history
* Create RequestOptions

* Update base client to add methods with support for RequestOptions

* Update client to add methods with support for RequestOptions

* Update live test to include request options usage

* Update request helper methods to use overloaded methods

* Update Collections.EMPTY_MAP to Collections.emptyMap()

* Update overloaded methods to call one method with most params

* Add support for listing warrants

* Call correct overloaded method

---------

Co-authored-by: Karan Kajla <[email protected]>
  • Loading branch information
stanleyphu and kkajla12 authored Aug 31, 2023
1 parent 2e24b39 commit 6aecb73
Show file tree
Hide file tree
Showing 8 changed files with 1,098 additions and 333 deletions.
7 changes: 4 additions & 3 deletions src/main/java/dev/warrant/ListParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
import java.util.Map;

public class ListParams {
private int page;
private int limit;
private int page = 0;
private int limit = 0;
private String beforeId;
private String beforeValue;
private String afterId;
private String afterValue;
private String sortBy;
private String sortOrder;

public ListParams() {}
public ListParams() {
}

public ListParams withPage(int page) {
this.page = page;
Expand Down
62 changes: 0 additions & 62 deletions src/main/java/dev/warrant/Query.java

This file was deleted.

25 changes: 25 additions & 0 deletions src/main/java/dev/warrant/RequestOptions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package dev.warrant;

import java.util.HashMap;
import java.util.Map;

public class RequestOptions {
private String warrantToken;

public RequestOptions() {}

public RequestOptions withWarrantToken(String warrantToken) {
this.warrantToken = warrantToken;
return this;
}

public Map<String, Object> asMap() {
Map<String, Object> options = new HashMap<>();

if (this.warrantToken != null) {
options.put("Warrant-Token", warrantToken);
}

return options;
}
}
Loading

0 comments on commit 6aecb73

Please sign in to comment.