Skip to content

Commit b1c793f

Browse files
Enable filtering by type on events resource (#95)
Co-authored-by: Dennis Guye <[email protected]> Co-authored-by: Dennis Guye <[email protected]>
1 parent 362949f commit b1c793f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

resources/events.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ export class Events extends BaseResource {
1515
public async list(params?: EventListParams): Promise<UnitResponse<UnitEvent[]>> {
1616
const parameters = {
1717
"page[limit]": (params?.limit ? params?.limit : 100),
18-
"page[offset]": (params?.offset ? params?.offset : 0)
18+
"page[offset]": (params?.offset ? params?.offset : 0),
19+
...(params?.type && { "filter[type]": params?.type }),
1920
}
2021

2122
return this.httpGet<UnitResponse<UnitEvent[]>>("", { params: parameters })
@@ -38,4 +39,10 @@ export interface EventListParams {
3839
* default: 0
3940
*/
4041
offset?: number
42+
43+
/**
44+
* Optional. Filter events by event type
45+
* default: empty
46+
*/
47+
type?: string[]
4148
}

0 commit comments

Comments
 (0)