From 4dd51c39d4b0f5a1e984adc166a50ffa6594be7c Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Thu, 19 Feb 2026 15:55:06 +0000 Subject: [PATCH 1/2] ## Typescript SDK Changes: * `glean.authentication.checkdatasourceauth()`: **Added** --- .speakeasy/gen.lock | 108 +++++++++---- .speakeasy/gen.yaml | 2 +- .speakeasy/glean-merged-spec.yaml | 107 ++++++++----- .speakeasy/tests.arazzo.yaml | 13 ++ .speakeasy/workflow.lock | 14 +- README.md | 6 + RELEASES.md | 12 +- .../components/checkdatasourceauthresponse.md | 22 +++ .../unauthorizeddatasourceinstance.md | 12 +- docs/sdks/authentication/README.md | 101 ++++++++++++ examples/package-lock.json | 2 +- jsr.json | 2 +- package-lock.json | 4 +- package.json | 2 +- src/__tests__/authentication.test.ts | 20 +++ src/__tests__/messages.test.ts | 2 +- .../internal/handler/generated_handlers.go | 1 + .../pathpostrestapiv1checkdatasourceauth.go | 70 +++++++++ .../handler/pathpostrestapiv1getchat.go | 4 +- .../components/checkdatasourceauthresponse.go | 16 ++ .../unauthorizeddatasourceinstance.go | 2 +- .../models/operations/checkdatasourceauth.go | 27 ++++ src/__tests__/summarize.test.ts | 4 +- .../authenticationCheckdatasourceauth.ts | 148 ++++++++++++++++++ src/lib/config.ts | 6 +- .../components/checkdatasourceauthresponse.ts | 44 ++++++ src/models/components/index.ts | 1 + .../unauthorizeddatasourceinstance.ts | 2 +- .../authenticationCheckdatasourceauth.ts | 112 +++++++++++++ src/react-query/index.ts | 1 + src/sdk/authentication.ts | 31 ++++ src/sdk/sdk.ts | 6 + 32 files changed, 805 insertions(+), 99 deletions(-) create mode 100644 docs/models/components/checkdatasourceauthresponse.md create mode 100644 docs/sdks/authentication/README.md create mode 100644 src/__tests__/authentication.test.ts create mode 100644 src/__tests__/mockserver/internal/handler/pathpostrestapiv1checkdatasourceauth.go create mode 100644 src/__tests__/mockserver/internal/sdk/models/components/checkdatasourceauthresponse.go create mode 100644 src/__tests__/mockserver/internal/sdk/models/operations/checkdatasourceauth.go create mode 100644 src/funcs/authenticationCheckdatasourceauth.ts create mode 100644 src/models/components/checkdatasourceauthresponse.ts create mode 100644 src/react-query/authenticationCheckdatasourceauth.ts create mode 100644 src/sdk/authentication.ts diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 264cfee9..e6ce028d 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,25 +1,25 @@ lockVersion: 2.0.0 id: 664aaca5-a41f-4434-8f2a-642dba92fe68 management: - docChecksum: 9f0ee14455bad48f934f35e2967fa335 + docChecksum: e61f09454154d7eb019991c03f6d19eb docVersion: 0.9.0 - speakeasyVersion: 1.722.0 - generationVersion: 2.829.1 - releaseVersion: 0.14.5 - configChecksum: 742a670394bc021d8c0755c5484dc97a + speakeasyVersion: 1.722.7 + generationVersion: 2.832.9 + releaseVersion: 0.14.6 + configChecksum: 2e4ae2e107a7c4c46e5c93681b7c6430 repoURL: https://github.com/gleanwork/api-client-typescript.git installationURL: https://github.com/gleanwork/api-client-typescript published: true persistentEdits: - generation_id: 0d7f3325-ca02-481a-8476-217f3c27a105 - pristine_commit_hash: aff841394e51db3c8e7d8a3a580ffb070676a900 - pristine_tree_hash: cb2860b197ba00002550222fbf56397fb3301a71 + generation_id: de845636-3e48-4739-be11-ed855453b7be + pristine_commit_hash: 9a6d8252c042937c6297974ed05d8802055cd6ad + pristine_tree_hash: b7d3346ddc6247b21f25cf1e1922c01e7bbf8c33 features: typescript: additionalDependencies: 0.1.0 additionalProperties: 0.1.3 constsAndDefaults: 0.1.13 - core: 3.26.28 + core: 3.26.29 defaultEnabledRetries: 0.1.0 deprecations: 2.81.1 devContainers: 2.90.1 @@ -430,6 +430,10 @@ trackedFiles: id: 3c01a3291509 last_write_checksum: sha1:e44b6fdcc6acddb9058851651e6eb3b1b264ea0c pristine_git_object: 630c94f0888410ef52e47247cafb0986dce0300d + docs/models/components/checkdatasourceauthresponse.md: + id: c9e52d770713 + last_write_checksum: sha1:bd392f24303f36c80b113f16af339d19e0857d3e + pristine_git_object: 3e54e40aebd33d4e51298d5f6dea02f49d8c81e9 docs/models/components/checkdocumentaccessrequest.md: id: e202c5bf96ac last_write_checksum: sha1:8244a3b3a96f003f68e09b7ddb2e1f4680032818 @@ -2136,8 +2140,8 @@ trackedFiles: pristine_git_object: 925d7533cffc7419ab180405a3063bc1056d27fa docs/models/components/unauthorizeddatasourceinstance.md: id: 15c75f318c92 - last_write_checksum: sha1:e51829e04eb1c647326c0614e14dd17205d11f72 - pristine_git_object: df37791f6b259ac6904a8da3d92670178bb7a997 + last_write_checksum: sha1:c61ea2b2954aba9cf8592fc43f9629ea9ffacbdd + pristine_git_object: 2aa9c1f1a5636c739a83cca01e28152e0b3fefa0 docs/models/components/unpin.md: id: 7a425c5154d0 last_write_checksum: sha1:e7d2d8fbeec0e7242635a15916339b0ab4d482c1 @@ -2630,6 +2634,10 @@ trackedFiles: id: d1b7559999eb last_write_checksum: sha1:1b66e7f03fae98f8bbc4c2324f0a540403b03656 pristine_git_object: dbb0cc043da9d3b3fe0387ec06cad2212a5eda07 + docs/sdks/authentication/README.md: + id: 45be241adfc3 + last_write_checksum: sha1:9225f47582f604557ea91e760d31ae603f859fee + pristine_git_object: 3be3c1d5c4ae22d894a6d2e50807becd48d984e1 docs/sdks/chat/README.md: id: 393193527c2c last_write_checksum: sha1:7d72907f01fd8c35c12e2ca73bd3dad696edc0a4 @@ -2748,12 +2756,12 @@ trackedFiles: pristine_git_object: 5a2797590d4be351d62915017d5b2a0f853537c8 jsr.json: id: 7f6ab7767282 - last_write_checksum: sha1:b4f09314be090d96b447236a359b48ebb1664b35 - pristine_git_object: c5770a5fdea407daab4a4df2882d4b34371ebe1e + last_write_checksum: sha1:343af9a901fc22fe24ef7434cc4af4d715aa9c6d + pristine_git_object: d3899087d6d8e23e17c8113e847ca102dd32ce35 package.json: id: 7030d0b2f71b - last_write_checksum: sha1:75638c8905b4a9677547c754b56c19612b00ba3a - pristine_git_object: ab4fefe3619e8c62381415ea2b4ee331ce9f2c4e + last_write_checksum: sha1:f788f26ab3eab6af72a569a70a0b085269d34bd5 + pristine_git_object: 34f4501c2c533deda5e3386cb4942ab9e9eba2a9 src/__tests__/activities.test.ts: id: 65fa859b8f59 last_write_checksum: sha1:967fae9ee4ae9dd9ee8383b2ce261d26d05d9873 @@ -2774,6 +2782,10 @@ trackedFiles: id: 23e6ed08eb14 last_write_checksum: sha1:f89afdb1173560667909423fa438e55e3f9ed1aa pristine_git_object: c05351d0d86e17b39957f19ef348f2942222281b + src/__tests__/authentication.test.ts: + id: 691dee516585 + last_write_checksum: sha1:d4e95a5a91c43e631592e0db0828ec6c864e9301 + pristine_git_object: 450899d0da7b728ae95409f6eabdc7ee4bbabc2a src/__tests__/calendar.test.ts: id: 71ab180892a0 last_write_checksum: sha1:1d42dd02b20f31c64eac071d7a1339a10e2e7aa1 @@ -2848,8 +2860,8 @@ trackedFiles: pristine_git_object: 9ad2e5a25c48744e6e862edd0dadb00bd9eecbfb src/__tests__/messages.test.ts: id: 39e293f09219 - last_write_checksum: sha1:6c65f329760376cde254ca553841022b989c5ac0 - pristine_git_object: 1dc01de378536b7dd4ea725651c2f9e92240edce + last_write_checksum: sha1:4e7023d6d2e329d7937853d0302fa06c6593c373 + pristine_git_object: a50716711a8e00881579c7e9d344bfb646b28cc8 src/__tests__/mockserver/.gitignore: last_write_checksum: sha1:228e1b05712a973948fd771323a2140a3b355ff4 src/__tests__/mockserver/Dockerfile: @@ -2877,7 +2889,7 @@ trackedFiles: src/__tests__/mockserver/internal/handler/generated_handler.go: last_write_checksum: sha1:32101ddff940c59f43a805af303cf645a2bcca0d src/__tests__/mockserver/internal/handler/generated_handlers.go: - last_write_checksum: sha1:76cd04100088457139ecd6643cfd7494ebda9fa6 + last_write_checksum: sha1:2aaafbb3aade11b06561dc8efe935abbe714195d src/__tests__/mockserver/internal/handler/pathgetrestapiv1agentsagentid.go: last_write_checksum: sha1:5210b43a5c1c7157ff57f7140449d82dc622931f src/__tests__/mockserver/internal/handler/pathgetrestapiv1agentsagentidschemas.go: @@ -2952,6 +2964,8 @@ trackedFiles: last_write_checksum: sha1:094d64ddc73a91d38e64e3be18690ebb9d4ef3d3 src/__tests__/mockserver/internal/handler/pathpostrestapiv1chat.go: last_write_checksum: sha1:0e62b904cb8354c1da5300d5f5b5b5a996c31716 + src/__tests__/mockserver/internal/handler/pathpostrestapiv1checkdatasourceauth.go: + last_write_checksum: sha1:bfd126dda7eb1a68c0edd1403c89770a4907aec9 src/__tests__/mockserver/internal/handler/pathpostrestapiv1createannouncement.go: last_write_checksum: sha1:fe9097d90fc9db0248506b6d1d27a5551dda73c4 src/__tests__/mockserver/internal/handler/pathpostrestapiv1createanswer.go: @@ -2993,7 +3007,7 @@ trackedFiles: src/__tests__/mockserver/internal/handler/pathpostrestapiv1getanswer.go: last_write_checksum: sha1:3bec6f7cd190f9394bebac2407f9d7f1e606e479 src/__tests__/mockserver/internal/handler/pathpostrestapiv1getchat.go: - last_write_checksum: sha1:089475adb3686c656bd0eb52940285a7e037ab83 + last_write_checksum: sha1:2c2b7acb22e422a721a21801cccfa30fedfd3169 src/__tests__/mockserver/internal/handler/pathpostrestapiv1getchatapplication.go: last_write_checksum: sha1:7b81898137fdb3a89b4dcfa318b9b5b92e8860c0 src/__tests__/mockserver/internal/handler/pathpostrestapiv1getchatfiles.go: @@ -3198,6 +3212,8 @@ trackedFiles: last_write_checksum: sha1:7fdeb40ae9549e1c24317776d28aa65cb311d7ce src/__tests__/mockserver/internal/sdk/models/components/chatzerostatesuggestionoptions.go: last_write_checksum: sha1:da633547681ec1c8ef5df79cc1d2919fb3714d13 + src/__tests__/mockserver/internal/sdk/models/components/checkdatasourceauthresponse.go: + last_write_checksum: sha1:caa976ebc0e76d521725d4dd83e17c840842fd9a src/__tests__/mockserver/internal/sdk/models/components/checkdocumentaccessrequest.go: last_write_checksum: sha1:4b403181de5f24bde26d022703e625a832f685c8 src/__tests__/mockserver/internal/sdk/models/components/checkdocumentaccessresponse.go: @@ -3855,7 +3871,7 @@ trackedFiles: src/__tests__/mockserver/internal/sdk/models/components/ugctype.go: last_write_checksum: sha1:b2c7d1fbd1cbcb64e9ff92e786853554cea97772 src/__tests__/mockserver/internal/sdk/models/components/unauthorizeddatasourceinstance.go: - last_write_checksum: sha1:09ee3d49ff814630448f3f691a197fc4891f68ee + last_write_checksum: sha1:39fb84396b33bc645fb5e6ebcea36ab88b5db179 src/__tests__/mockserver/internal/sdk/models/components/unpin.go: last_write_checksum: sha1:6bd1f6c9f451492810949a589b7cf0e07ede176d src/__tests__/mockserver/internal/sdk/models/components/updateannouncementrequest.go: @@ -3940,6 +3956,8 @@ trackedFiles: last_write_checksum: sha1:f2f55f4fecbef27cf1e00a589d3cea6d95982523 src/__tests__/mockserver/internal/sdk/models/operations/chatstream.go: last_write_checksum: sha1:b299a7da20b4ecf28e85b669de479778ed917ef1 + src/__tests__/mockserver/internal/sdk/models/operations/checkdatasourceauth.go: + last_write_checksum: sha1:4ea8a844fedb81791dbff6fd5b45031943c118ed src/__tests__/mockserver/internal/sdk/models/operations/createandstreamrun.go: last_write_checksum: sha1:ff0bc51a66cdb65f5d36415c82e92377fd0d2cff src/__tests__/mockserver/internal/sdk/models/operations/createandwaitrun.go: @@ -4216,8 +4234,8 @@ trackedFiles: pristine_git_object: 6471c989c852287b210470481dda5853db47ec58 src/__tests__/summarize.test.ts: id: 3105d6ebc7eb - last_write_checksum: sha1:160431c499f848da9e93d32c2586e3920ce937b5 - pristine_git_object: 7c2057b787870dfe9cd556ae648d1bb75755ff72 + last_write_checksum: sha1:f3d78f3ae21a89c6c3912047dc02347ce8cc05dd + pristine_git_object: 49c0ea429fb89fa3796c96fb9c062894e75c1c31 src/__tests__/testclient.ts: id: f142c080bff8 last_write_checksum: sha1:a62cc200f8a9f9c0310ce1b8ba6392d480ab5569 @@ -4238,6 +4256,10 @@ trackedFiles: id: f431fdbcd144 last_write_checksum: sha1:37a3f916a4091d7a6a84a45346a76773c7d01b10 pristine_git_object: fd8d7a09004b9e1144a54e0ba928e184db1d8161 + src/funcs/authenticationCheckdatasourceauth.ts: + id: 735a35286828 + last_write_checksum: sha1:623986b320c6181929906ab3b8301d36d9079ec6 + pristine_git_object: 04470dd477b4374b501b8620b9715b75c5d8db5d src/funcs/clientActivityFeedback.ts: id: 49d7d5074766 last_write_checksum: sha1:2ad27cd10a0975a0e08b43083085105d8854d000 @@ -4712,8 +4734,8 @@ trackedFiles: pristine_git_object: 0aebd8b0a4867e35cb3348fc52921c3c0b4725b7 src/lib/config.ts: id: 320761608fb3 - last_write_checksum: sha1:c3c46c27b87360759eb6635e87a2ca894f3c4405 - pristine_git_object: a073aab0deb035a9de0bb649c556e65b17ea57db + last_write_checksum: sha1:c430511ea1666f524057ac05272990a0dba5e28b + pristine_git_object: a5c481f4012201a967eee985546952b6a1a15dcc src/lib/dlv.ts: id: b1988214835a last_write_checksum: sha1:1dd3e3fbb4550c4bf31f5ef997faff355d6f3250 @@ -5034,6 +5056,10 @@ trackedFiles: id: bf513d105874 last_write_checksum: sha1:d620c1e50f7ed6d16bb53a9c37e135e00ab9bbbf pristine_git_object: e73c632fccabf514c5a0218ec3d7cdcacdc15edd + src/models/components/checkdatasourceauthresponse.ts: + id: 25ae9960eb9b + last_write_checksum: sha1:f7f152d5a45205903bde819e1ec1999effacd746 + pristine_git_object: 19ce89fac908895cdb6d27eecb8983c91956d7ce src/models/components/checkdocumentaccessrequest.ts: id: 9b62d0ab3d53 last_write_checksum: sha1:abdb770748b2dfe5e6aefd0382940276b1c0483a @@ -5764,8 +5790,8 @@ trackedFiles: pristine_git_object: f298b7af43120aeebaadf9d82f765ae960b3fb8d src/models/components/index.ts: id: 0aa842dce54d - last_write_checksum: sha1:1879f39a003289884a303a256d4b7db4191ef15d - pristine_git_object: 3bf0fa70a44ec0aa45547b31e7226b334676eb58 + last_write_checksum: sha1:239733c466715388444d4f0e1345b91ee44df4b7 + pristine_git_object: 298eb6e3195057e51e451c4cfdf10d33179c6a4a src/models/components/indexdocumentrequest.ts: id: deb13e2cdc65 last_write_checksum: sha1:2b9da1ec881761dd133c55ca4b599bb0491791bd @@ -6348,8 +6374,8 @@ trackedFiles: pristine_git_object: c77a3e51e9a6e85c00847676b4894e6051a953e8 src/models/components/unauthorizeddatasourceinstance.ts: id: 8eb114ca7c88 - last_write_checksum: sha1:a945154708b3194d51df788fc04fb885a660f353 - pristine_git_object: 0a805b07e922881bc21056019d07e80aa208dd00 + last_write_checksum: sha1:c61fa662e3e229ab73a9011df274998b2f7240be + pristine_git_object: 1ac428939da89d799a2eacc1d1351613ae57a2aa src/models/components/unpin.ts: id: 4902ca159289 last_write_checksum: sha1:c74eea9d782f7c9338a48bc6d35e663e2ad7fea5 @@ -6810,6 +6836,10 @@ trackedFiles: id: 8d58d2bd1914 last_write_checksum: sha1:6d4204885f4aeae1a0bc6d19522dd26f7c044112 pristine_git_object: cd2a95549b7da1cf5d492db48cfa037b47203554 + src/react-query/authenticationCheckdatasourceauth.ts: + id: de44a1fe0b75 + last_write_checksum: sha1:2c1912ef6da666d94628bbb02f15a808623b144a + pristine_git_object: 7b7f65a8286ca468e0a578008bb437f33aea6d47 src/react-query/clientActivityFeedback.ts: id: 501f802dd053 last_write_checksum: sha1:30cc8692476ce40628708cabbff9cae05d295a76 @@ -7160,8 +7190,8 @@ trackedFiles: pristine_git_object: 0fca22dda059fd0cea0a148ba54da93fef6093c1 src/react-query/index.ts: id: 9e975471aa65 - last_write_checksum: sha1:9692d9c8ada94040fae9cf4581373fba01ea6991 - pristine_git_object: f8ff5446371f7f33bdfe3bc5b3a180f3c89ff199 + last_write_checksum: sha1:57ec065d37aaccd89a1866a865ca8e5dbdc1c5d6 + pristine_git_object: 6f47da9164a522d42f55ed196b6e9be47018b63d src/react-query/indexingAuthenticationRotateToken.ts: id: e56c0845e38e last_write_checksum: sha1:5d0b43423cf7b9dbc121c6c4d6e413dfd95d5977 @@ -7326,6 +7356,10 @@ trackedFiles: id: 7f717169c02d last_write_checksum: sha1:8780a5a01135f9cd9b5230494258c802db8d89ec pristine_git_object: 5463b2a626225d131cc190585d7dd36659b4dae0 + src/sdk/authentication.ts: + id: 627e108b9d4b + last_write_checksum: sha1:cab50b9081981687dbba40346b6213fb7f563320 + pristine_git_object: 21e4fbaa88fa97a0df094fc03250df15417afcfc src/sdk/chat.ts: id: c56babc22a20 last_write_checksum: sha1:5f87bf3cfd403b9590fd33604cc5e0e64704a934 @@ -7428,8 +7462,8 @@ trackedFiles: pristine_git_object: 6b8a3ebb0bfdcf67344d718b02bf5d7e34a9b76d src/sdk/sdk.ts: id: 784571af2f69 - last_write_checksum: sha1:bb4eb4073c2e5e44ae03932edf42bd568975e0b0 - pristine_git_object: 9563e0de6c491f2344ab49d6865a2282fea8c2ac + last_write_checksum: sha1:38150dc5e9165a7647aaa8c6106c773f3aa8a0bd + pristine_git_object: 0173b78764b0b4897c791d287da9ba82316b5494 src/sdk/search.ts: id: b88871d87236 last_write_checksum: sha1:63f5c473e467c4df99491976e5129111b570fc41 @@ -8226,6 +8260,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-05-05T15:08:35-05:00" @@ -8371,7 +8410,10 @@ generatedTests: setdocvisibility: "2025-06-09T18:05:10Z" listfindingsexports: "2025-12-10T18:23:24Z" downloadfindingsexport: "2025-12-10T18:23:24Z" -releaseNotes: "## Typescript SDK Changes:\n* `glean.client.chat.create()`: \n * `request.chatRequest.messages[].messageType` **Changed**\n * `response` **Changed** (Breaking ⚠️)\n* `glean.client.chat.retrieve()`: `response.chatResult.chat.messages[].messageType` **Changed** (Breaking ⚠️)\n* `glean.client.chat.createStream()`: \n * `request.chatRequest.messages[].messageType` **Changed**\n* `glean.client.messages.retrieve()`: `response.searchResponse.gleanDataError.unauthorizedDatasourceInstances` **Added**\n* `glean.client.search.queryAsAdmin()`: \n * `response.gleanDataError.unauthorizedDatasourceInstances` **Added**\n * `error.unauthorizedDatasourceInstances` **Added**\n* `glean.client.search.autocomplete()`: `response.gleanDataError.unauthorizedDatasourceInstances` **Added**\n* `glean.client.search.recommendations()`: `response.gleanDataError.unauthorizedDatasourceInstances` **Added**\n* `glean.client.search.query()`: \n * `response.gleanDataError.unauthorizedDatasourceInstances` **Added**\n * `error.unauthorizedDatasourceInstances` **Added**\n" + checkdatasourceauth: "2026-02-19T15:51:26Z" +releaseNotes: | + ## Typescript SDK Changes: + * `glean.authentication.checkdatasourceauth()`: **Added** generatedFiles: - .devcontainer/README.md - .devcontainer/devcontainer.json diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 75b1599f..534cb5b8 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -33,7 +33,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: true typescript: - version: 0.14.5 + version: 0.14.6 acceptHeaderEnum: true additionalDependencies: dependencies: {} 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 ccabeaef..1df75398 100644 --- a/.speakeasy/tests.arazzo.yaml +++ b/.speakeasy/tests.arazzo.yaml @@ -164320,3 +164320,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 fd07151f..780b6d76 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-1770751877 + - speakeasy-sdk-regen-1771466080 Glean Client API: sourceNamespace: glean-client-api sourceRevisionDigest: sha256:aec0770b5bcca91068c3a844cb9ef4a091281f6cc3b7d86f2abef1bd6fb2b301 @@ -18,10 +18,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-typescript-code-samples - codeSamplesRevisionDigest: sha256:d4ab12e5e140c26eb50854fffd9ad5452e2264d62d68190d4fc755362496f3da + codeSamplesRevisionDigest: sha256:8b8fdf0a8a039b5167e3bff70afe6df9a0267c61abac3c256fafb222f71f30b0 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 189f99ca..603b3ad8 100644 --- a/README.md +++ b/README.md @@ -280,6 +280,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/activity/README.md) * [report](docs/sdks/activity/README.md#report) - Report document activity @@ -496,6 +500,7 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md). Available standalone functions +- [`authenticationCheckdatasourceauth`](docs/sdks/authentication/README.md#checkdatasourceauth) - Check datasource authorization - [`clientActivityFeedback`](docs/sdks/activity/README.md#feedback) - Report client activity - [`clientActivityReport`](docs/sdks/activity/README.md#report) - Report document activity - [`clientAgentsList`](docs/sdks/agents/README.md#list) - Search agents @@ -639,6 +644,7 @@ To learn about this feature and how to get started, check Available React hooks +- [`useAuthenticationCheckdatasourceauthMutation`](docs/sdks/authentication/README.md#checkdatasourceauth) - Check datasource authorization - [`useClientActivityFeedbackMutation`](docs/sdks/activity/README.md#feedback) - Report client activity - [`useClientActivityReportMutation`](docs/sdks/activity/README.md#report) - Report document activity - [`useClientAgentsListMutation`](docs/sdks/agents/README.md#list) - Search agents diff --git a/RELEASES.md b/RELEASES.md index 20aa1ba8..c75e7e60 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -618,4 +618,14 @@ Based on: ### Generated - [typescript v0.14.5] . ### Releases -- [NPM v0.14.5] https://www.npmjs.com/package/@gleanwork/api-client/v/0.14.5 - . \ No newline at end of file +- [NPM v0.14.5] https://www.npmjs.com/package/@gleanwork/api-client/v/0.14.5 - . + +## 2026-02-19 15:48:01 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.722.7 (2.832.9) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v0.14.6] . +### Releases +- [NPM v0.14.6] https://www.npmjs.com/package/@gleanwork/api-client/v/0.14.6 - . \ No newline at end of file diff --git a/docs/models/components/checkdatasourceauthresponse.md b/docs/models/components/checkdatasourceauthresponse.md new file mode 100644 index 00000000..3e54e40a --- /dev/null +++ b/docs/models/components/checkdatasourceauthresponse.md @@ -0,0 +1,22 @@ +# CheckDatasourceAuthResponse + +## Example Usage + +```typescript +import { CheckDatasourceAuthResponse } from "@gleanwork/api-client/models/components"; + +let value: CheckDatasourceAuthResponse = { + unauthorizedDatasourceInstances: [ + { + datasourceInstance: "slack_0", + displayName: "Slack", + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| `unauthorizedDatasourceInstances` | [components.UnauthorizedDatasourceInstance](../../models/components/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/components/unauthorizeddatasourceinstance.md b/docs/models/components/unauthorizeddatasourceinstance.md index df37791f..2aa9c1f1 100644 --- a/docs/models/components/unauthorizeddatasourceinstance.md +++ b/docs/models/components/unauthorizeddatasourceinstance.md @@ -16,9 +16,9 @@ let value: UnauthorizedDatasourceInstance = { ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | -| `datasourceInstance` | *string* | :heavy_minus_sign: | The instance identifier (e.g. "github", "github_enterprise_0", "slack_0"). Matches the instance names used in datasource configuration.
| slack_0 | -| `displayName` | *string* | :heavy_minus_sign: | Human-readable name of the datasource instance for display. | Slack | -| `authStatus` | [components.AuthStatus](../../models/components/authstatus.md) | :heavy_minus_sign: | The per-user authorization status for a datasource. | | -| `authUrlRelativePath` | *string* | :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 | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `datasourceInstance` | *string* | :heavy_minus_sign: | The instance identifier (e.g. "github", "github_enterprise_0", "slack_0"). Matches the instance names used in datasource configuration.
| slack_0 | +| `displayName` | *string* | :heavy_minus_sign: | Human-readable name of the datasource instance for display. | Slack | +| `authStatus` | [components.AuthStatus](../../models/components/authstatus.md) | :heavy_minus_sign: | The per-user authorization status for a datasource. | | +| `authUrlRelativePath` | *string* | :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..3be3c1d5 --- /dev/null +++ b/docs/sdks/authentication/README.md @@ -0,0 +1,101 @@ +# 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 + + +```typescript +import { Glean } from "@gleanwork/api-client"; + +const glean = new Glean({ + apiToken: process.env["GLEAN_API_TOKEN"] ?? "", +}); + +async function run() { + const result = await glean.authentication.checkdatasourceauth(); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { GleanCore } from "@gleanwork/api-client/core.js"; +import { authenticationCheckdatasourceauth } from "@gleanwork/api-client/funcs/authenticationCheckdatasourceauth.js"; + +// Use `GleanCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const glean = new GleanCore({ + apiToken: process.env["GLEAN_API_TOKEN"] ?? "", +}); + +async function run() { + const res = await authenticationCheckdatasourceauth(glean); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("authenticationCheckdatasourceauth failed:", res.error); + } +} + +run(); +``` + +### React hooks and utilities + +This method can be used in React components through the following hooks and +associated utilities. + +> Check out [this guide][hook-guide] for information about each of the utilities +> below and how to get started using React hooks. + +[hook-guide]: ../../../REACT_QUERY.md + +```tsx +import { + // Mutation hook for triggering the API call. + useAuthenticationCheckdatasourceauthMutation +} from "@gleanwork/api-client/react-query/authenticationCheckdatasourceauth.js"; +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[components.CheckDatasourceAuthResponse](../../models/components/checkdatasourceauthresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------- | ----------------- | ----------------- | +| errors.GleanError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/examples/package-lock.json b/examples/package-lock.json index 09fb6de3..5d4023a7 100644 --- a/examples/package-lock.json +++ b/examples/package-lock.json @@ -18,7 +18,7 @@ }, "..": { "name": "@gleanwork/api-client", - "version": "0.14.5", + "version": "0.14.6", "dependencies": { "zod": "^3.25.0 || ^4.0.0" }, diff --git a/jsr.json b/jsr.json index c5770a5f..d3899087 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "@gleanwork/api-client", - "version": "0.14.5", + "version": "0.14.6", "exports": { ".": "./src/index.ts", "./models/errors": "./src/models/errors/index.ts", diff --git a/package-lock.json b/package-lock.json index cb5af82f..bd4e13c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@gleanwork/api-client", - "version": "0.14.5", + "version": "0.14.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@gleanwork/api-client", - "version": "0.14.5", + "version": "0.14.6", "dependencies": { "zod": "^3.25.0 || ^4.0.0" }, diff --git a/package.json b/package.json index ab4fefe3..34f4501c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gleanwork/api-client", - "version": "0.14.5", + "version": "0.14.6", "author": "Speakeasy", "tshy": { "sourceDialects": [ diff --git a/src/__tests__/authentication.test.ts b/src/__tests__/authentication.test.ts new file mode 100644 index 00000000..450899d0 --- /dev/null +++ b/src/__tests__/authentication.test.ts @@ -0,0 +1,20 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { expect, test } from "vitest"; +import { Glean } from "../index.js"; +import { createTestHTTPClient } from "./testclient.js"; + +test("Authentication Checkdatasourceauth", async () => { + const testHttpClient = createTestHTTPClient("checkdatasourceauth"); + + const glean = new Glean({ + serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", + httpClient: testHttpClient, + apiToken: process.env["GLEAN_API_TOKEN"] ?? "value", + }); + + const result = await glean.authentication.checkdatasourceauth(); + expect(result).toBeDefined(); +}); diff --git a/src/__tests__/messages.test.ts b/src/__tests__/messages.test.ts index 1dc01de3..a5071671 100644 --- a/src/__tests__/messages.test.ts +++ b/src/__tests__/messages.test.ts @@ -19,7 +19,7 @@ test("Messages Messages", async () => { idType: "CONVERSATION_ID", id: "", timestampMillis: 558834, - datasource: "GCHAT", + datasource: "MICROSOFTTEAMS", }); expect(result).toBeDefined(); }); diff --git a/src/__tests__/mockserver/internal/handler/generated_handlers.go b/src/__tests__/mockserver/internal/handler/generated_handlers.go index baa0c72f..23b23873 100644 --- a/src/__tests__/mockserver/internal/handler/generated_handlers.go +++ b/src/__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/src/__tests__/mockserver/internal/handler/pathpostrestapiv1checkdatasourceauth.go b/src/__tests__/mockserver/internal/handler/pathpostrestapiv1checkdatasourceauth.go new file mode 100644 index 00000000..41731f5c --- /dev/null +++ b/src/__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/src/__tests__/mockserver/internal/handler/pathpostrestapiv1getchat.go b/src/__tests__/mockserver/internal/handler/pathpostrestapiv1getchat.go index 020eb777..023af9c7 100644 --- a/src/__tests__/mockserver/internal/handler/pathpostrestapiv1getchat.go +++ b/src/__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/src/__tests__/mockserver/internal/sdk/models/components/checkdatasourceauthresponse.go b/src/__tests__/mockserver/internal/sdk/models/components/checkdatasourceauthresponse.go new file mode 100644 index 00000000..ff5addac --- /dev/null +++ b/src/__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/src/__tests__/mockserver/internal/sdk/models/components/unauthorizeddatasourceinstance.go b/src/__tests__/mockserver/internal/sdk/models/components/unauthorizeddatasourceinstance.go index a57ee947..78d5650a 100644 --- a/src/__tests__/mockserver/internal/sdk/models/components/unauthorizeddatasourceinstance.go +++ b/src/__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/src/__tests__/mockserver/internal/sdk/models/operations/checkdatasourceauth.go b/src/__tests__/mockserver/internal/sdk/models/operations/checkdatasourceauth.go new file mode 100644 index 00000000..55046755 --- /dev/null +++ b/src/__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/src/__tests__/summarize.test.ts b/src/__tests__/summarize.test.ts index 7c2057b7..49c0ea42 100644 --- a/src/__tests__/summarize.test.ts +++ b/src/__tests__/summarize.test.ts @@ -18,10 +18,10 @@ test("Summarize Summarize", async () => { const result = await glean.client.documents.summarize({ documentSpecs: [ { - url: "https://dim-glider.com/", + url: "https://educated-laughter.info/", }, { - id: "", + url: "https://educated-laughter.info/", }, ], }); diff --git a/src/funcs/authenticationCheckdatasourceauth.ts b/src/funcs/authenticationCheckdatasourceauth.ts new file mode 100644 index 00000000..04470dd4 --- /dev/null +++ b/src/funcs/authenticationCheckdatasourceauth.ts @@ -0,0 +1,148 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { GleanCore } from "../core.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { GleanBaseError } from "../models/errors/gleanbaseerror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Check datasource authorization + * + * @remarks + * 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=`. + */ +export function authenticationCheckdatasourceauth( + client: GleanCore, + options?: RequestOptions, +): APIPromise< + Result< + components.CheckDatasourceAuthResponse, + | GleanBaseError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + options, + )); +} + +async function $do( + client: GleanCore, + options?: RequestOptions, +): Promise< + [ + Result< + components.CheckDatasourceAuthResponse, + | GleanBaseError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const path = pathToFunc("/rest/api/v1/checkdatasourceauth")(); + + const headers = new Headers(compactMap({ + Accept: "application/json", + })); + + const secConfig = await extractSecurity(client._options.apiToken); + const securityInput = secConfig == null ? {} : { apiToken: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "checkdatasourceauth", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiToken, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["401", "429", "4XX", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const [result] = await M.match< + components.CheckDatasourceAuthResponse, + | GleanBaseError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, components.CheckDatasourceAuthResponse$inboundSchema), + M.fail([401, 429, "4XX"]), + M.fail("5XX"), + )(response, req); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/src/lib/config.ts b/src/lib/config.ts index a073aab0..a5c481f4 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -68,8 +68,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "0.9.0", - sdkVersion: "0.14.5", - genVersion: "2.829.1", + sdkVersion: "0.14.6", + genVersion: "2.832.9", userAgent: - "speakeasy-sdk/typescript 0.14.5 2.829.1 0.9.0 @gleanwork/api-client", + "speakeasy-sdk/typescript 0.14.6 2.832.9 0.9.0 @gleanwork/api-client", } as const; diff --git a/src/models/components/checkdatasourceauthresponse.ts b/src/models/components/checkdatasourceauthresponse.ts new file mode 100644 index 00000000..19ce89fa --- /dev/null +++ b/src/models/components/checkdatasourceauthresponse.ts @@ -0,0 +1,44 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v3"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + UnauthorizedDatasourceInstance, + UnauthorizedDatasourceInstance$inboundSchema, +} from "./unauthorizeddatasourceinstance.js"; + +export type CheckDatasourceAuthResponse = { + /** + * Datasource instances that require per-user OAuth authorization. Empty or absent when all datasources are authorized. + * + * @remarks + */ + unauthorizedDatasourceInstances?: + | Array + | undefined; +}; + +/** @internal */ +export const CheckDatasourceAuthResponse$inboundSchema: z.ZodType< + CheckDatasourceAuthResponse, + z.ZodTypeDef, + unknown +> = z.object({ + unauthorizedDatasourceInstances: z.array( + UnauthorizedDatasourceInstance$inboundSchema, + ).optional(), +}); + +export function checkDatasourceAuthResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CheckDatasourceAuthResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CheckDatasourceAuthResponse' from JSON`, + ); +} diff --git a/src/models/components/index.ts b/src/models/components/index.ts index 3bf0fa70..298eb6e3 100644 --- a/src/models/components/index.ts +++ b/src/models/components/index.ts @@ -68,6 +68,7 @@ export * from "./chatrestrictionfilters.js"; export * from "./chatresult.js"; export * from "./chatsuggestion.js"; export * from "./chatzerostatesuggestionoptions.js"; +export * from "./checkdatasourceauthresponse.js"; export * from "./checkdocumentaccessrequest.js"; export * from "./checkdocumentaccessresponse.js"; export * from "./clustergroup.js"; diff --git a/src/models/components/unauthorizeddatasourceinstance.ts b/src/models/components/unauthorizeddatasourceinstance.ts index 0a805b07..1ac42893 100644 --- a/src/models/components/unauthorizeddatasourceinstance.ts +++ b/src/models/components/unauthorizeddatasourceinstance.ts @@ -29,7 +29,7 @@ export type UnauthorizedDatasourceInstance = { */ authStatus?: AuthStatus | undefined; /** - * 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. * * @remarks */ diff --git a/src/react-query/authenticationCheckdatasourceauth.ts b/src/react-query/authenticationCheckdatasourceauth.ts new file mode 100644 index 00000000..7b7f65a8 --- /dev/null +++ b/src/react-query/authenticationCheckdatasourceauth.ts @@ -0,0 +1,112 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { + MutationKey, + useMutation, + UseMutationResult, +} from "@tanstack/react-query"; +import { GleanCore } from "../core.js"; +import { authenticationCheckdatasourceauth } from "../funcs/authenticationCheckdatasourceauth.js"; +import { combineSignals } from "../lib/primitives.js"; +import { RequestOptions } from "../lib/sdks.js"; +import * as components from "../models/components/index.js"; +import { GleanBaseError } from "../models/errors/gleanbaseerror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { unwrapAsync } from "../types/fp.js"; +import { useGleanContext } from "./_context.js"; +import { MutationHookOptions } from "./_types.js"; + +export type AuthenticationCheckdatasourceauthMutationVariables = { + options?: RequestOptions; +}; + +export type AuthenticationCheckdatasourceauthMutationData = + components.CheckDatasourceAuthResponse; + +export type AuthenticationCheckdatasourceauthMutationError = + | GleanBaseError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError; + +/** + * Check datasource authorization + * + * @remarks + * 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=`. + */ +export function useAuthenticationCheckdatasourceauthMutation( + options?: MutationHookOptions< + AuthenticationCheckdatasourceauthMutationData, + AuthenticationCheckdatasourceauthMutationError, + AuthenticationCheckdatasourceauthMutationVariables + >, +): UseMutationResult< + AuthenticationCheckdatasourceauthMutationData, + AuthenticationCheckdatasourceauthMutationError, + AuthenticationCheckdatasourceauthMutationVariables +> { + const client = useGleanContext(); + return useMutation({ + ...buildAuthenticationCheckdatasourceauthMutation(client, options), + ...options, + }); +} + +export function mutationKeyAuthenticationCheckdatasourceauth(): MutationKey { + return ["@gleanwork/api-client", "Authentication", "checkdatasourceauth"]; +} + +export function buildAuthenticationCheckdatasourceauthMutation( + client$: GleanCore, + hookOptions?: RequestOptions, +): { + mutationKey: MutationKey; + mutationFn: ( + variables: AuthenticationCheckdatasourceauthMutationVariables, + ) => Promise; +} { + return { + mutationKey: mutationKeyAuthenticationCheckdatasourceauth(), + mutationFn: function authenticationCheckdatasourceauthMutationFn({ + options, + }): Promise { + const mergedOptions = { + ...hookOptions, + ...options, + fetchOptions: { + ...hookOptions?.fetchOptions, + ...options?.fetchOptions, + signal: combineSignals( + hookOptions?.fetchOptions?.signal, + options?.fetchOptions?.signal, + ), + }, + }; + return unwrapAsync(authenticationCheckdatasourceauth( + client$, + mergedOptions, + )); + }, + }; +} diff --git a/src/react-query/index.ts b/src/react-query/index.ts index f8ff5446..6f47da91 100644 --- a/src/react-query/index.ts +++ b/src/react-query/index.ts @@ -5,6 +5,7 @@ export { GleanProvider, useGleanContext } from "./_context.js"; export * from "./_types.js"; +export * from "./authenticationCheckdatasourceauth.js"; export * from "./clientActivityFeedback.js"; export * from "./clientActivityReport.js"; export * from "./clientAgentsList.js"; diff --git a/src/sdk/authentication.ts b/src/sdk/authentication.ts new file mode 100644 index 00000000..21e4fbaa --- /dev/null +++ b/src/sdk/authentication.ts @@ -0,0 +1,31 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { authenticationCheckdatasourceauth } from "../funcs/authenticationCheckdatasourceauth.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as components from "../models/components/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class Authentication extends ClientSDK { + /** + * Check datasource authorization + * + * @remarks + * 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=`. + */ + async checkdatasourceauth( + options?: RequestOptions, + ): Promise { + return unwrapAsync(authenticationCheckdatasourceauth( + this, + options, + )); + } +} diff --git a/src/sdk/sdk.ts b/src/sdk/sdk.ts index 9563e0de..0173b787 100644 --- a/src/sdk/sdk.ts +++ b/src/sdk/sdk.ts @@ -3,6 +3,7 @@ */ import { ClientSDK } from "../lib/sdks.js"; +import { Authentication } from "./authentication.js"; import { Client } from "./client.js"; import { Governance } from "./governance.js"; import { Indexing } from "./indexing.js"; @@ -13,6 +14,11 @@ export class Glean extends ClientSDK { return (this._client ??= new Client(this._options)); } + private _authentication?: Authentication; + get authentication(): Authentication { + return (this._authentication ??= new Authentication(this._options)); + } + private _indexing?: Indexing; get indexing(): Indexing { return (this._indexing ??= new Indexing(this._options)); From 9e9d319226a0d3067f121c79ebfe2c5668c9e9df 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:55:33 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow