Skip to content

Commit 8ac98ad

Browse files
authored
Merge pull request #19 from codeclimate/QUA-519/add-regex-filter-docs
QUA-519: add regex filter docs
2 parents 8b608ba + 57dca66 commit 8ac98ad

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

source/includes/_overview.html.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,17 @@ curl \
101101
https://api.codeclimate.com/v1/repos/696a76232df2736347000001/ref_points
102102
```
103103

104+
> Filtering with the `$regex` operator. This can be used to find records with an attribute that matches a certain regular expression.
105+
106+
```shell
107+
curl \
108+
-H "Accept: application/vnd.api+json" \
109+
-H "Authorization: Token token={TOKEN}" \
110+
--get \
111+
--data-urlencode "filter[path][\$regex]=.+\.yml" \
112+
https://api.codeclimate.com/v1/repos/59371236d8638a029a0000ef/snapshots/623c2866a758be0001036c9f/files
113+
```
114+
104115
In some cases, where specified, the Code Climate API supports filtering resource
105116
collections.
106117

@@ -111,7 +122,7 @@ The JSON API is agnostic beyond the `filter[]` key. In the Code Climate API,
111122
filters can be of two basic formats (examples on the right):
112123

113124
1. A basic key/value
114-
2. A more complex data structure with an operator. At this time only the `$in` operator is supported.
125+
2. A more complex data structure with an operator. At this time only the `$in` and `$regex` operators are supported.
115126

116127
See the `Query Parameters` section of each endpoint for details about what filters are supported.
117128

source/includes/_repository_analysis.html.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,13 @@ Sorted by path in ascending order.
258258

259259
### Query Parameters
260260

261-
[Paginated](#collection-pagination)
261+
[Paginated](#collection-pagination), [Filterable](#collection-filtering)
262+
263+
Filters include:
264+
265+
| Name | Description | Required? |
266+
| ---- | ----------- | --------- |
267+
| filter[path] | Single path, `$in` clause containing list of categories or `$regex` clause containing regular expressions | No |
262268

263269
## Get builds
264270

0 commit comments

Comments
 (0)