Title: Allow for same param name but different contextual usage by gjtorikian · Pull Request #520 · workos/workos-python · GitHub
Open Graph Title: Allow for same param name but different contextual usage by gjtorikian · Pull Request #520 · workos/workos-python
X Title: Allow for same param name but different contextual usage by gjtorikian · Pull Request #520 · workos/workos-python
Description: Description As #519 notes, #512 corrected one problem and introduced another. The param provided by users through the SDK is user_id/ group_id / directory_id; the API accepts parameters as user / group / directory by the API, without the suffix. What I misunderstood was that pagination actually requires the *_id version of these parameters, so while #512 fixed pagination (by using *_id), it went ahead and broke regular API calls (by using the incorrect, suffixless parameters). Makes sense? Yeah, I had to re-read everything a few times myself to understand the difference in usage. The key is in these lines (repeated throughout several API resources, I'm just picking one): response = self._http_client.request( "directory_users", method=REQUEST_METHOD_GET, params=list_params, ) return WorkOSListResource( list_method=self.list_users, list_args=list_params, **ListPage[DirectoryUserWithGroups](**response).model_dump(), ) The request uses list_params, and then the pagination WorkOSListResource uses list_params again. To solve this, I added a function to translate the parameter name, depending on the context it's used. Essentially, this branch keeps the *_id names internally for pagination, then renames to the suffixless version them right before the HTTP call. Documentation Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates. [ ] Yes If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.
Open Graph Description: Description As #519 notes, #512 corrected one problem and introduced another. The param provided by users through the SDK is user_id/ group_id / directory_id; the API accepts parameters as user / g...
X Description: Description As #519 notes, #512 corrected one problem and introduced another. The param provided by users through the SDK is user_id/ group_id / directory_id; the API accepts parameters as user / g...
Opengraph URL: https://github.com/workos/workos-python/pull/520
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:b76ae544-c650-9dd6-8db5-1f6de25b39c0 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BBEE:1E3F:13DE55A:1A97B02:6992D857 |
| html-safe-nonce | 4d7cb2297796e861f480f0b1b9941d3e1f5b8e77c0beb889b90ffbbcf139f263 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQkVFOjFFM0Y6MTNERTU1QToxQTk3QjAyOjY5OTJEODU3IiwidmlzaXRvcl9pZCI6IjQyNDQ3MzgxNDM2MzE5OTU3NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f8cc93f7d6817b1de6ddc7221a2ae3ef93fbe14a1e4252877275f651eb030296 |
| hovercard-subject-tag | pull_request:3191983704 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/workos/workos-python/pull/520/files |
| twitter:image | https://avatars.githubusercontent.com/u/64050?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/64050?s=400&v=4 |
| og:image:alt | Description As #519 notes, #512 corrected one problem and introduced another. The param provided by users through the SDK is user_id/ group_id / directory_id; the API accepts parameters as user / g... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/workos/workos-python git https://github.com/workos/workos-python.git |
| octolytics-dimension-user_id | 47638084 |
| octolytics-dimension-user_login | workos |
| octolytics-dimension-repository_id | 226952859 |
| octolytics-dimension-repository_nwo | workos/workos-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 226952859 |
| octolytics-dimension-repository_network_root_nwo | workos/workos-python |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 84dcb133269e3cfe6e0296cc85fbacb92cae92bb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width