From 679d9ac4f0328cb338cb4c7a1055349a525bbde5 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Thu, 19 Feb 2026 15:51:14 +0000 Subject: [PATCH 1/2] ## Python SDK Changes: * `glean.authentication.checkdatasourceauth()`: **Added** --- .speakeasy/gen.lock | 106 ++++++---- .speakeasy/gen.yaml | 2 +- .speakeasy/glean-merged-spec.yaml | 107 +++++++---- .speakeasy/tests.arazzo.yaml | 13 ++ .speakeasy/workflow.lock | 14 +- README.md | 4 + RELEASES.md | 12 +- docs/models/checkdatasourceauthresponse.md | 8 + docs/models/unauthorizeddatasourceinstance.md | 12 +- docs/sdks/authentication/README.md | 55 ++++++ pylintrc | 3 +- pyproject.toml | 2 +- src/glean/api_client/_version.py | 6 +- src/glean/api_client/authentication.py | 181 ++++++++++++++++++ src/glean/api_client/client_activity.py | 12 +- src/glean/api_client/client_documents.py | 12 +- src/glean/api_client/errors/__init__.py | 4 +- src/glean/api_client/models/__init__.py | 12 +- .../models/checkdatasourceauthresponse.py | 53 +++++ .../models/unauthorizeddatasourceinstance.py | 4 +- src/glean/api_client/sdk.py | 4 + src/glean/api_client/utils/__init__.py | 4 +- .../internal/handler/generated_handlers.go | 1 + .../pathpostrestapiv1checkdatasourceauth.go | 70 +++++++ .../pathpostrestapiv1createcollection.go | 20 +- .../handler/pathpostrestapiv1getchat.go | 4 +- .../components/checkdatasourceauthresponse.go | 16 ++ .../unauthorizeddatasourceinstance.go | 2 +- .../models/operations/checkdatasourceauth.go | 27 +++ tests/test_authentication.py | 19 ++ 30 files changed, 670 insertions(+), 119 deletions(-) create mode 100644 docs/models/checkdatasourceauthresponse.md create mode 100644 docs/sdks/authentication/README.md create mode 100644 src/glean/api_client/authentication.py create mode 100644 src/glean/api_client/models/checkdatasourceauthresponse.py create mode 100644 tests/mockserver/internal/handler/pathpostrestapiv1checkdatasourceauth.go create mode 100644 tests/mockserver/internal/sdk/models/components/checkdatasourceauthresponse.go create mode 100644 tests/mockserver/internal/sdk/models/operations/checkdatasourceauth.go create mode 100644 tests/test_authentication.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 2a910e8a..b0adaf65 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,26 +1,26 @@ lockVersion: 2.0.0 id: 3e3290ca-0ee8-4981-b1bc-14536048fa63 management: - docChecksum: 9f0ee14455bad48f934f35e2967fa335 + docChecksum: e61f09454154d7eb019991c03f6d19eb docVersion: 0.9.0 - speakeasyVersion: 1.722.0 - generationVersion: 2.829.1 - releaseVersion: 0.12.6 - configChecksum: a8373720796725e358b9d142f6eaa005 + speakeasyVersion: 1.722.7 + generationVersion: 2.832.9 + releaseVersion: 0.12.7 + configChecksum: 8aebd542e0622973cae358ece93487de repoURL: https://github.com/gleanwork/api-client-python.git installationURL: https://github.com/gleanwork/api-client-python.git published: true persistentEdits: - generation_id: 022997b8-cc00-4f39-b3cf-2fad62267d5c - pristine_commit_hash: a4bd4e361e9db76d1eaa685e20ddc56ebc1382bd - pristine_tree_hash: b787f2eb155370c7e087af885a319592636751dc + generation_id: 14a6d36a-77ef-4a8e-8cd9-f7a1c0dc8bcb + pristine_commit_hash: 0e7f43da90541b2445d05211577217c1bab49f5f + pristine_tree_hash: 5319dfb5aff7a24b5c67c68b76d1baf663ce8139 features: python: additionalDependencies: 1.0.0 additionalProperties: 1.0.1 configurableModuleName: 0.2.0 constsAndDefaults: 1.0.6 - core: 6.0.8 + core: 6.0.11 defaultEnabledRetries: 0.2.0 deprecations: 3.0.2 devContainers: 3.0.0 @@ -449,6 +449,10 @@ trackedFiles: id: 93484e4440f7 last_write_checksum: sha1:70ab46266394ffd387991ec7036aa7e12346d278 pristine_git_object: f003c186b000ff51b939282191e5d42e08e06f7b + docs/models/checkdatasourceauthresponse.md: + id: c4214ea019e2 + last_write_checksum: sha1:ede1e2ca7769edf83659cc1dfe2d2e1de2de6c1d + pristine_git_object: b1ea62b7cc4e3bed1c5e1715ccd8fbdf3d01331e docs/models/checkdocumentaccessrequest.md: id: 7e17285c9fb1 last_write_checksum: sha1:40cc7d27e54e5aca99ebaa24670579d312b9252c @@ -2399,8 +2403,8 @@ trackedFiles: pristine_git_object: ee50fe80fdbbaa979a24f74e9947fff1819e74f7 docs/models/unauthorizeddatasourceinstance.md: id: b0a4b91f5b89 - last_write_checksum: sha1:7c488270fb94f617c42f237f5dfd412f2b05359f - pristine_git_object: 3186f05e7e9e317e694cc8245841bf37bfc1f21e + last_write_checksum: sha1:252dfa0628b61ac47ac34245bc7812ba4a7cb17d + pristine_git_object: 4996cf51527f18ee273b1ec1b4e6c3fead16d44c docs/models/unpin.md: id: d3b597ed91fd last_write_checksum: sha1:c3f2d39278abdd61760af541adc0c4e0ff4c8aa7 @@ -2617,6 +2621,10 @@ trackedFiles: id: d1b7559999eb last_write_checksum: sha1:9bb496400435a160bbef383369eb1c2ae233b671 pristine_git_object: 85153af7ec594c2dbd1e4a8c2eba5ce713796265 + docs/sdks/authentication/README.md: + id: 45be241adfc3 + last_write_checksum: sha1:00dd796467da75767a02a401a28f0c4e282e0579 + pristine_git_object: d7fef01020971bbf42365f7218d9bb530f4347e1 docs/sdks/clientactivity/README.md: id: a309613986a5 last_write_checksum: sha1:e7c6971c7d9683ce04aacd6cb96f467376c843e9 @@ -2723,12 +2731,12 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pylintrc: id: 7ce8b9f946e6 - last_write_checksum: sha1:a6bceac7d3da09ebdfe86a1d0c8d477a93177d50 - pristine_git_object: 33c17ec92e441b6c363a28a5b7319df5a2ad94dd + last_write_checksum: sha1:d2c9adbaae2a8afa89572ee4b0a8866b3f4e3193 + pristine_git_object: e2fda7fe263c2a111e53872e3ad5bc324b4dccfe pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:3beafefd957e896f7c0798271a0778593510ae94 - pristine_git_object: 470fcff636f7706ad9455cc85d75027c0ee6af4c + last_write_checksum: sha1:8e7869a84ec05f482a7e02eb3ac7c4e268dfdfc6 + pristine_git_object: 1697f7e0b295af2f4094232e666e9eff6a4d4d80 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:c2c83f71dea61eb50c9e05da83b16d18b4da8794 @@ -2755,8 +2763,8 @@ trackedFiles: pristine_git_object: 58c4d70ac1797b86ff5c4237cafbc344c42d8f64 src/glean/api_client/_version.py: id: 0ce22b26136b - last_write_checksum: sha1:f69e6793220f22f9e8cd5e9d5b114f6063248c4f - pristine_git_object: d7246f682a0f5e9bc8b1ac61d0380d40d9ebd894 + last_write_checksum: sha1:ad364a656d38e32a1c1a528364700f94839986ab + pristine_git_object: 0cba552d2edd6eeb52410ef1a127271395525a0e src/glean/api_client/agents.py: id: b925701a9217 last_write_checksum: sha1:c1688c3d141db7707458f3ac7ff29c4a71e6812b @@ -2769,6 +2777,10 @@ trackedFiles: id: 184a18f8be7e last_write_checksum: sha1:f3ffa432a16a6528c67f6ea2e15194d6b6d8fafc pristine_git_object: 1d98caa4f6a0e237799de7679aaf1c5b70e5becb + src/glean/api_client/authentication.py: + id: 84ebb3cfd339 + last_write_checksum: sha1:fd43e28a3346fa12d3e7c8a453cc35e3d72b35d8 + pristine_git_object: 90fa357df14260a5a952f42b0b8500c5fee5968b src/glean/api_client/basesdk.py: id: a9eeecf7fa49 last_write_checksum: sha1:ccda2f226cc0c1b7d991c8210afaf86920ff7fdf @@ -2779,8 +2791,8 @@ trackedFiles: pristine_git_object: 4b013bd3d9726dd28721776467185943d5181c6d src/glean/api_client/client_activity.py: id: 8227dd95d034 - last_write_checksum: sha1:98e3a81d016b0af7e98c5e310f61e4f86fb7e3aa - pristine_git_object: 51e6d222b328f5b8aa2cb43e50ec4ce7f142799a + last_write_checksum: sha1:f3e0153f219145193b094f16666a940d45a91cd2 + pristine_git_object: c181393ecfc1a231f8cfc86bd32812a91531a4f3 src/glean/api_client/client_authentication.py: id: 0b237b7c1b11 last_write_checksum: sha1:fc023e2dc967b1cfc72648f6ea1c41b04c3e6ca9 @@ -2791,8 +2803,8 @@ trackedFiles: pristine_git_object: 0ffec2f50edbd051e77ac69561d5187248be2ecc src/glean/api_client/client_documents.py: id: dac599de515c - last_write_checksum: sha1:6d3b776e9ee936a4f2495366adf28d2fcfe04111 - pristine_git_object: da16a0cc73800ae8eb9c3e3a7ae8fc6fc1d898ca + last_write_checksum: sha1:db7a459040a730afdc04a21d95834408cef53fdb + pristine_git_object: 9170a7a7b24ae78cea1c9d934f4eef115fafedd3 src/glean/api_client/client_governance.py: id: 106860f10ce0 last_write_checksum: sha1:ebe769873505002b9f00342174c7fd2508af52b6 @@ -2823,8 +2835,8 @@ trackedFiles: pristine_git_object: 2564ac766b63e3373d8db9350570edcf319d211d src/glean/api_client/errors/__init__.py: id: 88bbd5450191 - last_write_checksum: sha1:7010831bb2b29420d9c433d0741b1e47954bfc8a - pristine_git_object: b6997f96e5fded645bec2609c7530048d81827cc + last_write_checksum: sha1:a070425d6b343a94b14e395754898f1169c899f3 + pristine_git_object: 185efb348fb668e36af44ca0d59cf401ca40c003 src/glean/api_client/errors/collectionerror.py: id: c0932ce3ae9f last_write_checksum: sha1:0b5f08e5372726fe70cd721719c386d0e21d0dcc @@ -2895,8 +2907,8 @@ trackedFiles: pristine_git_object: 1c182cb0150642014463e1ceec8bc8b785e5b9f3 src/glean/api_client/models/__init__.py: id: d5f6ea5efcbe - last_write_checksum: sha1:46be958285ce9accb7bdf7f330798638653d428d - pristine_git_object: 4c202c7fbcfa315e0c7ae679d8affe728ed475b3 + last_write_checksum: sha1:063f018262ae580319a4e731ecb96e5f42def78d + pristine_git_object: 87205efe337c29272a0f98670502f8ba401e231d src/glean/api_client/models/actionsummary.py: id: 34ccdf9f1526 last_write_checksum: sha1:feac9468c6b2885ce11bf306ca94d3de53aac70f @@ -3185,6 +3197,10 @@ trackedFiles: id: c2b8ed9c9949 last_write_checksum: sha1:cbab16f7d4e844d51bf2294e9d7de92ce1891275 pristine_git_object: f4a630c009419f6f9144d393a808957c75b1eb3c + src/glean/api_client/models/checkdatasourceauthresponse.py: + id: 4b92648bff66 + last_write_checksum: sha1:6b448e1f738f635983ab023658febd17d68f36bf + pristine_git_object: 3a043334e052e58c3ad73c407ec235556034208d src/glean/api_client/models/checkdocumentaccessrequest.py: id: 8ae1352111ea last_write_checksum: sha1:5c9a03c342cc40cf9618527f4802af3d9a4a49cd @@ -4723,8 +4739,8 @@ trackedFiles: pristine_git_object: 9594a7bfffd04c21e4fdf0c792b3474ed631cb6d src/glean/api_client/models/unauthorizeddatasourceinstance.py: id: d3507c78b8df - last_write_checksum: sha1:3d459bc261d6454e5de6b65badac97a0961a8789 - pristine_git_object: af58b4cc939b97768380c0126de0101c374d3162 + last_write_checksum: sha1:f296ce21379e31857108f7d3f0c77c4346385bef + pristine_git_object: bec92224397eb6772fbc857bb6048360d48b5eb1 src/glean/api_client/models/unpin.py: id: fd3f7ecf7a4f last_write_checksum: sha1:38b097cc87897b932f2f52ecc1e8cebc9a7833a8 @@ -4911,8 +4927,8 @@ trackedFiles: pristine_git_object: fc7fbb02488d301c6bdfcfe1430d61e35efd4e6f src/glean/api_client/sdk.py: id: e2de37b3ce92 - last_write_checksum: sha1:57e601d2bfc7337b46fe32feb9e67cd2e4a78bb2 - pristine_git_object: 0055ec5d4dfdfb3962f5a7323478f6489867881f + last_write_checksum: sha1:87a22ee048fef8c5ac40fd39aae8027b032849a2 + pristine_git_object: a0a9f4fe7d0fa93eed408014189bb36e537da847 src/glean/api_client/sdkconfiguration.py: id: f356ce00b5b7 last_write_checksum: sha1:1ae43e08ae57ae277b3ab5e66b52d020149ebe00 @@ -4935,8 +4951,8 @@ trackedFiles: pristine_git_object: a9a640a1a7048736383f96c67c6290c86bf536ee src/glean/api_client/utils/__init__.py: id: d681dc4f06b3 - last_write_checksum: sha1:a1922915f24e0adeae90f93d52df05f1ec5316a2 - pristine_git_object: f13a71ee54ffaddd27d9102b7952d1a060c136d9 + last_write_checksum: sha1:0f93d821f9cb3e061ea125d881bb6f61166738dd + pristine_git_object: aded7597c2bbc4e3fa7f555755d894671ac57741 src/glean/api_client/utils/annotations.py: id: 8431a3a9fc4f last_write_checksum: sha1:a4824ad65f730303e4e1e3ec1febf87b4eb46dbc @@ -5044,7 +5060,7 @@ trackedFiles: tests/mockserver/internal/handler/generated_handler.go: last_write_checksum: sha1:32101ddff940c59f43a805af303cf645a2bcca0d tests/mockserver/internal/handler/generated_handlers.go: - last_write_checksum: sha1:76cd04100088457139ecd6643cfd7494ebda9fa6 + last_write_checksum: sha1:2aaafbb3aade11b06561dc8efe935abbe714195d tests/mockserver/internal/handler/pathgetrestapiv1agentsagentid.go: last_write_checksum: sha1:5210b43a5c1c7157ff57f7140449d82dc622931f tests/mockserver/internal/handler/pathgetrestapiv1agentsagentidschemas.go: @@ -5119,6 +5135,8 @@ trackedFiles: last_write_checksum: sha1:094d64ddc73a91d38e64e3be18690ebb9d4ef3d3 tests/mockserver/internal/handler/pathpostrestapiv1chat.go: last_write_checksum: sha1:0e62b904cb8354c1da5300d5f5b5b5a996c31716 + tests/mockserver/internal/handler/pathpostrestapiv1checkdatasourceauth.go: + last_write_checksum: sha1:bfd126dda7eb1a68c0edd1403c89770a4907aec9 tests/mockserver/internal/handler/pathpostrestapiv1createannouncement.go: last_write_checksum: sha1:fe9097d90fc9db0248506b6d1d27a5551dda73c4 tests/mockserver/internal/handler/pathpostrestapiv1createanswer.go: @@ -5126,7 +5144,7 @@ trackedFiles: tests/mockserver/internal/handler/pathpostrestapiv1createauthtoken.go: last_write_checksum: sha1:6ce83ba03066acb436796c018d19715615f548c1 tests/mockserver/internal/handler/pathpostrestapiv1createcollection.go: - last_write_checksum: sha1:f9f4c718408bddadbdf826194f07970bb111e57e + last_write_checksum: sha1:14b4a1d98dd55ce2b487ae1aaab4a7dece08df25 tests/mockserver/internal/handler/pathpostrestapiv1createshortcut.go: last_write_checksum: sha1:dcdf684a85e20db1aee571db9a54a3ee259d71d5 tests/mockserver/internal/handler/pathpostrestapiv1deleteallchats.go: @@ -5160,7 +5178,7 @@ trackedFiles: tests/mockserver/internal/handler/pathpostrestapiv1getanswer.go: last_write_checksum: sha1:3bec6f7cd190f9394bebac2407f9d7f1e606e479 tests/mockserver/internal/handler/pathpostrestapiv1getchat.go: - last_write_checksum: sha1:089475adb3686c656bd0eb52940285a7e037ab83 + last_write_checksum: sha1:2c2b7acb22e422a721a21801cccfa30fedfd3169 tests/mockserver/internal/handler/pathpostrestapiv1getchatapplication.go: last_write_checksum: sha1:7b81898137fdb3a89b4dcfa318b9b5b92e8860c0 tests/mockserver/internal/handler/pathpostrestapiv1getchatfiles.go: @@ -5365,6 +5383,8 @@ trackedFiles: last_write_checksum: sha1:7fdeb40ae9549e1c24317776d28aa65cb311d7ce tests/mockserver/internal/sdk/models/components/chatzerostatesuggestionoptions.go: last_write_checksum: sha1:da633547681ec1c8ef5df79cc1d2919fb3714d13 + tests/mockserver/internal/sdk/models/components/checkdatasourceauthresponse.go: + last_write_checksum: sha1:caa976ebc0e76d521725d4dd83e17c840842fd9a tests/mockserver/internal/sdk/models/components/checkdocumentaccessrequest.go: last_write_checksum: sha1:4b403181de5f24bde26d022703e625a832f685c8 tests/mockserver/internal/sdk/models/components/checkdocumentaccessresponse.go: @@ -6022,7 +6042,7 @@ trackedFiles: tests/mockserver/internal/sdk/models/components/ugctype.go: last_write_checksum: sha1:b2c7d1fbd1cbcb64e9ff92e786853554cea97772 tests/mockserver/internal/sdk/models/components/unauthorizeddatasourceinstance.go: - last_write_checksum: sha1:09ee3d49ff814630448f3f691a197fc4891f68ee + last_write_checksum: sha1:39fb84396b33bc645fb5e6ebcea36ab88b5db179 tests/mockserver/internal/sdk/models/components/unpin.go: last_write_checksum: sha1:6bd1f6c9f451492810949a589b7cf0e07ede176d tests/mockserver/internal/sdk/models/components/updateannouncementrequest.go: @@ -6107,6 +6127,8 @@ trackedFiles: last_write_checksum: sha1:f2f55f4fecbef27cf1e00a589d3cea6d95982523 tests/mockserver/internal/sdk/models/operations/chatstream.go: last_write_checksum: sha1:b299a7da20b4ecf28e85b669de479778ed917ef1 + tests/mockserver/internal/sdk/models/operations/checkdatasourceauth.go: + last_write_checksum: sha1:4ea8a844fedb81791dbff6fd5b45031943c118ed tests/mockserver/internal/sdk/models/operations/createandstreamrun.go: last_write_checksum: sha1:ff0bc51a66cdb65f5d36415c82e92377fd0d2cff tests/mockserver/internal/sdk/models/operations/createandwaitrun.go: @@ -6377,6 +6399,10 @@ trackedFiles: id: 2a6f19947b0a last_write_checksum: sha1:5d35f3a66ce3b29bbeae63214bdb11dce23e30de pristine_git_object: 3b4390d4615a656819f3457afdffb823aac56cab + tests/test_authentication.py: + id: dc4a998a8261 + last_write_checksum: sha1:ce73311cbee01b7b6612a34c45daeb477eaf8e27 + pristine_git_object: 438848aa8e7cfbb61811d4b65a16af10b0a2e97e tests/test_calendar.py: id: 255e2a2c77ee last_write_checksum: sha1:933ca9c7da1cfab204f0acc1005c29118b08162a @@ -7217,6 +7243,11 @@ examples: parameters: path: id: 741945 + checkdatasourceauth: + speakeasy-default-checkdatasourceauth: + responses: + "200": + application/json: {"unauthorizedDatasourceInstances": [{"datasourceInstance": "slack_0", "displayName": "Slack"}]} examplesVersion: 1.0.2 generatedTests: activity: "2025-04-28T22:05:12+01:00" @@ -7364,7 +7395,10 @@ generatedTests: updateshortcut: "2025-06-12T19:13:52-04:00" listfindingsexports: "2025-12-10T17:53:31Z" downloadfindingsexport: "2025-12-10T17:53:31Z" -releaseNotes: "## Python SDK Changes:\n* `glean.client.chat.create()`: \n * `request.messages[].message_type` **Changed**\n * `response` **Changed** (Breaking ⚠️)\n* `glean.client.chat.retrieve()`: `response.chat_result.chat.messages[].message_type` **Changed** (Breaking ⚠️)\n* `glean.client.chat.create_stream()`: \n * `request.messages[].message_type` **Changed**\n* `glean.client.messages.retrieve()`: `response.search_response.glean_data_error.unauthorized_datasource_instances` **Added**\n* `glean.client.search.query_as_admin()`: \n * `response.glean_data_error.unauthorized_datasource_instances` **Added**\n * `error.unauthorized_datasource_instances` **Added**\n* `glean.client.search.autocomplete()`: `response.glean_data_error.unauthorized_datasource_instances` **Added**\n* `glean.client.search.recommendations()`: `response.glean_data_error.unauthorized_datasource_instances` **Added**\n* `glean.client.search.query()`: \n * `response.glean_data_error.unauthorized_datasource_instances` **Added**\n * `error.unauthorized_datasource_instances` **Added**\n" + checkdatasourceauth: "2026-02-19T15:48:52Z" +releaseNotes: | + ## Python SDK Changes: + * `glean.authentication.checkdatasourceauth()`: **Added** generatedFiles: - .devcontainer/README.md - .devcontainer/devcontainer.json diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index dee332c2..a3c1a0a6 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -33,7 +33,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: true python: - version: 0.12.6 + version: 0.12.7 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/glean-merged-spec.yaml b/.speakeasy/glean-merged-spec.yaml index ea5abe51..22519199 100644 --- a/.speakeasy/glean-merged-spec.yaml +++ b/.speakeasy/glean-merged-spec.yaml @@ -2,7 +2,7 @@ openapi: 3.0.0 info: version: 0.9.0 title: Glean API - x-source-commit-sha: c18dcdd4226ac90fc693febef0db4e2f85b66110 + x-source-commit-sha: 204dc378669e42116b8b928d58d5fddabb228aef description: | # Introduction In addition to the data sources that Glean has built-in support for, Glean also provides a REST API that enables customers to put arbitrary content in the search index. This is useful, for example, for doing permissions-aware search over content in internal tools that reside on-prem as well as for searching over applications that Glean does not currently support first class. In addition these APIs allow the customer to push organization data (people info, organization structure etc) into Glean. @@ -22,7 +22,7 @@ info: These API clients provide type-safe, idiomatic interfaces for working with Glean IndexingAPIs in your language of choice. x-logo: url: https://app.glean.com/images/glean-text2.svg - x-open-api-commit-sha: 8a421bb426d1efd54c918437077acb779a4ae87f + x-open-api-commit-sha: 8a4d8a857ef07a135526624459142e85f9444ec2 x-speakeasy-name: 'Glean API' servers: - url: https://{instance}-be.glean.com @@ -363,6 +363,33 @@ paths: x-speakeasy-deprecation-message: "Deprecated on 2026-01-21, removal scheduled for 2026-10-15: Answer boards have been removed and this endpoint no longer serves a purpose" x-speakeasy-name-override: list x-speakeasy-group: client.answers + /rest/api/v1/checkdatasourceauth: + post: + tags: + - Authentication + summary: Check datasource authorization + description: | + Returns all datasource instances that require per-user OAuth authorization + for the authenticated user, along with a transient auth token that can be + appended to auth URLs to complete OAuth flows. + + Clients construct the full OAuth URL by combining the backend base URL, + the `authUrlRelativePath` from each instance, and the transient auth token: + `/?transient_auth_token=`. + operationId: checkdatasourceauth + x-visibility: Public + parameters: [] + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/CheckDatasourceAuthResponse" + "401": + description: Not Authorized + "429": + description: Too Many Requests /rest/api/v1/createauthtoken: post: tags: @@ -7305,6 +7332,48 @@ components: items: $ref: "#/components/schemas/AnswerResult" description: List of answers with tracking tokens. + AuthStatus: + type: string + description: The per-user authorization status for a datasource. + enum: + - DISABLED + - AWAITING_AUTH + - AUTHORIZED + - STALE_OAUTH + - SEG_MIGRATION + x-enum-varnames: + - AUTH_STATUS_DISABLED + - AUTH_STATUS_AWAITING_AUTH + - AUTH_STATUS_AUTHORIZED + - AUTH_STATUS_STALE_OAUTH + - AUTH_STATUS_SEG_MIGRATION + UnauthorizedDatasourceInstance: + description: | + A datasource instance that could not return results for this request because the user has not completed or has expired per-user OAuth. + properties: + datasourceInstance: + type: string + description: | + The instance identifier (e.g. "github", "github_enterprise_0", "slack_0"). Matches the instance names used in datasource configuration. + example: slack_0 + displayName: + type: string + description: Human-readable name of the datasource instance for display. + example: Slack + authStatus: + $ref: "#/components/schemas/AuthStatus" + authUrlRelativePath: + type: string + description: | + Relative path to initiate or resume OAuth for the current user and instance, including a one-time authentication token as a query parameter. Clients should prepend their configured Glean backend base URL. + CheckDatasourceAuthResponse: + properties: + unauthorizedDatasourceInstances: + type: array + description: | + Datasource instances that require per-user OAuth authorization. Empty or absent when all datasources are authorized. + items: + $ref: "#/components/schemas/UnauthorizedDatasourceInstance" CreateAuthTokenResponse: required: - token @@ -7850,40 +7919,6 @@ components: stream: type: boolean description: If set, response lines will be streamed one-by-one as they become available. Each will be a ChatResponse, formatted as JSON, and separated by a new line. If false, the entire response will be returned at once. Note that if this is set and the model being used does not support streaming, the model's response will not be streamed, but other messages from the endpoint still will be. - AuthStatus: - type: string - description: The per-user authorization status for a datasource. - enum: - - DISABLED - - AWAITING_AUTH - - AUTHORIZED - - STALE_OAUTH - - SEG_MIGRATION - x-enum-varnames: - - AUTH_STATUS_DISABLED - - AUTH_STATUS_AWAITING_AUTH - - AUTH_STATUS_AUTHORIZED - - AUTH_STATUS_STALE_OAUTH - - AUTH_STATUS_SEG_MIGRATION - UnauthorizedDatasourceInstance: - description: | - A datasource instance that could not return results for this request because the user has not completed or has expired per-user OAuth. - properties: - datasourceInstance: - type: string - description: | - The instance identifier (e.g. "github", "github_enterprise_0", "slack_0"). Matches the instance names used in datasource configuration. - example: slack_0 - displayName: - type: string - description: Human-readable name of the datasource instance for display. - example: Slack - authStatus: - $ref: "#/components/schemas/AuthStatus" - authUrlRelativePath: - type: string - description: | - Relative path to initiate or resume OAuth for the current user and instance. Clients should prepend their configured Glean backend base URL. ChatResponse: description: A single response from the /chat backend. properties: diff --git a/.speakeasy/tests.arazzo.yaml b/.speakeasy/tests.arazzo.yaml index 22679c7e..4494b3be 100644 --- a/.speakeasy/tests.arazzo.yaml +++ b/.speakeasy/tests.arazzo.yaml @@ -158436,3 +158436,16 @@ workflows: type: simple x-speakeasy-test-group: Governance x-speakeasy-test-rebuild: true + - workflowId: checkdatasourceauth + steps: + - stepId: test + operationId: checkdatasourceauth + successCriteria: + - condition: $statusCode == 200 + - condition: $response.header.Content-Type == application/json + - context: $response.body + condition: | + {"unauthorizedDatasourceInstances":[{"datasourceInstance":"slack_0","displayName":"Slack"}]} + type: simple + x-speakeasy-test-group: Authentication + x-speakeasy-test-rebuild: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index b9c22921..9db52a1f 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,12 +1,12 @@ -speakeasyVersion: 1.722.0 +speakeasyVersion: 1.722.7 sources: Glean API: sourceNamespace: glean-api-specs - sourceRevisionDigest: sha256:a417495716018a416b8210f6cb830654e301e408cceb567b5c86f81d5211db79 - sourceBlobDigest: sha256:163203ddf3ff04235c0ee40e8ec377e1093ff290525e24b89dfd28248a4c331a + sourceRevisionDigest: sha256:aa0a496396e723844c85b7713e2a2d9795a8e4c9bb8ad5f4119e1ff0b3f46fc1 + sourceBlobDigest: sha256:f052174bfef7ebd0efee80555a7ae4db9d3ba41118e726db87762ea1dbab1240 tags: - latest - - speakeasy-sdk-regen-1770751878 + - speakeasy-sdk-regen-1771467808 Glean Client API: sourceNamespace: glean-client-api sourceRevisionDigest: sha256:4edc63ad559e4f2c9fb9ebf5edaaaaa9269f1874d271cfd84b441d6dacac43d2 @@ -17,10 +17,10 @@ targets: glean: source: Glean API sourceNamespace: glean-api-specs - sourceRevisionDigest: sha256:a417495716018a416b8210f6cb830654e301e408cceb567b5c86f81d5211db79 - sourceBlobDigest: sha256:163203ddf3ff04235c0ee40e8ec377e1093ff290525e24b89dfd28248a4c331a + sourceRevisionDigest: sha256:aa0a496396e723844c85b7713e2a2d9795a8e4c9bb8ad5f4119e1ff0b3f46fc1 + sourceBlobDigest: sha256:f052174bfef7ebd0efee80555a7ae4db9d3ba41118e726db87762ea1dbab1240 codeSamplesNamespace: glean-api-specs-python-code-samples - codeSamplesRevisionDigest: sha256:062a7cca9f90a2135844881a40ebb2f3b6acc93274dec64146a96a4d72f481cb + codeSamplesRevisionDigest: sha256:f23770fa56fb7f38298e39c6a50f878d2ac7f7b136e13a173c7e74927bee3cd0 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index c4d81a82..0e9dcb12 100644 --- a/README.md +++ b/README.md @@ -337,6 +337,10 @@ For more information on obtaining the appropriate token type, please contact you
Available methods +### [Authentication](docs/sdks/authentication/README.md) + +* [checkdatasourceauth](docs/sdks/authentication/README.md#checkdatasourceauth) - Check datasource authorization + ### [Client.Activity](docs/sdks/clientactivity/README.md) * [report](docs/sdks/clientactivity/README.md#report) - Report document activity diff --git a/RELEASES.md b/RELEASES.md index 7bf30033..a5ebe41b 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -568,4 +568,14 @@ Based on: ### Generated - [python v0.12.6] . ### Releases -- [PyPI v0.12.6] https://pypi.org/project/glean-api-client/0.12.6 - . \ No newline at end of file +- [PyPI v0.12.6] https://pypi.org/project/glean-api-client/0.12.6 - . + +## 2026-02-19 15:47:56 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.722.7 (2.832.9) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.12.7] . +### Releases +- [PyPI v0.12.7] https://pypi.org/project/glean-api-client/0.12.7 - . \ No newline at end of file diff --git a/docs/models/checkdatasourceauthresponse.md b/docs/models/checkdatasourceauthresponse.md new file mode 100644 index 00000000..b1ea62b7 --- /dev/null +++ b/docs/models/checkdatasourceauthresponse.md @@ -0,0 +1,8 @@ +# CheckDatasourceAuthResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| `unauthorized_datasource_instances` | List[[models.UnauthorizedDatasourceInstance](../models/unauthorizeddatasourceinstance.md)] | :heavy_minus_sign: | Datasource instances that require per-user OAuth authorization. Empty or absent when all datasources are authorized.
| \ No newline at end of file diff --git a/docs/models/unauthorizeddatasourceinstance.md b/docs/models/unauthorizeddatasourceinstance.md index 3186f05e..4996cf51 100644 --- a/docs/models/unauthorizeddatasourceinstance.md +++ b/docs/models/unauthorizeddatasourceinstance.md @@ -6,9 +6,9 @@ A datasource instance that could not return results for this request because the ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | -| `datasource_instance` | *Optional[str]* | :heavy_minus_sign: | The instance identifier (e.g. "github", "github_enterprise_0", "slack_0"). Matches the instance names used in datasource configuration.
| slack_0 | -| `display_name` | *Optional[str]* | :heavy_minus_sign: | Human-readable name of the datasource instance for display. | Slack | -| `auth_status` | [Optional[models.AuthStatus]](../models/authstatus.md) | :heavy_minus_sign: | The per-user authorization status for a datasource. | | -| `auth_url_relative_path` | *Optional[str]* | :heavy_minus_sign: | Relative path to initiate or resume OAuth for the current user and instance. Clients should prepend their configured Glean backend base URL.
| | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `datasource_instance` | *Optional[str]* | :heavy_minus_sign: | The instance identifier (e.g. "github", "github_enterprise_0", "slack_0"). Matches the instance names used in datasource configuration.
| slack_0 | +| `display_name` | *Optional[str]* | :heavy_minus_sign: | Human-readable name of the datasource instance for display. | Slack | +| `auth_status` | [Optional[models.AuthStatus]](../models/authstatus.md) | :heavy_minus_sign: | The per-user authorization status for a datasource. | | +| `auth_url_relative_path` | *Optional[str]* | :heavy_minus_sign: | Relative path to initiate or resume OAuth for the current user and instance, including a one-time authentication token as a query parameter. Clients should prepend their configured Glean backend base URL.
| | \ No newline at end of file diff --git a/docs/sdks/authentication/README.md b/docs/sdks/authentication/README.md new file mode 100644 index 00000000..d7fef010 --- /dev/null +++ b/docs/sdks/authentication/README.md @@ -0,0 +1,55 @@ +# Authentication + +## Overview + +Manage indexing API tokens. + +### Available Operations + +* [checkdatasourceauth](#checkdatasourceauth) - Check datasource authorization + +## checkdatasourceauth + +Returns all datasource instances that require per-user OAuth authorization +for the authenticated user, along with a transient auth token that can be +appended to auth URLs to complete OAuth flows. + +Clients construct the full OAuth URL by combining the backend base URL, +the `authUrlRelativePath` from each instance, and the transient auth token: +`/?transient_auth_token=`. + + +### Example Usage + + +```python +from glean.api_client import Glean +import os + + +with Glean( + api_token=os.getenv("GLEAN_API_TOKEN", ""), +) as glean: + + res = glean.authentication.checkdatasourceauth() + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.CheckDatasourceAuthResponse](../../models/checkdatasourceauthresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------- | ----------------- | ----------------- | +| errors.GleanError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/pylintrc b/pylintrc index 33c17ec9..e2fda7fe 100644 --- a/pylintrc +++ b/pylintrc @@ -459,7 +459,8 @@ disable=raw-checker-failed, consider-using-with, wildcard-import, unused-wildcard-import, - too-many-return-statements + too-many-return-statements, + redefined-builtin # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option diff --git a/pyproject.toml b/pyproject.toml index 470fcff6..1697f7e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "glean-api-client" -version = "0.12.6" +version = "0.12.7" description = "Python Client SDK Generated by Speakeasy." authors = [{ name = "Glean Technologies, Inc." },] readme = "README-PYPI.md" diff --git a/src/glean/api_client/_version.py b/src/glean/api_client/_version.py index d7246f68..0cba552d 100644 --- a/src/glean/api_client/_version.py +++ b/src/glean/api_client/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "glean-api-client" -__version__: str = "0.12.6" +__version__: str = "0.12.7" __openapi_doc_version__: str = "0.9.0" -__gen_version__: str = "2.829.1" -__user_agent__: str = "speakeasy-sdk/python 0.12.6 2.829.1 0.9.0 glean-api-client" +__gen_version__: str = "2.832.9" +__user_agent__: str = "speakeasy-sdk/python 0.12.7 2.832.9 0.9.0 glean-api-client" try: if __package__ is not None: diff --git a/src/glean/api_client/authentication.py b/src/glean/api_client/authentication.py new file mode 100644 index 00000000..90fa357d --- /dev/null +++ b/src/glean/api_client/authentication.py @@ -0,0 +1,181 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from glean.api_client import errors, models, utils +from glean.api_client._hooks import HookContext +from glean.api_client.types import OptionalNullable, UNSET +from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response +from typing import Mapping, Optional + + +class Authentication(BaseSDK): + r"""Manage indexing API tokens.""" + + def checkdatasourceauth( + self, + *, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.CheckDatasourceAuthResponse: + r"""Check datasource authorization + + Returns all datasource instances that require per-user OAuth authorization + for the authenticated user, along with a transient auth token that can be + appended to auth URLs to complete OAuth flows. + + Clients construct the full OAuth URL by combining the backend base URL, + the `authUrlRelativePath` from each instance, and the transient auth token: + `/?transient_auth_token=`. + + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + req = self._build_request( + method="POST", + path="/rest/api/v1/checkdatasourceauth", + base_url=base_url, + url_variables=url_variables, + request=None, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="checkdatasourceauth", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + ), + request=req, + error_status_codes=["401", "429", "4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.CheckDatasourceAuthResponse, http_res) + if utils.match_response(http_res, ["401", "429", "4XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.GleanError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.GleanError("API error occurred", http_res, http_res_text) + + raise errors.GleanError("Unexpected response received", http_res) + + async def checkdatasourceauth_async( + self, + *, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.CheckDatasourceAuthResponse: + r"""Check datasource authorization + + Returns all datasource instances that require per-user OAuth authorization + for the authenticated user, along with a transient auth token that can be + appended to auth URLs to complete OAuth flows. + + Clients construct the full OAuth URL by combining the backend base URL, + the `authUrlRelativePath` from each instance, and the transient auth token: + `/?transient_auth_token=`. + + + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + req = self._build_request_async( + method="POST", + path="/rest/api/v1/checkdatasourceauth", + base_url=base_url, + url_variables=url_variables, + request=None, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="checkdatasourceauth", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + ), + request=req, + error_status_codes=["401", "429", "4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.CheckDatasourceAuthResponse, http_res) + if utils.match_response(http_res, ["401", "429", "4XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.GleanError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.GleanError("API error occurred", http_res, http_res_text) + + raise errors.GleanError("Unexpected response received", http_res) diff --git a/src/glean/api_client/client_activity.py b/src/glean/api_client/client_activity.py index 51e6d222..c181393e 100644 --- a/src/glean/api_client/client_activity.py +++ b/src/glean/api_client/client_activity.py @@ -233,7 +233,11 @@ def feedback( http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request.feedback1, False, True, "json", Optional[models.Feedback] + request.feedback1 if request is not None else None, + False, + True, + "json", + Optional[models.Feedback], ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -323,7 +327,11 @@ async def feedback_async( http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request.feedback1, False, True, "json", Optional[models.Feedback] + request.feedback1 if request is not None else None, + False, + True, + "json", + Optional[models.Feedback], ), allow_empty_value=None, timeout_ms=timeout_ms, diff --git a/src/glean/api_client/client_documents.py b/src/glean/api_client/client_documents.py index da16a0cc..9170a7a7 100644 --- a/src/glean/api_client/client_documents.py +++ b/src/glean/api_client/client_documents.py @@ -257,7 +257,7 @@ def retrieve( http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request.get_documents_request, + request.get_documents_request if request is not None else None, False, True, "json", @@ -355,7 +355,7 @@ async def retrieve_async( http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request.get_documents_request, + request.get_documents_request if request is not None else None, False, True, "json", @@ -457,7 +457,9 @@ def retrieve_by_facets( http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request.get_documents_by_facets_request, + request.get_documents_by_facets_request + if request is not None + else None, False, True, "json", @@ -561,7 +563,9 @@ async def retrieve_by_facets_async( http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request.get_documents_by_facets_request, + request.get_documents_by_facets_request + if request is not None + else None, False, True, "json", diff --git a/src/glean/api_client/errors/__init__.py b/src/glean/api_client/errors/__init__.py index b6997f96..185efb34 100644 --- a/src/glean/api_client/errors/__init__.py +++ b/src/glean/api_client/errors/__init__.py @@ -1,7 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from .gleanbaseerror import GleanBaseError -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from glean.api_client.utils.dynamic_imports import lazy_getattr, lazy_dir @@ -34,7 +34,7 @@ } -def __getattr__(attr_name: str) -> object: +def __getattr__(attr_name: str) -> Any: return lazy_getattr( attr_name, package=__package__, dynamic_imports=_dynamic_imports ) diff --git a/src/glean/api_client/models/__init__.py b/src/glean/api_client/models/__init__.py index 4c202c7f..87205efe 100644 --- a/src/glean/api_client/models/__init__.py +++ b/src/glean/api_client/models/__init__.py @@ -66,7 +66,7 @@ from .userrolespecification import UserRoleSpecification, UserRoleSpecificationTypedDict from .verification import State, Verification, VerificationTypedDict from .verificationmetadata import VerificationMetadata, VerificationMetadataTypedDict -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from glean.api_client.utils.dynamic_imports import lazy_getattr, lazy_dir @@ -267,6 +267,10 @@ ChatZeroStateSuggestionOptions, ChatZeroStateSuggestionOptionsTypedDict, ) + from .checkdatasourceauthresponse import ( + CheckDatasourceAuthResponse, + CheckDatasourceAuthResponseTypedDict, + ) from .checkdocumentaccessrequest import ( CheckDocumentAccessRequest, CheckDocumentAccessRequestTypedDict, @@ -1570,6 +1574,8 @@ "ChatTypedDict", "ChatZeroStateSuggestionOptions", "ChatZeroStateSuggestionOptionsTypedDict", + "CheckDatasourceAuthResponse", + "CheckDatasourceAuthResponseTypedDict", "CheckDocumentAccessRequest", "CheckDocumentAccessRequestTypedDict", "CheckDocumentAccessResponse", @@ -2693,6 +2699,8 @@ "ChatSuggestionTypedDict": ".chatsuggestion", "ChatZeroStateSuggestionOptions": ".chatzerostatesuggestionoptions", "ChatZeroStateSuggestionOptionsTypedDict": ".chatzerostatesuggestionoptions", + "CheckDatasourceAuthResponse": ".checkdatasourceauthresponse", + "CheckDatasourceAuthResponseTypedDict": ".checkdatasourceauthresponse", "CheckDocumentAccessRequest": ".checkdocumentaccessrequest", "CheckDocumentAccessRequestTypedDict": ".checkdocumentaccessrequest", "CheckDocumentAccessResponse": ".checkdocumentaccessresponse", @@ -3565,7 +3573,7 @@ } -def __getattr__(attr_name: str) -> object: +def __getattr__(attr_name: str) -> Any: return lazy_getattr( attr_name, package=__package__, dynamic_imports=_dynamic_imports ) diff --git a/src/glean/api_client/models/checkdatasourceauthresponse.py b/src/glean/api_client/models/checkdatasourceauthresponse.py new file mode 100644 index 00000000..3a043334 --- /dev/null +++ b/src/glean/api_client/models/checkdatasourceauthresponse.py @@ -0,0 +1,53 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .unauthorizeddatasourceinstance import ( + UnauthorizedDatasourceInstance, + UnauthorizedDatasourceInstanceTypedDict, +) +from glean.api_client.types import BaseModel, UNSET_SENTINEL +import pydantic +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CheckDatasourceAuthResponseTypedDict(TypedDict): + unauthorized_datasource_instances: NotRequired[ + List[UnauthorizedDatasourceInstanceTypedDict] + ] + r"""Datasource instances that require per-user OAuth authorization. Empty or absent when all datasources are authorized. + + """ + + +class CheckDatasourceAuthResponse(BaseModel): + unauthorized_datasource_instances: Annotated[ + Optional[List[UnauthorizedDatasourceInstance]], + pydantic.Field(alias="unauthorizedDatasourceInstances"), + ] = None + r"""Datasource instances that require per-user OAuth authorization. Empty or absent when all datasources are authorized. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["unauthorizedDatasourceInstances"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +try: + CheckDatasourceAuthResponse.model_rebuild() +except NameError: + pass diff --git a/src/glean/api_client/models/unauthorizeddatasourceinstance.py b/src/glean/api_client/models/unauthorizeddatasourceinstance.py index af58b4cc..bec92224 100644 --- a/src/glean/api_client/models/unauthorizeddatasourceinstance.py +++ b/src/glean/api_client/models/unauthorizeddatasourceinstance.py @@ -21,7 +21,7 @@ class UnauthorizedDatasourceInstanceTypedDict(TypedDict): auth_status: NotRequired[AuthStatus] r"""The per-user authorization status for a datasource.""" auth_url_relative_path: NotRequired[str] - r"""Relative path to initiate or resume OAuth for the current user and instance. Clients should prepend their configured Glean backend base URL. + r"""Relative path to initiate or resume OAuth for the current user and instance, including a one-time authentication token as a query parameter. Clients should prepend their configured Glean backend base URL. """ @@ -47,7 +47,7 @@ class UnauthorizedDatasourceInstance(BaseModel): auth_url_relative_path: Annotated[ Optional[str], pydantic.Field(alias="authUrlRelativePath") ] = None - r"""Relative path to initiate or resume OAuth for the current user and instance. Clients should prepend their configured Glean backend base URL. + r"""Relative path to initiate or resume OAuth for the current user and instance, including a one-time authentication token as a query parameter. Clients should prepend their configured Glean backend base URL. """ diff --git a/src/glean/api_client/sdk.py b/src/glean/api_client/sdk.py index 0055ec5d..a0a9f4fe 100644 --- a/src/glean/api_client/sdk.py +++ b/src/glean/api_client/sdk.py @@ -15,6 +15,7 @@ import weakref if TYPE_CHECKING: + from glean.api_client.authentication import Authentication from glean.api_client.client import Client from glean.api_client.governance import Governance from glean.api_client.indexing import Indexing @@ -41,10 +42,13 @@ class Glean(BaseSDK): """ client: "Client" + authentication: "Authentication" + r"""Manage indexing API tokens.""" indexing: "Indexing" governance: "Governance" _sub_sdk_map = { "client": ("glean.api_client.client", "Client"), + "authentication": ("glean.api_client.authentication", "Authentication"), "indexing": ("glean.api_client.indexing", "Indexing"), "governance": ("glean.api_client.governance", "Governance"), } diff --git a/src/glean/api_client/utils/__init__.py b/src/glean/api_client/utils/__init__.py index f13a71ee..aded7597 100644 --- a/src/glean/api_client/utils/__init__.py +++ b/src/glean/api_client/utils/__init__.py @@ -1,6 +1,6 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" -from typing import TYPE_CHECKING, Callable, TypeVar +from typing import Any, TYPE_CHECKING, Callable, TypeVar import asyncio from .dynamic_imports import lazy_getattr, lazy_dir @@ -168,7 +168,7 @@ async def run_sync_in_thread(func: Callable[..., _T], *args) -> _T: } -def __getattr__(attr_name: str) -> object: +def __getattr__(attr_name: str) -> Any: return lazy_getattr( attr_name, package=__package__, dynamic_imports=_dynamic_imports ) diff --git a/tests/mockserver/internal/handler/generated_handlers.go b/tests/mockserver/internal/handler/generated_handlers.go index baa0c72f..23b23873 100644 --- a/tests/mockserver/internal/handler/generated_handlers.go +++ b/tests/mockserver/internal/handler/generated_handlers.go @@ -49,6 +49,7 @@ func GeneratedHandlers(ctx context.Context, dir *logging.HTTPFileDirectory, rt * NewGeneratedHandler(ctx, http.MethodPost, "/rest/api/v1/adminsearch", pathPostRestAPIV1Adminsearch(dir, rt)), NewGeneratedHandler(ctx, http.MethodPost, "/rest/api/v1/autocomplete", pathPostRestAPIV1Autocomplete(dir, rt)), NewGeneratedHandler(ctx, http.MethodPost, "/rest/api/v1/chat", pathPostRestAPIV1Chat(dir, rt)), + NewGeneratedHandler(ctx, http.MethodPost, "/rest/api/v1/checkdatasourceauth", pathPostRestAPIV1Checkdatasourceauth(dir, rt)), NewGeneratedHandler(ctx, http.MethodPost, "/rest/api/v1/createannouncement", pathPostRestAPIV1Createannouncement(dir, rt)), NewGeneratedHandler(ctx, http.MethodPost, "/rest/api/v1/createanswer", pathPostRestAPIV1Createanswer(dir, rt)), NewGeneratedHandler(ctx, http.MethodPost, "/rest/api/v1/createauthtoken", pathPostRestAPIV1Createauthtoken(dir, rt)), diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1checkdatasourceauth.go b/tests/mockserver/internal/handler/pathpostrestapiv1checkdatasourceauth.go new file mode 100644 index 00000000..41731f5c --- /dev/null +++ b/tests/mockserver/internal/handler/pathpostrestapiv1checkdatasourceauth.go @@ -0,0 +1,70 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package handler + +import ( + "fmt" + "log" + "mockserver/internal/handler/assert" + "mockserver/internal/logging" + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/types" + "mockserver/internal/sdk/utils" + "mockserver/internal/tracking" + "net/http" +) + +func pathPostRestAPIV1Checkdatasourceauth(dir *logging.HTTPFileDirectory, rt *tracking.RequestTracker) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + test := req.Header.Get("x-speakeasy-test-name") + instanceID := req.Header.Get("x-speakeasy-test-instance-id") + + count := rt.GetRequestCount(test, instanceID) + + switch fmt.Sprintf("%s[%d]", test, count) { + case "checkdatasourceauth[0]": + dir.HandlerFunc("checkdatasourceauth", testCheckdatasourceauthCheckdatasourceauth0)(w, req) + default: + http.Error(w, fmt.Sprintf("Unknown test: %s[%d]", test, count), http.StatusBadRequest) + } + } +} + +func testCheckdatasourceauthCheckdatasourceauth0(w http.ResponseWriter, req *http.Request) { + if err := assert.SecurityAuthorizationHeader(req, false, "Bearer"); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusUnauthorized) + return + } + if err := assert.AcceptHeader(req, []string{"application/json"}); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + if err := assert.HeaderExists(req, "User-Agent"); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + var respBody *components.CheckDatasourceAuthResponse = &components.CheckDatasourceAuthResponse{ + UnauthorizedDatasourceInstances: []components.UnauthorizedDatasourceInstance{ + components.UnauthorizedDatasourceInstance{ + DatasourceInstance: types.String("slack_0"), + DisplayName: types.String("Slack"), + }, + }, + } + respBodyBytes, err := utils.MarshalJSON(respBody, "", true) + + if err != nil { + http.Error( + w, + "Unable to encode response body as JSON: "+err.Error(), + http.StatusInternalServerError, + ) + return + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + _, _ = w.Write(respBodyBytes) +} diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1createcollection.go b/tests/mockserver/internal/handler/pathpostrestapiv1createcollection.go index 5c99a0ad..371b9023 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1createcollection.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1createcollection.go @@ -56,14 +56,14 @@ func testCreatecollectionCreatecollection0(w http.ResponseWriter, req *http.Requ operations.ResponseBody2{ Collection: &components.Collection{ Name: "", - Description: "motionless whenever paintwork import over cuckoo", + Description: "whole busily jive hawk gee basic minus hence", AddedRoles: []components.UserRoleSpecification{ components.UserRoleSpecification{ Person: &components.Person{ Name: "George Clooney", ObfuscatedID: "abc123", }, - Role: components.UserRoleOwner, + Role: components.UserRoleAnswerModerator, }, }, RemovedRoles: []components.UserRoleSpecification{ @@ -90,7 +90,7 @@ func testCreatecollectionCreatecollection0(w http.ResponseWriter, req *http.Requ }, }, }, - ID: 363711, + ID: 158969, Creator: &components.Person{ Name: "George Clooney", ObfuscatedID: "abc123", @@ -101,7 +101,7 @@ func testCreatecollectionCreatecollection0(w http.ResponseWriter, req *http.Requ }, Items: []components.CollectionItem{ components.CollectionItem{ - CollectionID: 570197, + CollectionID: 110375, CreatedBy: &components.Person{ Name: "George Clooney", ObfuscatedID: "abc123", @@ -266,13 +266,13 @@ func testCreatecollectionCreatecollection0(w http.ResponseWriter, req *http.Requ Name: "George Clooney", ObfuscatedID: "abc123", }, - Role: components.UserRoleAnswerModerator, + Role: components.UserRoleEditor, }, }, }, Collection: &components.Collection{ Name: "", - Description: "athwart skateboard newsstand farm bourgeoisie ah how elliptical aha well-to-do", + Description: "wedge colorfully orientate rally", AudienceFilters: []components.FacetFilter{ components.FacetFilter{ FieldName: types.String("type"), @@ -288,7 +288,7 @@ func testCreatecollectionCreatecollection0(w http.ResponseWriter, req *http.Requ }, }, }, - ID: 643990, + ID: 131797, Creator: &components.Person{ Name: "George Clooney", ObfuscatedID: "abc123", @@ -300,7 +300,7 @@ func testCreatecollectionCreatecollection0(w http.ResponseWriter, req *http.Requ Children: []components.Collection{ components.Collection{ Name: "", - Description: "woot purse salty even as advanced", + Description: "outside yippee sidetrack mature regularly mouser inject worth", AudienceFilters: []components.FacetFilter{ components.FacetFilter{ FieldName: types.String("type"), @@ -316,7 +316,7 @@ func testCreatecollectionCreatecollection0(w http.ResponseWriter, req *http.Requ }, }, }, - ID: 359978, + ID: 149448, Creator: &components.Person{ Name: "George Clooney", ObfuscatedID: "abc123", @@ -328,7 +328,7 @@ func testCreatecollectionCreatecollection0(w http.ResponseWriter, req *http.Requ }, }, }, - ItemType: components.CollectionItemItemTypeURL, + ItemType: components.CollectionItemItemTypeCollection, }, }, }, diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1getchat.go b/tests/mockserver/internal/handler/pathpostrestapiv1getchat.go index 020eb777..023af9c7 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1getchat.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1getchat.go @@ -628,8 +628,8 @@ func testGetchatGetchat0(w http.ResponseWriter, req *http.Request) { Roles: []components.UserRoleSpecification{}, SourceDocumentSpec: types.Pointer(components.CreateDocumentSpecUnionDocumentSpec3( components.DocumentSpec3{ - UgcType: components.DocumentSpecUgcType1Shortcuts, - ContentID: 602763, + UgcType: components.DocumentSpecUgcType1Announcements, + ContentID: 848009, }, )), SourceType: components.AnswerSourceTypeAssistant.ToPointer(), diff --git a/tests/mockserver/internal/sdk/models/components/checkdatasourceauthresponse.go b/tests/mockserver/internal/sdk/models/components/checkdatasourceauthresponse.go new file mode 100644 index 00000000..ff5addac --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/checkdatasourceauthresponse.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type CheckDatasourceAuthResponse struct { + // Datasource instances that require per-user OAuth authorization. Empty or absent when all datasources are authorized. + // + UnauthorizedDatasourceInstances []UnauthorizedDatasourceInstance `json:"unauthorizedDatasourceInstances,omitempty"` +} + +func (o *CheckDatasourceAuthResponse) GetUnauthorizedDatasourceInstances() []UnauthorizedDatasourceInstance { + if o == nil { + return nil + } + return o.UnauthorizedDatasourceInstances +} diff --git a/tests/mockserver/internal/sdk/models/components/unauthorizeddatasourceinstance.go b/tests/mockserver/internal/sdk/models/components/unauthorizeddatasourceinstance.go index a57ee947..78d5650a 100644 --- a/tests/mockserver/internal/sdk/models/components/unauthorizeddatasourceinstance.go +++ b/tests/mockserver/internal/sdk/models/components/unauthorizeddatasourceinstance.go @@ -11,7 +11,7 @@ type UnauthorizedDatasourceInstance struct { DisplayName *string `json:"displayName,omitempty"` // The per-user authorization status for a datasource. AuthStatus *AuthStatus `json:"authStatus,omitempty"` - // Relative path to initiate or resume OAuth for the current user and instance. Clients should prepend their configured Glean backend base URL. + // Relative path to initiate or resume OAuth for the current user and instance, including a one-time authentication token as a query parameter. Clients should prepend their configured Glean backend base URL. // AuthURLRelativePath *string `json:"authUrlRelativePath,omitempty"` } diff --git a/tests/mockserver/internal/sdk/models/operations/checkdatasourceauth.go b/tests/mockserver/internal/sdk/models/operations/checkdatasourceauth.go new file mode 100644 index 00000000..55046755 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/checkdatasourceauth.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CheckdatasourceauthResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // OK + CheckDatasourceAuthResponse *components.CheckDatasourceAuthResponse +} + +func (o *CheckdatasourceauthResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CheckdatasourceauthResponse) GetCheckDatasourceAuthResponse() *components.CheckDatasourceAuthResponse { + if o == nil { + return nil + } + return o.CheckDatasourceAuthResponse +} diff --git a/tests/test_authentication.py b/tests/test_authentication.py new file mode 100644 index 00000000..438848aa --- /dev/null +++ b/tests/test_authentication.py @@ -0,0 +1,19 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from glean.api_client import Glean +import os +from tests.test_client import create_test_http_client + + +def test_authentication_checkdatasourceauth(): + test_http_client = create_test_http_client("checkdatasourceauth") + + with Glean( + server_url=os.getenv("TEST_SERVER_URL", "http://localhost:18080"), + client=test_http_client, + api_token=os.getenv("GLEAN_API_TOKEN", "value"), + ) as glean: + assert glean is not None + + res = glean.authentication.checkdatasourceauth() + assert res is not None From 805b0d9301e8025c04cbe3319531c735cdc11da2 Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 15:51:28 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow