Skip to content

Commit e65ec1e

Browse files
authored
chore: default list methods to descending order (#234)
* chore: default list methods to descending order * chore: format * chore: format * cleanup * chore: bump version * update image * chore: drop tests on python v2 * chore: drop tests on python v2 * chore: drop tests on python v2
1 parent a66a738 commit e65ec1e

File tree

7 files changed

+28
-25
lines changed

7 files changed

+28
-25
lines changed

.semaphore/semaphore.yml

+3-13
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,21 @@ name: Python
33
agent:
44
machine:
55
type: e1-standard-2
6-
os_image: ubuntu1804
6+
containers:
7+
- name: main
8+
image: "registry.semaphoreci.com/python:3.7"
79
blocks:
810
- task:
911
secrets:
1012
- name: codecov-workos-python
1113
prologue:
1214
commands:
1315
- checkout
14-
- sem-version python 2.7
15-
- python -m pip install --upgrade pip
16-
- pip install -e .[dev]
17-
- sem-version python 3.7
1816
- python -m pip install --upgrade pip
1917
- pip install -e .[dev]
2018
jobs:
21-
- name: python
22-
commands:
23-
- sem-version python 2.7
24-
- flake8 . --count --select=E9,F7,F82 --show-source --statistics
25-
- flake8 . --count --exit-zero --max-complexity=10 --statistics
26-
- pytest
27-
# Coverage would be the same regardless of Python version
2819
- name: python3 + codecov
2920
commands:
30-
- sem-version python 3.7
3121
- flake8 . --count --select=E9,F7,F82 --show-source --statistics
3222
- flake8 . --count --exit-zero --max-complexity=10 --statistics
3323
- pytest --cov-report xml --cov=workos

workos/__about__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
__package_url__ = "https://github.com/workos-inc/workos-python"
1414

15-
__version__ = "2.2.0"
15+
__version__ = "3.0.0"
1616

1717
__author__ = "WorkOS"
1818

workos/directory_sync.py

+16-6
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def list_users(
6969
"limit": limit,
7070
"before": before,
7171
"after": after,
72-
"order": order,
72+
"order": order or "desc",
7373
}
7474

7575
if group is not None:
@@ -138,7 +138,7 @@ def list_users_v2(
138138
"limit": limit,
139139
"before": before,
140140
"after": after,
141-
"order": order,
141+
"order": order or "desc",
142142
}
143143

144144
if group is not None:
@@ -206,7 +206,12 @@ def list_groups(
206206
limit = RESPONSE_LIMIT
207207
default_limit = True
208208

209-
params = {"limit": limit, "before": before, "after": after, "order": order}
209+
params = {
210+
"limit": limit,
211+
"before": before,
212+
"after": after,
213+
"order": order or "desc",
214+
}
210215
if user is not None:
211216
params["user"] = user
212217
if directory is not None:
@@ -268,7 +273,12 @@ def list_groups_v2(
268273
limit = RESPONSE_LIMIT
269274
default_limit = True
270275

271-
params = {"limit": limit, "before": before, "after": after, "order": order}
276+
params = {
277+
"limit": limit,
278+
"before": before,
279+
"after": after,
280+
"order": order or "desc",
281+
}
272282
if user is not None:
273283
params["user"] = user
274284
if directory is not None:
@@ -395,7 +405,7 @@ def list_directories(
395405
"limit": limit,
396406
"before": before,
397407
"after": after,
398-
"order": order,
408+
"order": order or "desc",
399409
}
400410

401411
if order is not None:
@@ -463,7 +473,7 @@ def list_directories_v2(
463473
"limit": limit,
464474
"before": before,
465475
"after": after,
466-
"order": order,
476+
"order": order or "desc",
467477
}
468478

469479
if order is not None:

workos/organizations.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def list_organizations(
6060
"limit": limit,
6161
"before": before,
6262
"after": after,
63-
"order": order,
63+
"order": order or "desc",
6464
}
6565

6666
if order is not None:
@@ -122,7 +122,7 @@ def list_organizations_v2(
122122
"limit": limit,
123123
"before": before,
124124
"after": after,
125-
"order": order,
125+
"order": order or "desc",
126126
}
127127

128128
if order is not None:

workos/resources/list.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def auto_paging_iter(self):
7575
params = {
7676
"after": after,
7777
"before": before,
78-
"order": order,
78+
"order": order or "desc",
7979
}
8080
params.update(resource_specific_params)
8181

workos/sso.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def list_connections(
234234
"limit": limit,
235235
"before": before,
236236
"after": after,
237-
"order": order,
237+
"order": order or "desc",
238238
}
239239

240240
if order is not None:
@@ -317,7 +317,7 @@ def list_connections_v2(
317317
"limit": limit,
318318
"before": before,
319319
"after": after,
320-
"order": order,
320+
"order": order or "desc",
321321
}
322322

323323
if order is not None:

workos/user_management.py

+3
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def list_users(
107107
"limit": limit,
108108
"before": before,
109109
"after": after,
110+
"order": order or "desc",
110111
}
111112

112113
if order is not None:
@@ -278,6 +279,7 @@ def list_organization_memberships(
278279
"limit": limit,
279280
"before": before,
280281
"after": after,
282+
"order": order or "desc",
281283
}
282284

283285
if order is not None:
@@ -944,6 +946,7 @@ def list_invitations(
944946
"limit": limit,
945947
"before": before,
946948
"after": after,
949+
"order": order or "desc",
947950
}
948951

949952
if order is not None:

0 commit comments

Comments
 (0)