Skip to content

Commit 3dc8541

Browse files
cursoragentdemello.aaron
andcommitted
Refactor: Use snake_case for grant query parameters
Co-authored-by: demello.aaron <[email protected]>
1 parent 9b8d8b8 commit 3dc8541

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/models/grants.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ export interface ListGrantsQueryParams {
110110
/**
111111
* Sort entries by field name
112112
*/
113-
sortBy?: 'createdAt' | 'updatedAt';
113+
sort_by?: 'created_at' | 'updated_at';
114114
/**
115115
* Specify ascending or descending order.
116116
*/
117-
orderBy?: 'asc' | 'desc';
117+
order_by?: 'asc' | 'desc';
118118
/**
119119
* Scope grants from a specific point in time by Unix timestamp.
120120
*/
@@ -130,7 +130,7 @@ export interface ListGrantsQueryParams {
130130
/**
131131
* Filtering your query based on grant email status (if applicable)
132132
*/
133-
grantStatus?: string;
133+
grant_status?: string;
134134
/**
135135
* Filtering your query based on grant IP address
136136
*/

tests/resources/grants.spec.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,32 @@ describe('Grants', () => {
125125
})
126126
);
127127
});
128+
129+
it('should properly handle snake_case query parameters', async () => {
130+
await grants.list({
131+
queryParams: {
132+
limit: 10,
133+
offset: 5,
134+
sort_by: 'created_at',
135+
order_by: 'desc',
136+
grant_status: 'valid',
137+
},
138+
});
139+
140+
expect(apiClient.request).toHaveBeenCalledWith(
141+
expect.objectContaining({
142+
method: 'GET',
143+
path: '/v3/grants',
144+
queryParams: {
145+
limit: 10,
146+
offset: 5,
147+
sort_by: 'created_at',
148+
order_by: 'desc',
149+
grant_status: 'valid',
150+
},
151+
})
152+
);
153+
});
128154
});
129155

130156
describe('find', () => {

0 commit comments

Comments
 (0)