diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index abe0bcf1..f0d2d37d 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,18 +1,18 @@ lockVersion: 2.0.0 id: 9d90eb9e-33f8-4170-8944-988f4000aad0 management: - docChecksum: 9d8ec68225b876cf9682078cfb491edd + docChecksum: b5e6aaf09569e076c7321d15cf12c515 docVersion: 0.9.0 - speakeasyVersion: 1.809.0 + speakeasyVersion: 1.810.0 generationVersion: 2.961.1 - releaseVersion: 0.17.7 - configChecksum: 34225d42eb3ddcd07939561b734ec3cb + releaseVersion: 0.17.8 + configChecksum: 0c04531b2c9cdc1c946dd2e7fb0d5379 repoURL: https://github.com/gleanwork/api-client-go.git installationURL: https://github.com/gleanwork/api-client-go persistentEdits: - generation_id: 67796240-d33c-4ad2-86e1-675925e5358d - pristine_commit_hash: c50b961d7b768cb92b01a28c2497cc0d78129cc4 - pristine_tree_hash: 6bc66762c1ba52ec4bb44c8feb38801d05691b57 + generation_id: 314f42dc-ab95-4cec-8345-3050632eb9de + pristine_commit_hash: 5d13a0278a630898b9902e523e4ca22f315a026c + pristine_tree_hash: 94f21906bc508e9c5155cc9aeab2299418f65c9e features: go: acceptHeaders: 2.81.2 @@ -2419,10 +2419,6 @@ trackedFiles: id: cf30a61049bc last_write_checksum: sha1:2e0750d33e8c5ce5eee95eaf8ab3c8cccae12570 pristine_git_object: 5790a4af9deff0c344e827f0ec6d52bbb48adde5 - docs/models/components/platformdocumentreference.md: - id: 60be08cd43d2 - last_write_checksum: sha1:1f6c001ab88da6a6e46e3849efe991e0ffb9ab3a - pristine_git_object: c91185b0aa74f7bb10dbbcaffb23a1c11e9d3ff5 docs/models/components/platformdocumentsbatchrequest.md: id: 0ae2a4ef7792 last_write_checksum: sha1:09b332aecd33ba96e83b95b42afc55f291e3a1dc @@ -2599,18 +2595,6 @@ trackedFiles: id: ad76c5d23cfa last_write_checksum: sha1:1439d643d8f5ca88251e069205efb0ef5a0f2ec9 pristine_git_object: 161d5aaf8684e9746e06eedce253c10b4567d11f - docs/models/components/platformsearchenumerationinclude.md: - id: 80c4ec1c5527 - last_write_checksum: sha1:e2e311d5d7eccfe1c671dcd28c31c281396ae338 - pristine_git_object: 88bf455ab0d7430185e91607b82f5d34fefc1794 - docs/models/components/platformsearchenumerationrequest.md: - id: 7925c7c3e5b3 - last_write_checksum: sha1:849d3ce41e6c54f7f5a7b06c29b5ba8584dacb73 - pristine_git_object: 8bc427128bc1b3012d7eab67cf84bc834b89ddf5 - docs/models/components/platformsearchenumerationresponse.md: - id: 7e18dd61d67c - last_write_checksum: sha1:99656a5fe638ec826eb79e6d68ba60f520aad684 - pristine_git_object: b5b0521fa5221c31ce1102fe1caac37145aeaab1 docs/models/components/platformsearchfiltersresponse.md: id: b5bbeb0cb663 last_write_checksum: sha1:ea6533fec421624eb7e38bb77430ab0166c2c962 @@ -4435,10 +4419,6 @@ trackedFiles: id: cdb178e0a82e last_write_checksum: sha1:66a324f41cf2b87ce94e14d3c4b76dbf59afc587 pristine_git_object: bfea746631e24ff3498a6bc23be57fc05492585f - docs/models/operations/platformsearchenumerationresponse.md: - id: 0de1909bcdf6 - last_write_checksum: sha1:c433c3a7636e3923d0050f6545b3b64ff59daf06 - pristine_git_object: 2bbd7925c80f73cc7d207f550356807c69707af0 docs/models/operations/platformsearchfiltersrequest.md: id: fb15f593735d last_write_checksum: sha1:c13cb4e9d601b04cbbdcc315a4651fc95465ad11 @@ -5093,8 +5073,8 @@ trackedFiles: pristine_git_object: 25868a2b44bc7c3a03edc5d212895ef4be3e2326 docs/sdks/search/README.md: id: 5c534716244c - last_write_checksum: sha1:56ddf68eae938d35bb99ee16c3e6488a4e434d61 - pristine_git_object: 93303756f9e39ed904492c0f73f72684a00538cb + last_write_checksum: sha1:1992682c6306e6cb401a29e22997089bb3fc55a4 + pristine_git_object: 8e0bde063d13aee310007ef6fe06429250c3ca9c docs/sdks/skills/README.md: id: 3a14a5c90791 last_write_checksum: sha1:477affddf8a80a7d82a5477d63649a85bd0a5150 @@ -5137,8 +5117,8 @@ trackedFiles: pristine_git_object: a3cb3e5448f3fdcfad77ed2a4ba47ae848d5cd5d glean.go: id: f5ed099b8e85 - last_write_checksum: sha1:e42e437189872e0ebc0d2730240e10577f76da64 - pristine_git_object: 15cc3097d34586cb51adc8dd8b0fd3220f0afd71 + last_write_checksum: sha1:3a67544fd417f8fa3c2d790c239f24ef175046e6 + pristine_git_object: 20641fc87e58a351f0b25984990eeb61d5e9a528 go.mod: id: c47645c391ad last_write_checksum: sha1:b3c76c4c50472a60a8c74834bce9770edcc84fb1 @@ -6963,10 +6943,6 @@ trackedFiles: id: 3b67463883f8 last_write_checksum: sha1:07392c86069e030da9dadf1c6acca54bd4232350 pristine_git_object: cc1dd94432e30fd597f08c975b12c96c6cec4771 - models/components/platformdocumentreference.go: - id: f30de07e1d39 - last_write_checksum: sha1:11583abc4939912eb23f0b7690a610871537d948 - pristine_git_object: d9c45ed1c5d83a96af7a7b1cb4cedc91a8e9bb7f models/components/platformdocumentsbatchrequest.go: id: e56dadd314b9 last_write_checksum: sha1:a3a56b86cf29d5d6c787ddffe47f67e5170b842e @@ -7131,18 +7107,6 @@ trackedFiles: id: 31e890222655 last_write_checksum: sha1:90190318c1c0306eb6cf624b5dff008e92dc5235 pristine_git_object: abc70e098b558cc68a3c683fe18b3d3c8e1032a7 - models/components/platformsearchenumerationinclude.go: - id: ce2ea78641ed - last_write_checksum: sha1:5132a356b442e471c88d880f81a83c295b891159 - pristine_git_object: 1d1d0d28c4d60858da3bdd2c609ce0b3a2f2ae9c - models/components/platformsearchenumerationrequest.go: - id: c3adb5c0d6c3 - last_write_checksum: sha1:d7f3b2c7ede59073e181eefee924b70173744fc5 - pristine_git_object: d83efac18b457bd4a7a2c6e92bcfc153eca13981 - models/components/platformsearchenumerationresponse.go: - id: cb2aa0e3fa93 - last_write_checksum: sha1:8c132111ff70f770f41bb3b3913a1631f9f4da31 - pristine_git_object: e72eb80800838034ab511ef820ac63bd4370fdab models/components/platformsearchfiltersresponse.go: id: d13551ede601 last_write_checksum: sha1:66fbc7388ff82eea446346b3ec2f21b5563ced6e @@ -8391,10 +8355,6 @@ trackedFiles: id: 875844d95a55 last_write_checksum: sha1:af90d019e81b20bba89e2c676cbd115dbba6fa12 pristine_git_object: 57c0268848d648d5f061c52869bbeb2eb15d8409 - models/operations/platformsearchenumeration.go: - id: 89947cd4248c - last_write_checksum: sha1:5615be6cb1496322fcf6867b71b7ae227504bc2a - pristine_git_object: c8fd4deae315ccb895e1251b63a8ef57abd5f51d models/operations/platformsearchfilters.go: id: 3f74573f2398 last_write_checksum: sha1:2785d4db56f21e04c6ac0e126c420ff8ad7c570a @@ -8765,8 +8725,8 @@ trackedFiles: pristine_git_object: 767002c7898128324d8741ce9c534bd466492169 search.go: id: 4c057402d2bf - last_write_checksum: sha1:cf8d71135ed44da105d26d067037cadab960cd8a - pristine_git_object: 3e2bff62412c45aff44bbed7e12a925be58a21f8 + last_write_checksum: sha1:8087f580ce622f341afcc69760a1f28f2a3180ce + pristine_git_object: 7afd8e41bebc64076aac14198ad677a8e5511c9a skills.go: id: 65ecddcd9ce6 last_write_checksum: sha1:022012e2d7f4c7557e0f1cbf8317334bb4355e97 @@ -8901,8 +8861,8 @@ trackedFiles: pristine_git_object: 6d9cbca42012c2760de3ecaf4f569c53d32197da tests/messages_test.go: id: 3433c956b7a3 - last_write_checksum: sha1:352ecfa3a01795bbe7fad9b0202c4ccaa02448c3 - pristine_git_object: 64ef64fe1c0ccbc223987d87ddddf3d6e2de7799 + last_write_checksum: sha1:1cd91a5da0532448c95e970af3d91952394a6cb9 + pristine_git_object: f927c36464e8eb191ae67582831be04e3db1e5dc tests/mockserver/.gitignore: id: 7705eb663274 last_write_checksum: sha1:228e1b05712a973948fd771323a2140a3b355ff4 @@ -8957,8 +8917,8 @@ trackedFiles: pristine_git_object: 929558ef2e1165f7e09da6d0a64f016c90971655 tests/mockserver/internal/handler/generated_handlers.go: id: 61ac4f7cce9e - last_write_checksum: sha1:82b6fc55b4750de9daea2f5a47738ab3df43a094 - pristine_git_object: 10cb3da083d847ee748d0a76caacc5f1a3beb08f + last_write_checksum: sha1:9b4637a979a61dabdc65e81ae71068c54a97ec4c + pristine_git_object: 75f142bb7cdeedab3d92bdb85c68fc6693d94e7a tests/mockserver/internal/handler/pathdeleterestapiindexcustommetadataschemagroupname.go: id: 979e4583765b last_write_checksum: sha1:b1d4edb259d907c7a88b634bf16f0cf152321693 @@ -9287,10 +9247,6 @@ trackedFiles: id: 53e6a34b5b4b last_write_checksum: sha1:5c878b42ee0ffe08f9ad98c3e1f1c9c20ce4d21a pristine_git_object: 1e3fe6a9bed655ba32d7c59fe577f41beac69da8 - tests/mockserver/internal/handler/pathpostapisearchenumeration.go: - id: 67082f434e1a - last_write_checksum: sha1:498a79199ca09e8822326a7c0a503bf64e4d5851 - pristine_git_object: 8434a2e3fa8ed39ee5e80accb6b18fa4f2a0642c tests/mockserver/internal/handler/pathpostapiskills.go: id: 8ed490cc6d95 last_write_checksum: sha1:baf2227d6bd2c85e94842170a811ed97ec2e2b5c @@ -11295,10 +11251,6 @@ trackedFiles: id: 069550e90b62 last_write_checksum: sha1:122dd8b1f581cd4afc74aa66ebd40482ef6f8bf6 pristine_git_object: 3eec0b1a224a0957a1bd736990f5c3ab50491041 - tests/mockserver/internal/sdk/models/components/platformdocumentreference.go: - id: a4be70b2ac95 - last_write_checksum: sha1:f796641c9358ecab9a9d48d2b867621ae9ce3f25 - pristine_git_object: 8d5ee032af16e685ba1db9e4d3a47307a5731619 tests/mockserver/internal/sdk/models/components/platformdocumentsbatchrequest.go: id: 9037807c5a98 last_write_checksum: sha1:727bc02cec152b7c3d5b939a4334ea1b7d732405 @@ -11463,18 +11415,6 @@ trackedFiles: id: dd777258615b last_write_checksum: sha1:0aa6e9a8d84b38bb403af1bb505adc2666c03c5e pristine_git_object: 1588f7394695e92cf3cd2b4a620d7c239f179815 - tests/mockserver/internal/sdk/models/components/platformsearchenumerationinclude.go: - id: 24497ab12dde - last_write_checksum: sha1:a56244a9def88eb48ab13e03761555e69c603bf0 - pristine_git_object: e944cdb02de2b6177253b5118fdf80526ceef786 - tests/mockserver/internal/sdk/models/components/platformsearchenumerationrequest.go: - id: 8a9eb0db18c3 - last_write_checksum: sha1:bb43060068d5be70facc0176eb162b6d1df219fb - pristine_git_object: a5fd5eaf5e4ad844969ceecc566936c3a9003bd2 - tests/mockserver/internal/sdk/models/components/platformsearchenumerationresponse.go: - id: 163130806d65 - last_write_checksum: sha1:7e45670b21e5c4d4213902e83d944fafe99efc02 - pristine_git_object: f2ecd205bc3ca5b2e7d92d84ef9491b15439fb4d tests/mockserver/internal/sdk/models/components/platformsearchfiltersresponse.go: id: c6e01fb5cff1 last_write_checksum: sha1:94caa146dcfafb521d396d19e5358da8c598faab @@ -12719,10 +12659,6 @@ trackedFiles: id: d990791ac101 last_write_checksum: sha1:9da9b49850375b74bf6296fcec336ba9ad1e1eea pristine_git_object: 381c8530dfb959419e47dee10c46cfdd5846f611 - tests/mockserver/internal/sdk/models/operations/platformsearchenumeration.go: - id: e1aa6765ff1d - last_write_checksum: sha1:2fe9178766a7764ee8cf4c3d88de9d8d481e6265 - pristine_git_object: 4b5ba7fe7a18912ff655d60271fa463d3edd1933 tests/mockserver/internal/sdk/models/operations/platformsearchfilters.go: id: 3f6c4119e4bd last_write_checksum: sha1:e0836460229365773a66a5b310ba886d5fbdf202 @@ -13193,16 +13129,16 @@ trackedFiles: pristine_git_object: f0fcf2fb0b2aa857ee87a3109c647440c7df9517 tests/search_test.go: id: 2ec51916e3e4 - last_write_checksum: sha1:c0e7703be78f258eda86036b1725335babe4c857 - pristine_git_object: aace2db813ba0d2d369650a1814c535fc684b761 + last_write_checksum: sha1:96d4a6454e68d7d7e1bae2ae4aaca442aae0192f + pristine_git_object: 0bad27c2ffe06c76830e0f3b3c93830392209a8d tests/skills_test.go: id: 67834dec1608 last_write_checksum: sha1:95a0d19191c20fa63b07502e289eeb2ed7f46224 pristine_git_object: c529bd5691588e889a10e46bb1cd477a80cb3703 tests/summarize_test.go: id: 1b63b0a16e69 - last_write_checksum: sha1:6da9f736fef20def1b16946fe93d02a1c5cb94ec - pristine_git_object: 4bfe1645d67bb70c7dc680bf793b2c4d9ae38d2f + last_write_checksum: sha1:3c57041c1cccb93ec8919e4d2249e9e9915c55ea + pristine_git_object: c35381dac59e885785cbed4d057b1684f538c77a tests/testclient.go: id: 78d36c6e169c last_write_checksum: sha1:507c44e437934fbff8d295201c1327e18bd00df8 @@ -15128,7 +15064,7 @@ generatedTests: platform-search-enumeration: "2026-11-16T11:54:07Z" releaseNotes: | ## Go SDK Changes: - * `Glean.Client.Insights.Retrieve()`: `response.OverviewResponse.TotalSignupsWeekAgo` **Added** + * `Glean.Search.Enumerate()`: **Removed** (Breaking ⚠️) generatedFiles: - .devcontainer/README.md - .devcontainer/devcontainer.json diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index dc909739..dffcc04c 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -33,7 +33,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: true go: - version: 0.17.7 + version: 0.17.8 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false baseErrorName: GleanError diff --git a/.speakeasy/glean-merged-spec.yaml b/.speakeasy/glean-merged-spec.yaml index 678935a3..ad10f296 100644 --- a/.speakeasy/glean-merged-spec.yaml +++ b/.speakeasy/glean-merged-spec.yaml @@ -2,8 +2,8 @@ openapi: 3.1.0 info: version: "0.9.0" title: Glean API - x-source-commit-sha: 92084e408d64f4792098b2dcd1013e0af7abe611 - x-open-api-commit-sha: fee2a7ed1565ad90159fb31b1a05283058c83f3f + x-source-commit-sha: 2f6fc4fe9fed01ad76ee9aa694041c743bd74875 + x-open-api-commit-sha: 241062eca12866ea62b6e58d504ef481935fcf48 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. @@ -1496,63 +1496,6 @@ paths: x-speakeasy-name-override: listFilters security: - APIToken: [] - /api/search/enumeration: - post: - tags: - - Search - summary: Enumerate matching documents - description: | - Walk every indexed document that matches a selection and that the caller is permitted to see. Returns document references with minimal metadata and never bodies; request `SNIPPETS` via `include` for query-relevant excerpts, and hydrate full documents with `POST /api/documents/batch`. Unlike `POST /api/search`, `query` is optional: omit it to enumerate by `datasources`, `filters`, and `time_range` alone. Results are ordered for completeness, not relevance. - Follow `next_cursor` until `has_more` is `false`, regardless of page size. This is a live scan, not a snapshot: concurrent index changes can cause duplicates or omissions. Deduplicate by `document_id`. - A page is either complete at its cursor position or an error. A shard or datasource failure returns HTTP 503 and the same cursor stays valid for retry; this endpoint never returns a partial page. A cursor reused with a different selection returns HTTP 400 `invalid_cursor`. - operationId: platform-search-enumeration - x-glean-scopes: - legacy: - - SEARCH - platform: - - search:query - x-visibility: Public - x-glean-experimental: - id: 9ce7bb73-1e30-460a-a917-cae09ac3a3ea - introduced: "2026-11-02" - x-codegen-request-body-name: payload - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/PlatformSearchEnumerationRequest" - responses: - "200": - description: Successful response. - content: - application/json: - schema: - $ref: "#/components/schemas/PlatformSearchEnumerationResponse" - "400": - $ref: "#/components/responses/PlatformBadRequest" - "401": - $ref: "#/components/responses/PlatformUnauthorized" - "403": - $ref: "#/components/responses/PlatformForbidden" - "404": - $ref: "#/components/responses/PlatformNotFound" - "408": - $ref: "#/components/responses/PlatformRequestTimeout" - "413": - $ref: "#/components/responses/PlatformRequestTooLarge" - "422": - $ref: "#/components/responses/PlatformUnprocessableEntity" - "429": - $ref: "#/components/responses/PlatformTooManyRequests" - "500": - $ref: "#/components/responses/PlatformInternalServerError" - "503": - $ref: "#/components/responses/PlatformServiceUnavailable" - x-speakeasy-group: search - x-speakeasy-name-override: enumerate - security: - - APIToken: [] /api/admin/usage/settings: get: tags: @@ -11124,158 +11067,6 @@ components: type: string minLength: 1 description: Platform-generated request ID for support correlation. - PlatformSearchEnumerationInclude: - type: string - description: Optional document reference projection. - enum: - - SNIPPETS - x-enumDescriptions: - SNIPPETS: Add snippets, query-relevant plain-text excerpts from the document body. Only produced when `query` is present; a scope-only scan has nothing to excerpt. - x-speakeasy-enum-descriptions: - SNIPPETS: Add snippets, query-relevant plain-text excerpts from the document body. Only produced when `query` is present; a scope-only scan has nothing to excerpt. - PlatformSearchEnumerationRequest: - type: object - additionalProperties: false - description: | - Selection to enumerate. At least one of `datasources`, `query`, or `filters` must be set. - example: - query: amoxicillin - datasources: - - gdrive - page_size: 500 - properties: - query: - type: string - minLength: 1 - description: | - The search query string. Supports inline operators such as `from:jane type:document app:confluence`. Inline operators are AND'd with structured `filters`. - datasources: - type: array - minItems: 1 - items: - type: string - minLength: 1 - description: | - Restrict results to specific datasource identifiers returned by `GET /api/search/filters`. Scopes by datasource type and may include results from multiple instances of that type. Omit to enumerate across all visible datasources matching `query` or `filters`. - filters: - type: array - minItems: 1 - items: - $ref: "#/components/schemas/PlatformFilter" - description: | - Structured filters applied to search results. Multiple values within a filter with `EQUALS` are OR'd; separate filters are AND'd. Conflicting constraints on the same field (for example, `type:document` in `query` and `type:spreadsheet` in a filter) return an empty result set. See `Filter.field` for built-in field names and operators. Other nonblank field names are accepted as custom filters without validation; behavior depends on your connected sources. - time_range: - $ref: "#/components/schemas/PlatformTimeRange" - page_size: - type: integer - minimum: 1 - maximum: 1000 - default: 100 - description: Number of results to return per page. - cursor: - type: - - string - - "null" - description: | - Opaque pagination token from a previous response's `next_cursor` field. Omit on the first request. Cursors do not expire and are valid only for the original selection. - include: - type: array - minItems: 1 - uniqueItems: true - items: - $ref: "#/components/schemas/PlatformSearchEnumerationInclude" - description: | - Optional field groups to add to each document reference. Each value only adds fields; it does not change which documents are returned. - PlatformDocumentReference: - type: object - additionalProperties: false - required: - - document_id - - url - - title - - datasource - properties: - document_id: - type: string - minLength: 1 - description: | - Indexed Glean store ID. Stable identity for deduplication and the selector accepted by `POST /api/documents/batch`. - example: doc_123 - url: - type: string - format: uri - minLength: 1 - description: Canonical URL of the result. - example: https://docs.google.com/spreadsheets/d/abc - title: - type: string - minLength: 1 - description: Display title. For a conversation, this is a title built from the participants, such as "Alice and Bob", including when the indexed title is the message body. When the result has no title, the server returns Untitled. - example: Amoxicillin inventory - datasource: - type: string - minLength: 1 - description: The datasource this result originates from. - example: gdrive - document_type: - type: - - string - - "null" - minLength: 1 - description: The document type within the datasource. - example: spreadsheet - creator: - $ref: "#/components/schemas/PlatformPersonReference" - owner: - $ref: "#/components/schemas/PlatformPersonReference" - updated_at: - type: - - string - - "null" - format: date-time - description: When the result was last modified. - created_at: - type: - - string - - "null" - format: date-time - description: When the result was created. - snippets: - type: array - items: - type: string - minLength: 1 - description: | - Query-relevant plain-text excerpts from the document body. Present only when the request's `include` contains `SNIPPETS` and `query` is set. - example: - - Amoxicillin 500mg inventory was last counted on... - PlatformSearchEnumerationResponse: - type: object - additionalProperties: false - required: - - results - - has_more - - next_cursor - - request_id - properties: - results: - type: array - items: - $ref: "#/components/schemas/PlatformDocumentReference" - description: Document references at this cursor position. - has_more: - type: boolean - description: Indicates whether additional pages of results are available. - next_cursor: - type: - - string - - "null" - description: | - Opaque token to pass as `cursor` in the next request. Null exactly when `has_more` is false. - request_id: - type: string - minLength: 1 - description: Platform-generated request ID for support correlation. PlatformPerMemberSettings: type: object additionalProperties: false @@ -12227,6 +12018,38 @@ components: source: $ref: "#/components/schemas/PlatformUsagePolicySourceTarget" description: Configured policy supplying this restriction. + PlatformUsageUsedValue: + type: object + additionalProperties: false + description: Accrued usage in one unit, without combining or converting units. + required: + - used + - unit + properties: + used: + type: string + minLength: 1 + maxLength: 24 + pattern: ^(0|[1-9][0-9]*)(\.[0-9]{1,6})?$ + description: Nonnegative decimal usage with at most six fractional digits. + unit: + $ref: "#/components/schemas/PlatformUsageUnit" + description: Unit of accrued usage. + PlatformUsageAggregateUsage: + type: object + additionalProperties: false + description: | + Existing clientless AGENT counter usage in the current UTC calendar month, independent of agent/default policies and the selected spend client. This records aggregate attribution, not certified run lineage or exact app usage. Counter failures omit aggregate_usage, never fabricate zero amounts. + required: + - used_by_unit + properties: + used_by_unit: + type: array + minItems: 2 + maxItems: 2 + description: Existing aggregate counters in USD then CREDITS, including zero amounts. + items: + $ref: "#/components/schemas/PlatformUsageUsedValue" PlatformUsageLimitDecision: type: string description: Configured-budget status for the target, independent of runtime admission switches. @@ -12366,6 +12189,7 @@ components: - period - value - used + - used_unit - decision - active_actions properties: @@ -12392,7 +12216,13 @@ components: description: Configured cap before approved one-period grants; value.amount is not remaining headroom. used: type: string - description: Decimal amount of accrued usage for this limit. + description: Decimal amount of accrued usage for this limit in used_unit. + used_unit: + $ref: "#/components/schemas/PlatformUsageUnit" + x-glean-experimental: + id: 5c21ff70-7182-49f9-89c7-9c8f4929695f + introduced: "2026-11-16" + description: Resolved counter denomination, including when value.mode is UNLIMITED. current_period_amount: type: string minLength: 1 @@ -12453,7 +12283,7 @@ components: type: object additionalProperties: false description: | - Configured-budget evaluation for a concrete target and period, not runtime admission, model eligibility, or agent-run preflight. AVAILABLE can mean that no configured policy applies; inspect applicable_policy_count and the normalized target and exact period echo. Configured caps are evaluated_limits[].value.amount, accrued usage is evaluated_limits[].used, the cap enforced this period is evaluated_limits[].current_period_amount, per-rule headroom is evaluated_limits[].remaining, and tightest headroom is effective_limits[].remaining. Approved one-period grants raise the current-period amount and headroom without changing the configured cap. Units are never combined or converted. Non-admin evaluation omits shared budgets from applicable_policy_count, evaluated_limits, and effective_limits; decision can be BLOCKED by a shared budget even when the target's own limits show remaining headroom. decision_causes explains every non-AVAILABLE decision, including one caused by a budget that is not listed. + Configured-budget evaluation for a concrete target and period, not runtime admission, model eligibility, or agent-run preflight. AVAILABLE can mean that no configured policy applies; inspect applicable_policy_count and the normalized target and exact period echo. Optional used_by_unit reports exact subject and app usage for USER and ORGANIZATION, independent of policies; AGENT omits it and instead returns clientless aggregate_usage independent of configured policies. Both are omitted, as unknown, when their counters are unavailable; a counter failure returns 503 only when an applicable policy needs a counter. Non-admin evaluation omits shared budgets regardless of the caller's permissions. Hidden shared budgets can block the decision but never contribute counts or soft warnings. Configured caps are evaluated_limits[].value.amount, policy counter usage is evaluated_limits[].used, the cap enforced this period is evaluated_limits[].current_period_amount, per-rule headroom is evaluated_limits[].remaining, and tightest headroom is effective_limits[].remaining. Approved one-period grants raise the current-period amount and headroom without changing the configured cap. Units are never combined or converted. Non-admin evaluation omits shared budgets from applicable_policy_count, evaluated_limits, and effective_limits; decision can be BLOCKED by a shared budget even when the target's own limits show remaining headroom. decision_causes explains every non-AVAILABLE decision, including one caused by a budget that is not listed. example: target: type: USER @@ -12462,6 +12292,11 @@ components: period: type: RECURRING_CALENDAR_MONTH applicable_policy_count: 1 + used_by_unit: + - used: "20" + unit: USD + - used: "0" + unit: CREDITS decision: BLOCKED decision_causes: - decision: BLOCKED @@ -12484,6 +12319,7 @@ components: unit: USD enforcement: HARD used: "20" + used_unit: USD current_period_amount: "80" remaining: "60" decision: AVAILABLE @@ -12543,6 +12379,25 @@ components: minimum: 0 description: | Number of applicable configured policies returned in evaluated_limits, including UNLIMITED policies. Zero explicitly means no returned policy matched, not an unlimited configured rule. Non-admin evaluation excludes shared budgets. Included even when zero. + aggregate_usage: + $ref: "#/components/schemas/PlatformUsageAggregateUsage" + x-glean-experimental: + id: 3a6dcfc9-9429-45da-ba71-945c43c1dfd7 + introduced: "2026-11-16" + description: | + Present only for AGENT, including without configured policies. Existing clientless AGENT counters, never relabeled as selected-client usage. Omitted, as unknown, when the counters are unavailable. + used_by_unit: + type: array + x-go-type-skip-optional-pointer: true + x-glean-experimental: + id: 9d805f36-84ee-43de-a21a-a41426dce590 + introduced: "2026-11-16" + minItems: 2 + maxItems: 2 + items: + $ref: "#/components/schemas/PlatformUsageUsedValue" + description: | + Live accrued usage for exactly the normalized USER or ORGANIZATION and selected app in the current UTC calendar month. When present, contains USD then CREDITS, including zero amounts and when no policy applies. AGENT omits this field until exact per-app counters are ready; existing agent policy evaluation, usage, headroom and decisions remain available. Also omitted when the counters are unavailable. Absence is unknown, not zero or relabeled aggregate usage. This field is not a sum of policy counters or workspace constraints. decision: $ref: "#/components/schemas/PlatformUsageLimitDecision" description: | @@ -12560,7 +12415,7 @@ components: items: $ref: "#/components/schemas/PlatformUsageHeadroomValue" description: | - Tightest remaining budget per finite unit, ordered USD then CREDITS. remaining is headroom after accrued usage and approved one-period grants, not a configured cap. Units are never combined or converted. When no finite policy applies, contains a single UNLIMITED entry without remaining, unit, or enforcement, including when applicable_policy_count is zero. Covers only returned evaluated_limits, so non-admin headroom excludes shared budgets. This configured-budget result is not a runtime admission guarantee. + Tightest visible remaining budget per finite unit, ordered USD then CREDITS. remaining is headroom after accrued usage and approved one-period grants, not a configured cap. Units are never combined or converted. When no visible finite policy applies, contains a single UNLIMITED entry without remaining, unit, or enforcement, including when applicable_policy_count is zero. Covers only returned evaluated_limits, so non-admin headroom excludes shared budgets and is not evidence that they are unlimited or available. This configured-budget result is not a runtime admission guarantee. evaluated_limits: type: array items: @@ -12754,6 +12609,11 @@ components: next_cursor: type: "null" description: If present on the last page, the cursor must be null. + PlatformDesiredLimitAmount: + type: string + pattern: ^([1-9][0-9]*(\.[0-9]+)?|0\.[0-9]*[1-9][0-9]*)$ + description: | + Desired new total monthly limit in the applicable limit's denomination, encoded as a positive plain decimal string, not an additive increase. Required on creation when the workspace requires an amount and business justification; otherwise optional. The backend stores float32 values, not arbitrary-precision decimals. This is a request, not an approval. PlatformRequestEntityType: type: string enum: @@ -12784,6 +12644,9 @@ components: description: | A request as its requester or agent editor sees it: the outcome, approved amount, and note, but not who resolved it or how broadly. The Glean app shows those details only to billing readers, through AdministrativeLimitIncreaseRequest. properties: + desired_limit_amount: + $ref: "#/components/schemas/PlatformDesiredLimitAmount" + description: Stored desired total monthly limit, when supplied; older requests may omit it. request_id: type: string description: Server-assigned resource identifier, distinct from the response's trace request_id. @@ -12894,7 +12757,11 @@ components: type: string maxLength: 4096 description: | - Explanation of why the increase is needed. Required, and nonblank, when the workspace's request-more configuration requires a business justification. + Explanation of why the increase is needed. Required, and nonblank, when the workspace's request-more configuration requires an amount and business justification. + desired_limit_amount: + $ref: "#/components/schemas/PlatformDesiredLimitAmount" + description: | + Desired total limit for the current UTC month. Required when the workspace requires an amount and justification. PlatformPersonalRequestResponse: type: object additionalProperties: false @@ -12984,6 +12851,9 @@ components: description: | A request as a billing reader sees it: every PersonalLimitIncreaseRequest field, plus who resolved it and the approval's scope and breadth. properties: + desired_limit_amount: + $ref: "#/components/schemas/PlatformDesiredLimitAmount" + description: Stored desired total monthly limit, when supplied; older requests may omit it. request_id: type: string description: Server-assigned resource identifier, distinct from the response's trace request_id. @@ -13128,7 +12998,11 @@ components: type: string maxLength: 4096 description: | - Explanation of why the increase is needed. Required, and nonblank, when the workspace's request-more configuration requires a business justification. + Explanation of why the increase is needed. Required, and nonblank, when the workspace's request-more configuration requires an amount and business justification. + desired_limit_amount: + $ref: "#/components/schemas/PlatformDesiredLimitAmount" + description: | + Desired total agent limit for the current UTC month. Required when the workspace requires an amount and justification. PlatformAdministrativeRequestResponse: type: object additionalProperties: false diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index d74e272d..c7619963 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,9 +1,9 @@ -speakeasyVersion: 1.809.0 +speakeasyVersion: 1.810.0 sources: Glean API: sourceNamespace: glean-api-specs - sourceRevisionDigest: sha256:9520eaea4f882d898719574ee75afc5c9289562b08a4ddbf337693f3041aaae3 - sourceBlobDigest: sha256:d1b9b1adb0aa1d72885cc0bd86db9adc236a161f7f0b70b9f5cc61cf5c7052bd + sourceRevisionDigest: sha256:0ce4e9b2b8560aa2004ea154dba75c6bb685cccc1fc5dd9a0b10c8825182e0b5 + sourceBlobDigest: sha256:4f89567ad6174b01fa95ea0e4c705bcfe303ad158f8935313105767ec9cd3492 tags: - latest petstore-oas: @@ -17,10 +17,10 @@ targets: glean: source: Glean API sourceNamespace: glean-api-specs - sourceRevisionDigest: sha256:9520eaea4f882d898719574ee75afc5c9289562b08a4ddbf337693f3041aaae3 - sourceBlobDigest: sha256:d1b9b1adb0aa1d72885cc0bd86db9adc236a161f7f0b70b9f5cc61cf5c7052bd + sourceRevisionDigest: sha256:0ce4e9b2b8560aa2004ea154dba75c6bb685cccc1fc5dd9a0b10c8825182e0b5 + sourceBlobDigest: sha256:4f89567ad6174b01fa95ea0e4c705bcfe303ad158f8935313105767ec9cd3492 codeSamplesNamespace: glean-api-specs-go-code-samples - codeSamplesRevisionDigest: sha256:8e42a62eda9d1638f4384f4242db5c660ddb3cf83ff1d20d7e925f2827aa4fde + codeSamplesRevisionDigest: sha256:76f0de87055ebaf36603147ff3188a4d7d7aa32b6825ad830ed5dd43266cd142 petstore: source: petstore-oas sourceNamespace: petstore-oas diff --git a/README.md b/README.md index e94de045..f8c976bb 100644 --- a/README.md +++ b/README.md @@ -500,7 +500,6 @@ For more information on obtaining the appropriate token type, please contact you * [Query](docs/sdks/search/README.md#query) - Search * [ListFilters](docs/sdks/search/README.md#listfilters) - List search filters -* [Enumerate](docs/sdks/search/README.md#enumerate) - Enumerate matching documents ### [Skills](docs/sdks/skills/README.md) diff --git a/RELEASES.md b/RELEASES.md index 7857f07c..b03992bc 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1098,4 +1098,14 @@ Based on: ### Generated - [go v0.17.7] . ### Releases -- [Go v0.17.7] https://github.com/gleanwork/api-client-go/releases/tag/v0.17.7 - . \ No newline at end of file +- [Go v0.17.7] https://github.com/gleanwork/api-client-go/releases/tag/v0.17.7 - . + +## 2026-11-17 20:22:48 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.810.0 (2.961.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.17.8] . +### Releases +- [Go v0.17.8] https://github.com/gleanwork/api-client-go/releases/tag/v0.17.8 - . \ No newline at end of file diff --git a/docs/models/components/platformdocumentreference.md b/docs/models/components/platformdocumentreference.md deleted file mode 100644 index c91185b0..00000000 --- a/docs/models/components/platformdocumentreference.md +++ /dev/null @@ -1,17 +0,0 @@ -# PlatformDocumentReference - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `DocumentID` | `string` | :heavy_check_mark: | Indexed Glean store ID. Stable identity for deduplication and the selector accepted by `POST /api/documents/batch`.
| doc_123 | -| `URL` | `string` | :heavy_check_mark: | Canonical URL of the result. | https://docs.google.com/spreadsheets/d/abc | -| `Title` | `string` | :heavy_check_mark: | Display title. For a conversation, this is a title built from the participants, such as "Alice and Bob", including when the indexed title is the message body. When the result has no title, the server returns Untitled. | Amoxicillin inventory | -| `Datasource` | `string` | :heavy_check_mark: | The datasource this result originates from. | gdrive | -| `DocumentType` | `*string` | :heavy_minus_sign: | The document type within the datasource. | spreadsheet | -| `Creator` | [*components.PlatformPersonReference](../../models/components/platformpersonreference.md) | :heavy_minus_sign: | A lightweight reference to a person, used where a payload merely points at someone. | | -| `Owner` | [*components.PlatformPersonReference](../../models/components/platformpersonreference.md) | :heavy_minus_sign: | A lightweight reference to a person, used where a payload merely points at someone. | | -| `UpdatedAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | When the result was last modified. | | -| `CreatedAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | When the result was created. | | -| `Snippets` | []`string` | :heavy_minus_sign: | Query-relevant plain-text excerpts from the document body. Present only when the request's `include` contains `SNIPPETS` and `query` is set.
| [
"Amoxicillin 500mg inventory was last counted on..."
] | \ No newline at end of file diff --git a/docs/models/components/platformsearchenumerationinclude.md b/docs/models/components/platformsearchenumerationinclude.md deleted file mode 100644 index 88bf455a..00000000 --- a/docs/models/components/platformsearchenumerationinclude.md +++ /dev/null @@ -1,20 +0,0 @@ -# PlatformSearchEnumerationInclude - -Optional document reference projection. - -## Example Usage - -```go -import ( - "github.com/gleanwork/api-client-go/models/components" -) - -value := components.PlatformSearchEnumerationIncludeSnippets -``` - - -## Values - -| Name | Value | -| ------------------------------------------ | ------------------------------------------ | -| `PlatformSearchEnumerationIncludeSnippets` | SNIPPETS | \ No newline at end of file diff --git a/docs/models/components/platformsearchenumerationrequest.md b/docs/models/components/platformsearchenumerationrequest.md deleted file mode 100644 index 8bc42712..00000000 --- a/docs/models/components/platformsearchenumerationrequest.md +++ /dev/null @@ -1,17 +0,0 @@ -# PlatformSearchEnumerationRequest - -Selection to enumerate. At least one of `datasources`, `query`, or `filters` must be set. - - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Query` | `*string` | :heavy_minus_sign: | The search query string. Supports inline operators such as `from:jane type:document app:confluence`. Inline operators are AND'd with structured `filters`.
| -| `Datasources` | []`string` | :heavy_minus_sign: | Restrict results to specific datasource identifiers returned by `GET /api/search/filters`. Scopes by datasource type and may include results from multiple instances of that type. Omit to enumerate across all visible datasources matching `query` or `filters`.
| -| `Filters` | [][components.PlatformFilter](../../models/components/platformfilter.md) | :heavy_minus_sign: | Structured filters applied to search results. Multiple values within a filter with `EQUALS` are OR'd; separate filters are AND'd. Conflicting constraints on the same field (for example, `type:document` in `query` and `type:spreadsheet` in a filter) return an empty result set. See `Filter.field` for built-in field names and operators. Other nonblank field names are accepted as custom filters without validation; behavior depends on your connected sources.
| -| `TimeRange` | [*components.PlatformTimeRange](../../models/components/platformtimerange.md) | :heavy_minus_sign: | Filter results to those last updated within this range. | -| `PageSize` | `*int64` | :heavy_minus_sign: | Number of results to return per page. | -| `Cursor` | `*string` | :heavy_minus_sign: | Opaque pagination token from a previous response's `next_cursor` field. Omit on the first request. Cursors do not expire and are valid only for the original selection.
| -| `Include` | [][components.PlatformSearchEnumerationInclude](../../models/components/platformsearchenumerationinclude.md) | :heavy_minus_sign: | Optional field groups to add to each document reference. Each value only adds fields; it does not change which documents are returned.
| \ No newline at end of file diff --git a/docs/models/components/platformsearchenumerationresponse.md b/docs/models/components/platformsearchenumerationresponse.md deleted file mode 100644 index b5b0521f..00000000 --- a/docs/models/components/platformsearchenumerationresponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# PlatformSearchEnumerationResponse - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `Results` | [][components.PlatformDocumentReference](../../models/components/platformdocumentreference.md) | :heavy_check_mark: | Document references at this cursor position. | -| `HasMore` | `bool` | :heavy_check_mark: | Indicates whether additional pages of results are available. | -| `NextCursor` | `*string` | :heavy_check_mark: | Opaque token to pass as `cursor` in the next request. Null exactly when `has_more` is false.
| -| `RequestID` | `string` | :heavy_check_mark: | Platform-generated request ID for support correlation. | \ No newline at end of file diff --git a/docs/models/operations/platformsearchenumerationresponse.md b/docs/models/operations/platformsearchenumerationresponse.md deleted file mode 100644 index 2bbd7925..00000000 --- a/docs/models/operations/platformsearchenumerationresponse.md +++ /dev/null @@ -1,9 +0,0 @@ -# PlatformSearchEnumerationResponse - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `PlatformSearchEnumerationResponse` | [*components.PlatformSearchEnumerationResponse](../../models/components/platformsearchenumerationresponse.md) | :heavy_minus_sign: | Successful response. | \ No newline at end of file diff --git a/docs/sdks/search/README.md b/docs/sdks/search/README.md index 93303756..8e0bde06 100644 --- a/docs/sdks/search/README.md +++ b/docs/sdks/search/README.md @@ -6,7 +6,6 @@ * [Query](#query) - Search * [ListFilters](#listfilters) - List search filters -* [Enumerate](#enumerate) - Enumerate matching documents ## Query @@ -122,68 +121,4 @@ func main() { | ------------------------------------ | ------------------------------------ | ------------------------------------ | | apierrors.PlatformProblemDetailError | 400, 401, 403, 404, 408, 429 | application/problem+json | | apierrors.PlatformProblemDetailError | 500, 503 | application/problem+json | -| apierrors.APIError | 4XX, 5XX | \*/\* | - -## Enumerate - -Walk every indexed document that matches a selection and that the caller is permitted to see. Returns document references with minimal metadata and never bodies; request `SNIPPETS` via `include` for query-relevant excerpts, and hydrate full documents with `POST /api/documents/batch`. Unlike `POST /api/search`, `query` is optional: omit it to enumerate by `datasources`, `filters`, and `time_range` alone. Results are ordered for completeness, not relevance. -Follow `next_cursor` until `has_more` is `false`, regardless of page size. This is a live scan, not a snapshot: concurrent index changes can cause duplicates or omissions. Deduplicate by `document_id`. -A page is either complete at its cursor position or an error. A shard or datasource failure returns HTTP 503 and the same cursor stays valid for retry; this endpoint never returns a partial page. A cursor reused with a different selection returns HTTP 400 `invalid_cursor`. - - -### Example Usage - - -```go -package main - -import( - "context" - "os" - apiclientgo "github.com/gleanwork/api-client-go" - "github.com/gleanwork/api-client-go/models/components" - "log" -) - -func main() { - ctx := context.Background() - - s := apiclientgo.New( - apiclientgo.WithSecurity(os.Getenv("GLEAN_API_TOKEN")), - ) - - res, err := s.Search.Enumerate(ctx, components.PlatformSearchEnumerationRequest{ - Query: apiclientgo.Pointer("amoxicillin"), - Datasources: []string{ - "gdrive", - }, - PageSize: apiclientgo.Pointer[int64](500), - }) - if err != nil { - log.Fatal(err) - } - if res.PlatformSearchEnumerationResponse != nil { - // handle response - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `request` | [components.PlatformSearchEnumerationRequest](../../models/components/platformsearchenumerationrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - -### Response - -**[*operations.PlatformSearchEnumerationResponse](../../models/operations/platformsearchenumerationresponse.md), error** - -### Errors - -| Error Type | Status Code | Content Type | -| -------------------------------------- | -------------------------------------- | -------------------------------------- | -| apierrors.PlatformProblemDetailError | 400, 401, 403, 404, 408, 413, 422, 429 | application/problem+json | -| apierrors.PlatformProblemDetailError | 500, 503 | application/problem+json | -| apierrors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file +| apierrors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/glean.go b/glean.go index 15cc3097..20641fc8 100644 --- a/glean.go +++ b/glean.go @@ -165,10 +165,10 @@ func WithTimeout(timeout time.Duration) SDKOption { // New creates a new instance of the SDK with the provided options func New(opts ...SDKOption) *Glean { sdk := &Glean{ - SDKVersion: "0.17.7", + SDKVersion: "0.17.8", sdkConfiguration: config.SDKConfiguration{ - UserAgent: "speakeasy-sdk/go 0.17.7 2.961.1 0.9.0 github.com/gleanwork/api-client-go", - SDKVersion: "0.17.7", + UserAgent: "speakeasy-sdk/go 0.17.8 2.961.1 0.9.0 github.com/gleanwork/api-client-go", + SDKVersion: "0.17.8", GenVersion: "2.961.1", OpenAPIDocVersion: "0.9.0", ServerList: ServerList, diff --git a/models/components/platformdocumentreference.go b/models/components/platformdocumentreference.go deleted file mode 100644 index d9c45ed1..00000000 --- a/models/components/platformdocumentreference.go +++ /dev/null @@ -1,114 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package components - -import ( - "github.com/gleanwork/api-client-go/internal/utils" - "time" -) - -type PlatformDocumentReference struct { - // Indexed Glean store ID. Stable identity for deduplication and the selector accepted by `POST /api/documents/batch`. - // - DocumentID string `json:"document_id"` - // Canonical URL of the result. - URL string `json:"url"` - // Display title. For a conversation, this is a title built from the participants, such as "Alice and Bob", including when the indexed title is the message body. When the result has no title, the server returns Untitled. - Title string `json:"title"` - // The datasource this result originates from. - Datasource string `json:"datasource"` - // The document type within the datasource. - DocumentType *string `json:"document_type,omitempty"` - // A lightweight reference to a person, used where a payload merely points at someone. - Creator *PlatformPersonReference `json:"creator,omitempty"` - // A lightweight reference to a person, used where a payload merely points at someone. - Owner *PlatformPersonReference `json:"owner,omitempty"` - // When the result was last modified. - UpdatedAt *time.Time `json:"updated_at,omitempty"` - // When the result was created. - CreatedAt *time.Time `json:"created_at,omitempty"` - // Query-relevant plain-text excerpts from the document body. Present only when the request's `include` contains `SNIPPETS` and `query` is set. - // - Snippets []string `json:"snippets,omitempty"` -} - -func (p PlatformDocumentReference) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PlatformDocumentReference) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, nil); err != nil { - return err - } - return nil -} - -func (p *PlatformDocumentReference) GetDocumentID() string { - if p == nil { - return "" - } - return p.DocumentID -} - -func (p *PlatformDocumentReference) GetURL() string { - if p == nil { - return "" - } - return p.URL -} - -func (p *PlatformDocumentReference) GetTitle() string { - if p == nil { - return "" - } - return p.Title -} - -func (p *PlatformDocumentReference) GetDatasource() string { - if p == nil { - return "" - } - return p.Datasource -} - -func (p *PlatformDocumentReference) GetDocumentType() *string { - if p == nil { - return nil - } - return p.DocumentType -} - -func (p *PlatformDocumentReference) GetCreator() *PlatformPersonReference { - if p == nil { - return nil - } - return p.Creator -} - -func (p *PlatformDocumentReference) GetOwner() *PlatformPersonReference { - if p == nil { - return nil - } - return p.Owner -} - -func (p *PlatformDocumentReference) GetUpdatedAt() *time.Time { - if p == nil { - return nil - } - return p.UpdatedAt -} - -func (p *PlatformDocumentReference) GetCreatedAt() *time.Time { - if p == nil { - return nil - } - return p.CreatedAt -} - -func (p *PlatformDocumentReference) GetSnippets() []string { - if p == nil { - return nil - } - return p.Snippets -} diff --git a/models/components/platformsearchenumerationinclude.go b/models/components/platformsearchenumerationinclude.go deleted file mode 100644 index 1d1d0d28..00000000 --- a/models/components/platformsearchenumerationinclude.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package components - -import ( - "encoding/json" - "fmt" -) - -// PlatformSearchEnumerationInclude - Optional document reference projection. -type PlatformSearchEnumerationInclude string - -const ( - // PlatformSearchEnumerationIncludeSnippets Add snippets, query-relevant plain-text excerpts from the document body. Only produced when `query` is present; a scope-only scan has nothing to excerpt. - PlatformSearchEnumerationIncludeSnippets PlatformSearchEnumerationInclude = "SNIPPETS" -) - -func (e PlatformSearchEnumerationInclude) ToPointer() *PlatformSearchEnumerationInclude { - return &e -} -func (e *PlatformSearchEnumerationInclude) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "SNIPPETS": - *e = PlatformSearchEnumerationInclude(v) - return nil - default: - return fmt.Errorf("invalid value for PlatformSearchEnumerationInclude: %v", v) - } -} diff --git a/models/components/platformsearchenumerationrequest.go b/models/components/platformsearchenumerationrequest.go deleted file mode 100644 index d83efac1..00000000 --- a/models/components/platformsearchenumerationrequest.go +++ /dev/null @@ -1,90 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package components - -import ( - "github.com/gleanwork/api-client-go/internal/utils" -) - -// PlatformSearchEnumerationRequest - Selection to enumerate. At least one of `datasources`, `query`, or `filters` must be set. -type PlatformSearchEnumerationRequest struct { - // The search query string. Supports inline operators such as `from:jane type:document app:confluence`. Inline operators are AND'd with structured `filters`. - // - Query *string `json:"query,omitempty"` - // Restrict results to specific datasource identifiers returned by `GET /api/search/filters`. Scopes by datasource type and may include results from multiple instances of that type. Omit to enumerate across all visible datasources matching `query` or `filters`. - // - Datasources []string `json:"datasources,omitempty"` - // Structured filters applied to search results. Multiple values within a filter with `EQUALS` are OR'd; separate filters are AND'd. Conflicting constraints on the same field (for example, `type:document` in `query` and `type:spreadsheet` in a filter) return an empty result set. See `Filter.field` for built-in field names and operators. Other nonblank field names are accepted as custom filters without validation; behavior depends on your connected sources. - // - Filters []PlatformFilter `json:"filters,omitempty"` - // Filter results to those last updated within this range. - TimeRange *PlatformTimeRange `json:"time_range,omitempty"` - // Number of results to return per page. - PageSize *int64 `default:"100" json:"page_size"` - // Opaque pagination token from a previous response's `next_cursor` field. Omit on the first request. Cursors do not expire and are valid only for the original selection. - // - Cursor *string `json:"cursor,omitempty"` - // Optional field groups to add to each document reference. Each value only adds fields; it does not change which documents are returned. - // - Include []PlatformSearchEnumerationInclude `json:"include,omitempty"` -} - -func (p PlatformSearchEnumerationRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PlatformSearchEnumerationRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, nil); err != nil { - return err - } - return nil -} - -func (p *PlatformSearchEnumerationRequest) GetQuery() *string { - if p == nil { - return nil - } - return p.Query -} - -func (p *PlatformSearchEnumerationRequest) GetDatasources() []string { - if p == nil { - return nil - } - return p.Datasources -} - -func (p *PlatformSearchEnumerationRequest) GetFilters() []PlatformFilter { - if p == nil { - return nil - } - return p.Filters -} - -func (p *PlatformSearchEnumerationRequest) GetTimeRange() *PlatformTimeRange { - if p == nil { - return nil - } - return p.TimeRange -} - -func (p *PlatformSearchEnumerationRequest) GetPageSize() *int64 { - if p == nil { - return nil - } - return p.PageSize -} - -func (p *PlatformSearchEnumerationRequest) GetCursor() *string { - if p == nil { - return nil - } - return p.Cursor -} - -func (p *PlatformSearchEnumerationRequest) GetInclude() []PlatformSearchEnumerationInclude { - if p == nil { - return nil - } - return p.Include -} diff --git a/models/components/platformsearchenumerationresponse.go b/models/components/platformsearchenumerationresponse.go deleted file mode 100644 index e72eb808..00000000 --- a/models/components/platformsearchenumerationresponse.go +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package components - -type PlatformSearchEnumerationResponse struct { - // Document references at this cursor position. - Results []PlatformDocumentReference `json:"results"` - // Indicates whether additional pages of results are available. - HasMore bool `json:"has_more"` - // Opaque token to pass as `cursor` in the next request. Null exactly when `has_more` is false. - // - NextCursor *string `json:"next_cursor"` - // Platform-generated request ID for support correlation. - RequestID string `json:"request_id"` -} - -func (p *PlatformSearchEnumerationResponse) GetResults() []PlatformDocumentReference { - if p == nil { - return []PlatformDocumentReference{} - } - return p.Results -} - -func (p *PlatformSearchEnumerationResponse) GetHasMore() bool { - if p == nil { - return false - } - return p.HasMore -} - -func (p *PlatformSearchEnumerationResponse) GetNextCursor() *string { - if p == nil { - return nil - } - return p.NextCursor -} - -func (p *PlatformSearchEnumerationResponse) GetRequestID() string { - if p == nil { - return "" - } - return p.RequestID -} diff --git a/models/operations/platformsearchenumeration.go b/models/operations/platformsearchenumeration.go deleted file mode 100644 index c8fd4dea..00000000 --- a/models/operations/platformsearchenumeration.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "github.com/gleanwork/api-client-go/models/components" -) - -type PlatformSearchEnumerationResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // Successful response. - PlatformSearchEnumerationResponse *components.PlatformSearchEnumerationResponse -} - -func (p *PlatformSearchEnumerationResponse) GetHTTPMeta() components.HTTPMetadata { - if p == nil { - return components.HTTPMetadata{} - } - return p.HTTPMeta -} - -func (p *PlatformSearchEnumerationResponse) GetPlatformSearchEnumerationResponse() *components.PlatformSearchEnumerationResponse { - if p == nil { - return nil - } - return p.PlatformSearchEnumerationResponse -} diff --git a/search.go b/search.go index 3e2bff62..7afd8e41 100644 --- a/search.go +++ b/search.go @@ -590,284 +590,3 @@ func (s *Search) ListFilters(ctx context.Context, datasources []string, query *s return res, nil } - -// Enumerate matching documents -// Walk every indexed document that matches a selection and that the caller is permitted to see. Returns document references with minimal metadata and never bodies; request `SNIPPETS` via `include` for query-relevant excerpts, and hydrate full documents with `POST /api/documents/batch`. Unlike `POST /api/search`, `query` is optional: omit it to enumerate by `datasources`, `filters`, and `time_range` alone. Results are ordered for completeness, not relevance. -// Follow `next_cursor` until `has_more` is `false`, regardless of page size. This is a live scan, not a snapshot: concurrent index changes can cause duplicates or omissions. Deduplicate by `document_id`. -// A page is either complete at its cursor position or an error. A shard or datasource failure returns HTTP 503 and the same cursor stays valid for retry; this endpoint never returns a partial page. A cursor reused with a different selection returns HTTP 400 `invalid_cursor`. -func (s *Search) Enumerate(ctx context.Context, request components.PlatformSearchEnumerationRequest, opts ...operations.Option) (*operations.PlatformSearchEnumerationResponse, error) { - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionRetries, - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - var baseURL string - if o.ServerURL == nil { - baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - } else { - baseURL = *o.ServerURL - } - opURL, err := url.JoinPath(baseURL, "/api/search/enumeration") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - hookCtx := hooks.HookContext{ - SDK: s.rootSDK, - SDKConfiguration: s.sdkConfiguration, - BaseURL: baseURL, - Context: ctx, - OperationID: "platform-search-enumeration", - OAuth2Scopes: nil, - SecuritySource: s.sdkConfiguration.Security, - } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - if reqContentType != "" { - req.Header.Set("Content-Type", reqContentType) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - for k, v := range o.SetHeaders { - req.Header.Set(k, v) - } - - globalRetryConfig := s.sdkConfiguration.RetryConfig - retryConfig := o.Retries - if retryConfig == nil { - if globalRetryConfig != nil { - retryConfig = globalRetryConfig - } - } - - var httpRes *http.Response - if retryConfig != nil { - httpRes, err = utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", - }, - }, func() (*http.Response, error) { - if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { - copyBody, err := req.GetBody() - - if err != nil { - return nil, err - } - - req.Body = copyBody - } - - req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { - return nil, err - } - - return nil, retry.Permanent(err) - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - - if err != nil { - return nil, err - } else { - httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - } else { - req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err = s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - } - - res := &operations.PlatformSearchEnumerationResponse{ - HTTPMeta: components.HTTPMetadata{ - Request: req, - Response: httpRes, - }, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out components.PlatformSearchEnumerationResponse - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.PlatformSearchEnumerationResponse = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode == 401: - fallthrough - case httpRes.StatusCode == 403: - fallthrough - case httpRes.StatusCode == 404: - fallthrough - case httpRes.StatusCode == 408: - fallthrough - case httpRes.StatusCode == 413: - fallthrough - case httpRes.StatusCode == 422: - fallthrough - case httpRes.StatusCode == 429: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out apierrors.PlatformProblemDetailError - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, apierrors.NewResponseValidationError("response did not match the declared error schema", httpRes.StatusCode, string(rawBody), httpRes, err) - } - - out.HTTPMeta = components.HTTPMetadata{ - Request: req, - Response: httpRes, - } - return nil, &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode == 500: - fallthrough - case httpRes.StatusCode == 503: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out apierrors.PlatformProblemDetailError - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, apierrors.NewResponseValidationError("response did not match the declared error schema", httpRes.StatusCode, string(rawBody), httpRes, err) - } - - out.HTTPMeta = components.HTTPMetadata{ - Request: req, - Response: httpRes, - } - return nil, &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/tests/messages_test.go b/tests/messages_test.go index 64ef64fe..f927c364 100644 --- a/tests/messages_test.go +++ b/tests/messages_test.go @@ -27,7 +27,7 @@ func TestMessages_Messages(t *testing.T) { IDType: components.IDTypeConversationID, ID: "", TimestampMillis: apiclientgo.Pointer[int64](558834), - Datasource: components.DatasourceFacebookworkplace, + Datasource: components.DatasourceSlack, }, nil) require.NoError(t, err) assert.Equal(t, 200, res.HTTPMeta.Response.StatusCode) diff --git a/tests/mockserver/internal/handler/generated_handlers.go b/tests/mockserver/internal/handler/generated_handlers.go index 10cb3da0..75f142bb 100644 --- a/tests/mockserver/internal/handler/generated_handlers.go +++ b/tests/mockserver/internal/handler/generated_handlers.go @@ -94,7 +94,6 @@ func GeneratedHandlers(ctx context.Context, dir *logging.HTTPFileDirectory, rt * NewGeneratedHandler(ctx, http.MethodPost, "/api/index/v1/rotatetoken", pathPostAPIIndexV1Rotatetoken(dir, rt)), NewGeneratedHandler(ctx, http.MethodPost, "/api/index/v1/updatepermissions", pathPostAPIIndexV1Updatepermissions(dir, rt)), NewGeneratedHandler(ctx, http.MethodPost, "/api/search", pathPostAPISearch(dir, rt)), - NewGeneratedHandler(ctx, http.MethodPost, "/api/search/enumeration", pathPostAPISearchEnumeration(dir, rt)), NewGeneratedHandler(ctx, http.MethodPost, "/api/skills", pathPostAPISkills(dir, rt)), NewGeneratedHandler(ctx, http.MethodPost, "/api/skills/import", pathPostAPISkillsImport(dir, rt)), NewGeneratedHandler(ctx, http.MethodPost, "/api/skills/sources/preview", pathPostAPISkillsSourcesPreview(dir, rt)), diff --git a/tests/mockserver/internal/handler/pathpostapisearchenumeration.go b/tests/mockserver/internal/handler/pathpostapisearchenumeration.go deleted file mode 100644 index 8434a2e3..00000000 --- a/tests/mockserver/internal/handler/pathpostapisearchenumeration.go +++ /dev/null @@ -1,72 +0,0 @@ -// 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/utils" - "mockserver/internal/tracking" - "net/http" -) - -func pathPostAPISearchEnumeration(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 "platform-search-enumeration[0]": - dir.HandlerFunc("platform-search-enumeration", testPlatformSearchEnumerationPlatformSearchEnumeration0)(w, req) - default: - http.Error(w, fmt.Sprintf("Unknown test: %s[%d]", test, count), http.StatusBadRequest) - } - } -} - -func testPlatformSearchEnumerationPlatformSearchEnumeration0(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.ContentType(req, "application/json", true); err != nil { - log.Printf("assertion error: %s\n", err) - http.Error(w, err.Error(), http.StatusBadRequest) - 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.PlatformSearchEnumerationResponse = &components.PlatformSearchEnumerationResponse{ - Results: []components.PlatformDocumentReference{}, - HasMore: false, - NextCursor: nil, - RequestID: "", - } - 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/sdk/models/components/platformdocumentreference.go b/tests/mockserver/internal/sdk/models/components/platformdocumentreference.go deleted file mode 100644 index 8d5ee032..00000000 --- a/tests/mockserver/internal/sdk/models/components/platformdocumentreference.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package components - -import ( - "mockserver/internal/sdk/optionalnullable" - "mockserver/internal/sdk/utils" - "time" -) - -type PlatformDocumentReference struct { - // Indexed Glean store ID. Stable identity for deduplication and the selector accepted by `POST /api/documents/batch`. - // - DocumentID string `json:"document_id"` - // Canonical URL of the result. - URL string `json:"url"` - // Display title. For a conversation, this is a title built from the participants, such as "Alice and Bob", including when the indexed title is the message body. When the result has no title, the server returns Untitled. - Title string `json:"title"` - // The datasource this result originates from. - Datasource string `json:"datasource"` - // The document type within the datasource. - DocumentType optionalnullable.OptionalNullable[string] `json:"document_type,omitempty"` - // A lightweight reference to a person, used where a payload merely points at someone. - Creator *PlatformPersonReference `json:"creator,omitempty"` - // A lightweight reference to a person, used where a payload merely points at someone. - Owner *PlatformPersonReference `json:"owner,omitempty"` - // When the result was last modified. - UpdatedAt optionalnullable.OptionalNullable[time.Time] `json:"updated_at,omitempty"` - // When the result was created. - CreatedAt optionalnullable.OptionalNullable[time.Time] `json:"created_at,omitempty"` - // Query-relevant plain-text excerpts from the document body. Present only when the request's `include` contains `SNIPPETS` and `query` is set. - // - Snippets []string `json:"snippets,omitempty"` -} - -func (p PlatformDocumentReference) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PlatformDocumentReference) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, []string{"document_id", "url", "title", "datasource"}); err != nil { - return err - } - return nil -} - -func (o *PlatformDocumentReference) GetDocumentID() string { - if o == nil { - return "" - } - return o.DocumentID -} - -func (o *PlatformDocumentReference) GetURL() string { - if o == nil { - return "" - } - return o.URL -} - -func (o *PlatformDocumentReference) GetTitle() string { - if o == nil { - return "" - } - return o.Title -} - -func (o *PlatformDocumentReference) GetDatasource() string { - if o == nil { - return "" - } - return o.Datasource -} - -func (o *PlatformDocumentReference) GetDocumentType() optionalnullable.OptionalNullable[string] { - if o == nil { - return nil - } - return o.DocumentType -} - -func (o *PlatformDocumentReference) GetCreator() *PlatformPersonReference { - if o == nil { - return nil - } - return o.Creator -} - -func (o *PlatformDocumentReference) GetOwner() *PlatformPersonReference { - if o == nil { - return nil - } - return o.Owner -} - -func (o *PlatformDocumentReference) GetUpdatedAt() optionalnullable.OptionalNullable[time.Time] { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *PlatformDocumentReference) GetCreatedAt() optionalnullable.OptionalNullable[time.Time] { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *PlatformDocumentReference) GetSnippets() []string { - if o == nil { - return nil - } - return o.Snippets -} diff --git a/tests/mockserver/internal/sdk/models/components/platformsearchenumerationinclude.go b/tests/mockserver/internal/sdk/models/components/platformsearchenumerationinclude.go deleted file mode 100644 index e944cdb0..00000000 --- a/tests/mockserver/internal/sdk/models/components/platformsearchenumerationinclude.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package components - -import ( - "encoding/json" - "fmt" -) - -// PlatformSearchEnumerationInclude - Optional document reference projection. -type PlatformSearchEnumerationInclude string - -const ( - PlatformSearchEnumerationIncludeSnippets PlatformSearchEnumerationInclude = "SNIPPETS" -) - -func (e PlatformSearchEnumerationInclude) ToPointer() *PlatformSearchEnumerationInclude { - return &e -} -func (e *PlatformSearchEnumerationInclude) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "SNIPPETS": - *e = PlatformSearchEnumerationInclude(v) - return nil - default: - return fmt.Errorf("invalid value for PlatformSearchEnumerationInclude: %v", v) - } -} diff --git a/tests/mockserver/internal/sdk/models/components/platformsearchenumerationrequest.go b/tests/mockserver/internal/sdk/models/components/platformsearchenumerationrequest.go deleted file mode 100644 index a5fd5eaf..00000000 --- a/tests/mockserver/internal/sdk/models/components/platformsearchenumerationrequest.go +++ /dev/null @@ -1,91 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package components - -import ( - "mockserver/internal/sdk/optionalnullable" - "mockserver/internal/sdk/utils" -) - -// PlatformSearchEnumerationRequest - Selection to enumerate. At least one of `datasources`, `query`, or `filters` must be set. -type PlatformSearchEnumerationRequest struct { - // The search query string. Supports inline operators such as `from:jane type:document app:confluence`. Inline operators are AND'd with structured `filters`. - // - Query *string `json:"query,omitempty"` - // Restrict results to specific datasource identifiers returned by `GET /api/search/filters`. Scopes by datasource type and may include results from multiple instances of that type. Omit to enumerate across all visible datasources matching `query` or `filters`. - // - Datasources []string `json:"datasources,omitempty"` - // Structured filters applied to search results. Multiple values within a filter with `EQUALS` are OR'd; separate filters are AND'd. Conflicting constraints on the same field (for example, `type:document` in `query` and `type:spreadsheet` in a filter) return an empty result set. See `Filter.field` for built-in field names and operators. Other nonblank field names are accepted as custom filters without validation; behavior depends on your connected sources. - // - Filters []PlatformFilter `json:"filters,omitempty"` - // Filter results to those last updated within this range. - TimeRange *PlatformTimeRange `json:"time_range,omitempty"` - // Number of results to return per page. - PageSize *int64 `default:"100" json:"page_size"` - // Opaque pagination token from a previous response's `next_cursor` field. Omit on the first request. Cursors do not expire and are valid only for the original selection. - // - Cursor optionalnullable.OptionalNullable[string] `json:"cursor,omitempty"` - // Optional field groups to add to each document reference. Each value only adds fields; it does not change which documents are returned. - // - Include []PlatformSearchEnumerationInclude `json:"include,omitempty"` -} - -func (p PlatformSearchEnumerationRequest) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *PlatformSearchEnumerationRequest) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, nil); err != nil { - return err - } - return nil -} - -func (o *PlatformSearchEnumerationRequest) GetQuery() *string { - if o == nil { - return nil - } - return o.Query -} - -func (o *PlatformSearchEnumerationRequest) GetDatasources() []string { - if o == nil { - return nil - } - return o.Datasources -} - -func (o *PlatformSearchEnumerationRequest) GetFilters() []PlatformFilter { - if o == nil { - return nil - } - return o.Filters -} - -func (o *PlatformSearchEnumerationRequest) GetTimeRange() *PlatformTimeRange { - if o == nil { - return nil - } - return o.TimeRange -} - -func (o *PlatformSearchEnumerationRequest) GetPageSize() *int64 { - if o == nil { - return nil - } - return o.PageSize -} - -func (o *PlatformSearchEnumerationRequest) GetCursor() optionalnullable.OptionalNullable[string] { - if o == nil { - return nil - } - return o.Cursor -} - -func (o *PlatformSearchEnumerationRequest) GetInclude() []PlatformSearchEnumerationInclude { - if o == nil { - return nil - } - return o.Include -} diff --git a/tests/mockserver/internal/sdk/models/components/platformsearchenumerationresponse.go b/tests/mockserver/internal/sdk/models/components/platformsearchenumerationresponse.go deleted file mode 100644 index f2ecd205..00000000 --- a/tests/mockserver/internal/sdk/models/components/platformsearchenumerationresponse.go +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package components - -type PlatformSearchEnumerationResponse struct { - // Document references at this cursor position. - Results []PlatformDocumentReference `json:"results"` - // Indicates whether additional pages of results are available. - HasMore bool `json:"has_more"` - // Opaque token to pass as `cursor` in the next request. Null exactly when `has_more` is false. - // - NextCursor *string `json:"next_cursor"` - // Platform-generated request ID for support correlation. - RequestID string `json:"request_id"` -} - -func (o *PlatformSearchEnumerationResponse) GetResults() []PlatformDocumentReference { - if o == nil { - return []PlatformDocumentReference{} - } - return o.Results -} - -func (o *PlatformSearchEnumerationResponse) GetHasMore() bool { - if o == nil { - return false - } - return o.HasMore -} - -func (o *PlatformSearchEnumerationResponse) GetNextCursor() *string { - if o == nil { - return nil - } - return o.NextCursor -} - -func (o *PlatformSearchEnumerationResponse) GetRequestID() string { - if o == nil { - return "" - } - return o.RequestID -} diff --git a/tests/mockserver/internal/sdk/models/operations/platformsearchenumeration.go b/tests/mockserver/internal/sdk/models/operations/platformsearchenumeration.go deleted file mode 100644 index 4b5ba7fe..00000000 --- a/tests/mockserver/internal/sdk/models/operations/platformsearchenumeration.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package operations - -import ( - "mockserver/internal/sdk/models/components" -) - -type PlatformSearchEnumerationResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // Successful response. - PlatformSearchEnumerationResponse *components.PlatformSearchEnumerationResponse -} - -func (o *PlatformSearchEnumerationResponse) GetHTTPMeta() components.HTTPMetadata { - if o == nil { - return components.HTTPMetadata{} - } - return o.HTTPMeta -} - -func (o *PlatformSearchEnumerationResponse) GetPlatformSearchEnumerationResponse() *components.PlatformSearchEnumerationResponse { - if o == nil { - return nil - } - return o.PlatformSearchEnumerationResponse -} diff --git a/tests/search_test.go b/tests/search_test.go index aace2db8..0bad27c2 100644 --- a/tests/search_test.go +++ b/tests/search_test.go @@ -2109,24 +2109,5 @@ func TestSearch_PlatformSearchFilters(t *testing.T) { } func TestSearch_PlatformSearchEnumeration(t *testing.T) { - ctx := context.Background() - - testHTTPClient := createTestHTTPClient("platform-search-enumeration") - - s := apiclientgo.New( - apiclientgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), - apiclientgo.WithClient(testHTTPClient), - apiclientgo.WithSecurity(utils.GetEnv("GLEAN_API_TOKEN", "value")), - ) - - res, err := s.Search.Enumerate(ctx, components.PlatformSearchEnumerationRequest{ - Query: apiclientgo.Pointer("amoxicillin"), - Datasources: []string{ - "gdrive", - }, - PageSize: apiclientgo.Pointer[int64](500), - }) - require.NoError(t, err) - assert.Equal(t, 200, res.HTTPMeta.Response.StatusCode) - + t.Skip("incomplete test found please make sure to address the following errors: [`workflow step platform-search-enumeration.test referencing operation platform-search-enumeration not found in document`]") } diff --git a/tests/summarize_test.go b/tests/summarize_test.go index 4bfe1645..c35381da 100644 --- a/tests/summarize_test.go +++ b/tests/summarize_test.go @@ -27,12 +27,13 @@ func TestSummarize_Summarize(t *testing.T) { DocumentSpecs: []components.DocumentSpecUnion{ components.CreateDocumentSpecUnionDocumentSpec1( components.DocumentSpec1{ - URL: "https://dim-glider.com/", + URL: "https://hungry-coast.biz/", }, ), - components.CreateDocumentSpecUnionDocumentSpec2( - components.DocumentSpec2{ - ID: "", + components.CreateDocumentSpecUnionDocumentSpec4( + components.DocumentSpec4{ + UgcType: components.DocumentSpecUgcType2Chats, + UgcID: "", }, ), },