-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use /v2/check instead of /v2/authorize * Create and update classes for new list params/filters * Add BaseWarrantObject and object crud methods * Update resource classes to extend BaseWarrantObject * Update warrant client methods to use objects api * Update live and client tests * Remove unused import * Add object create methods that take an object * Rename BaseListResult to BaseWarrantObjectListResult * Remove commented out code * Update ListResult to accept any type * Replace objectId object filter with query * Return warrantToken when creating or deleting warrants * Return warrant token for object deletes * Update all http methods to return warrant token if exists * Fix crud objects test
- Loading branch information
1 parent
26533e6
commit 0be3af5
Showing
20 changed files
with
1,456 additions
and
669 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package dev.warrant; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class ObjectFilters { | ||
|
||
private String objectType = ""; | ||
private String query = ""; | ||
|
||
public ObjectFilters() { | ||
} | ||
|
||
public ObjectFilters withObjectType(String objectType) { | ||
this.objectType = objectType; | ||
return this; | ||
} | ||
|
||
public ObjectFilters withQuery(String query) { | ||
this.query = query; | ||
return this; | ||
} | ||
|
||
public Map<String, Object> asMap() { | ||
Map<String, Object> params = new HashMap<>(); | ||
if (!this.objectType.isEmpty()) { | ||
params.put("objectType", objectType); | ||
} | ||
if (!this.query.isEmpty()) { | ||
params.put("q", query); | ||
} | ||
return params; | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
src/main/java/dev/warrant/model/object/BaseWarrantObject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package dev.warrant.model.object; | ||
|
||
import java.util.Map; | ||
import java.util.HashMap; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
public class BaseWarrantObject implements WarrantObject { | ||
protected String objectType; | ||
protected String objectId; | ||
protected Map<String, Object> meta; | ||
|
||
public BaseWarrantObject() { | ||
// For json serialization | ||
} | ||
|
||
public BaseWarrantObject(String objectType) { | ||
this.objectType = objectType; | ||
this.meta = new HashMap<String, Object>(); | ||
} | ||
|
||
public BaseWarrantObject(String objectType, String objectId) { | ||
this.objectType = objectType; | ||
this.objectId = objectId; | ||
this.meta = new HashMap<String, Object>(); | ||
} | ||
|
||
public BaseWarrantObject(String objectType, String objectId, Map<String, Object> meta) { | ||
this.objectType = objectType; | ||
this.objectId = objectId; | ||
this.meta = meta; | ||
} | ||
|
||
public String getObjectType() { | ||
return objectType; | ||
} | ||
|
||
public void setObjectType(String objectType) { | ||
this.objectType = objectType; | ||
} | ||
|
||
public String getObjectId() { | ||
return objectId; | ||
} | ||
|
||
public void setObjectId(String objectId) { | ||
this.objectId = objectId; | ||
} | ||
|
||
public Map<String, Object> getMeta() { | ||
return meta; | ||
} | ||
|
||
public void setMeta(Map<String, Object> meta) { | ||
this.meta = meta; | ||
} | ||
|
||
public String id() { | ||
return objectId; | ||
} | ||
|
||
public String type() { | ||
return objectType; | ||
} | ||
|
||
public Map<String, Object> meta() { | ||
return meta; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/dev/warrant/model/object/BaseWarrantObjectListResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package dev.warrant.model.object; | ||
|
||
public class BaseWarrantObjectListResult { | ||
private BaseWarrantObject[] results; | ||
private String prevCursor; | ||
private String nextCursor; | ||
|
||
public BaseWarrantObjectListResult() { | ||
// For json serialization | ||
} | ||
|
||
public BaseWarrantObjectListResult(BaseWarrantObject[] results) { | ||
this.results = results; | ||
} | ||
|
||
public BaseWarrantObjectListResult(BaseWarrantObject[] results, String prevCursor, String nextCursor) { | ||
this.results = results; | ||
this.prevCursor = prevCursor; | ||
this.nextCursor = nextCursor; | ||
} | ||
|
||
public BaseWarrantObject[] getResults() { | ||
return results; | ||
} | ||
|
||
public void setResults(BaseWarrantObject[] results) { | ||
this.results = results; | ||
} | ||
|
||
public String getPrevCursor() { | ||
return prevCursor; | ||
} | ||
|
||
public void setPrevCursor(String prevCursor) { | ||
this.prevCursor = prevCursor; | ||
} | ||
|
||
public String getNextCursor() { | ||
return nextCursor; | ||
} | ||
|
||
public void setNextCursor(String nextCursor) { | ||
this.nextCursor = nextCursor; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
package dev.warrant.model.object; | ||
|
||
public class Feature implements WarrantObject { | ||
static final String OBJECT_TYPE = "feature"; | ||
import java.util.Map; | ||
|
||
private String featureId; | ||
public class Feature extends BaseWarrantObject { | ||
public static final String OBJECT_TYPE = "feature"; | ||
|
||
public Feature() { | ||
// For json serialization | ||
super(); | ||
} | ||
|
||
public Feature(String featureId) { | ||
this.featureId = featureId; | ||
super(OBJECT_TYPE, featureId); | ||
} | ||
|
||
public Feature(String featureId, Map<String, Object> meta) { | ||
super(OBJECT_TYPE, featureId, meta); | ||
} | ||
|
||
public String getFeatureId() { | ||
return featureId; | ||
return objectId; | ||
} | ||
|
||
public void setFeatureId(String featureId) { | ||
this.featureId = featureId; | ||
this.objectId = featureId; | ||
} | ||
|
||
@Override | ||
public String id() { | ||
return featureId; | ||
return objectId; | ||
} | ||
|
||
@Override | ||
public String type() { | ||
return "feature"; | ||
return OBJECT_TYPE; | ||
} | ||
|
||
// @Override | ||
// public Map<String, Object> meta() { | ||
// return null; | ||
// } | ||
} |
Oops, something went wrong.