Skip to content

Commit fd260d8

Browse files
committed
Fix: Update ListGrantsQueryParams values to match API expectations
- Keep camelCase property names (sortBy, orderBy, grantStatus) - Update values to match API: 'created_at' | 'updated_at' for sortBy - Add test coverage for correct API value usage - Maintains backward compatibility with existing code Fixes #669
1 parent 3dc8541 commit fd260d8

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

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-
sort_by?: 'created_at' | 'updated_at';
113+
sortBy?: 'created_at' | 'updated_at';
114114
/**
115115
* Specify ascending or descending order.
116116
*/
117-
order_by?: 'asc' | 'desc';
117+
orderBy?: '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-
grant_status?: string;
133+
grantStatus?: string;
134134
/**
135135
* Filtering your query based on grant IP address
136136
*/

tests/resources/grants.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ describe('Grants', () => {
126126
);
127127
});
128128

129-
it('should properly handle snake_case query parameters', async () => {
129+
it('should properly handle camelCase query parameters with correct API values', async () => {
130130
await grants.list({
131131
queryParams: {
132132
limit: 10,
133133
offset: 5,
134-
sort_by: 'created_at',
135-
order_by: 'desc',
136-
grant_status: 'valid',
134+
sortBy: 'created_at',
135+
orderBy: 'desc',
136+
grantStatus: 'valid',
137137
},
138138
});
139139

@@ -144,9 +144,9 @@ describe('Grants', () => {
144144
queryParams: {
145145
limit: 10,
146146
offset: 5,
147-
sort_by: 'created_at',
148-
order_by: 'desc',
149-
grant_status: 'valid',
147+
sortBy: 'created_at',
148+
orderBy: 'desc',
149+
grantStatus: 'valid',
150150
},
151151
})
152152
);

0 commit comments

Comments
 (0)