Skip to content

Commit

Permalink
Add default date params to law tree update api
Browse files Browse the repository at this point in the history
Add two overload methods to the law tree updates api to allow for
use of default date range parameters.  The "from" date will default to
1970-01-01 and the "to" parameter will default to the current date time.
  • Loading branch information
stouffers committed Aug 30, 2017
1 parent ce39793 commit aabda96
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
7 changes: 6 additions & 1 deletion docs/api/laws.rst
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,14 @@ To see updates to the content of law documents, see `Get law document updates`_.
List of laws with tree updates during the given date/time range
::
/api/3/laws/tree/updates
/api/3/laws/tree/updates/{fromDateTime}
/api/3/laws/tree/updates/{fromDateTime}/{toDateTime}
.. note:: The fromDateTime and toDateTime should be formatted as the ISO Date Time format. For example December 10, 2014, 1:30:02 PM should be inputted as 2014-12-10T13:30:02. The fromDateTime and toDateTime range is exclusive.
The fromDateTime and toDateTime should be formatted as the ISO Date Time format.
For example December 10, 2014, 1:30:02 PM should be inputted as 2014-12-10T13:30:02.
The fromDateTime and toDateTime range is exclusive.
If excluded, fromDateTime defaults to Jan 1 1970 and toDateTime defaults to the current datetime
**Optional Params**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class LawUpdatesCtrl extends BaseCtrl
@Autowired private LawUpdatesDao lawUpdatesDao;

/**
* Law Updates API (for all laws)
* Law Document Updates API (for all laws)
* ------------------------------
*
* Usages:
Expand Down Expand Up @@ -70,6 +70,34 @@ public BaseResponse getAllUpdates(@PathVariable String from, @PathVariable Strin
return getAllUpdates(parseISODateTime(from, "from"), parseISODateTime(to, "to"), request);
}

/**
* Law Tree Updates API
* ------------------------------
*
* Usages:
* (GET) /api/3/laws/tree/updates
* (GET) /api/3/laws/tree/updates/{from date-time}
* (GET) /api/3/laws/tree/updates/{from date-time}/{to date-time}
*
* date parameters default to 1970-01-01 and now respectively
*
* Request Params: type (string) - Update type (processed, published) Default: published
* limit, offset (int) - Paginate
* order (string) - Order by update date
*
* Expected Response: List of UpdateTokenView<LawVersionId>
*/
@RequestMapping(value = "/tree/updates")
public BaseResponse getLawTreeUpdates(WebRequest request) {
return getLawTreeUpdates(null, null, request);
}

@RequestMapping(value = "/tree/updates/{from:.*\\.?.*}")
public BaseResponse getLawTreeUpdates(@PathVariable String from,
WebRequest request) {
return getLawTreeUpdates(from, null, request);
}

@RequestMapping(value = "/tree/updates/{from:.*\\.?.*}/{to:.*\\.?.*}")
public BaseResponse getLawTreeUpdates(@PathVariable String from,
@PathVariable String to,
Expand Down

0 comments on commit aabda96

Please sign in to comment.