From 180f4fd578fe68c52a195e95c7b3966f83f50955 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Thu, 11 Jun 2026 04:48:25 +0000 Subject: [PATCH 1/2] ## Java SDK Changes: * `glean.agents.createAgent()`: **Added** * `glean.client.announcements.create()`: * `request.createAnnouncementRequest.body.structuredList[].document.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added** * `response.body.structuredList[].document.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added** * `glean.client.announcements.update()`: * `request.updateAnnouncementRequest.body.structuredList[].document.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added** * `response.body.structuredList[].document.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added** * `glean.client.answers.create()`: * `request.createAnswerRequest.data.addedRoles[].group.type.enum(collectionAudience)` **Added** * `response.addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.answers.update()`: * `request.editAnswerRequest.addedRoles[].group.type.enum(collectionAudience)` **Added** * `response.addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.answers.retrieve()`: `response.answerResult.answer.addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.answers.list()`: `response.answerResults[].answer.addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.chat.create()`: * `request.chatRequest.messages[].citations[].sourceDocument.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added** * `response.messages[].citations[].sourceDocument.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added** * `glean.client.chat.retrieve()`: `response.chatResult.chat.createdBy.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.chat.list()`: `response.chatResults[].chat.createdBy.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.chat.createStream()`: * `request.chatRequest.messages[].citations[].sourceDocument.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added** * `glean.client.collections.addItems()`: `response.collection.addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.collections.create()`: * `request.createCollectionRequest.addedRoles[].group.type.enum(collectionAudience)` **Added** * `response.union(class (0)).collection.addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.collections.deleteItem()`: `response.collection.addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.collections.update()`: * `request.editCollectionRequest.addedRoles[].group.type.enum(collectionAudience)` **Added** * `response.addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.collections.updateItem()`: `response.collection.addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.collections.retrieve()`: `response.collection.addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.collections.list()`: `response.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.documents.retrieve()`: `response.documents.Map.union(Document).metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added** * `glean.client.documents.retrieveByFacets()`: `response.documents[].metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added** * `glean.client.insights.retrieve()`: `response.gleanAssist.activityInsights[].user.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.messages.retrieve()`: `response.searchResponse.results[].structuredResults[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.pins.update()`: `response.attribution.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.pins.retrieve()`: `response.pin.attribution.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.pins.list()`: `response.pins[].attribution.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.pins.create()`: `response.attribution.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.search.queryAsAdmin()`: * `request.searchRequest.sourceDocument.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added** * `response.results[].structuredResults[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.search.autocomplete()`: `response.results[].document.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added** * `glean.client.search.retrieveFeed()`: `response.results[].primaryEntry.createdBy.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.search.recommendations()`: * `request.recommendationsRequest.sourceDocument.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added** * `response.results[].structuredResults[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.search.query()`: * `request.searchRequest.sourceDocument.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added** * `response.results[].structuredResults[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.entities.list()`: `response.results[].relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.entities.readPeople()`: `response.results[].relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.shortcuts.create()`: * `request.createShortcutRequest.data.addedRoles[].group.type.enum(collectionAudience)` **Added** * `response.shortcut.addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.shortcuts.retrieve()`: `response.shortcut.addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.shortcuts.list()`: `response.shortcuts[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.shortcuts.update()`: * `request.updateShortcutRequest.addedRoles[].group.type.enum(collectionAudience)` **Added** * `response.shortcut.addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.verification.addReminder()`: `response.metadata.lastVerifier.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.verification.list()`: `response.documents[].metadata.lastVerifier.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** * `glean.client.verification.verify()`: `response.metadata.lastVerifier.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added** --- .speakeasy/gen.lock | 137 +++-- .speakeasy/gen.yaml | 2 +- .speakeasy/glean-merged-spec.yaml | 177 +++--- .speakeasy/workflow.lock | 12 +- README.md | 13 +- RELEASES.md | 12 +- build.gradle | 42 -- .../components/CreateWorkflowRequest.md | 10 + docs/models/components/GroupType.md | 21 +- docs/models/operations/CreateAgentRequest.md | 10 + docs/models/operations/CreateAgentResponse.md | 11 + docs/sdks/agents/README.md | 54 ++ gradle.properties | 2 +- settings.gradle | 6 - .../build.gradle | 35 -- .../ConditionalOnPropertyPrefix.java | 42 -- .../GleanApiClientAutoConfig.java | 457 --------------- .../GleanApiClientAutoConfigProperties.java | 518 ------------------ .../OnPropertyPrefixCondition.java | 69 --- ...ot.autoconfigure.AutoConfiguration.imports | 1 - .../build.gradle | 29 - .../api_client/glean_api_client/Agents.java | 55 ++ .../glean_api_client/AsyncAgents.java | 55 ++ .../api_client/glean_api_client/Glean.java | 2 +- .../glean_api_client/SDKConfiguration.java | 4 +- .../components/CreateWorkflowRequest.java | 250 +++++++++ .../models/components/GroupType.java | 6 +- .../models/operations/CreateAgentRequest.java | 241 ++++++++ .../operations/CreateAgentRequestBuilder.java | 78 +++ .../operations/CreateAgentResponse.java | 254 +++++++++ .../async/CreateAgentRequestBuilder.java | 81 +++ .../operations/async/CreateAgentResponse.java | 254 +++++++++ .../operations/CreateAgent.java | 266 +++++++++ 33 files changed, 1856 insertions(+), 1350 deletions(-) create mode 100644 docs/models/components/CreateWorkflowRequest.md create mode 100644 docs/models/operations/CreateAgentRequest.md create mode 100644 docs/models/operations/CreateAgentResponse.md delete mode 100644 spring/glean-api-client-spring-boot-autoconfigure/build.gradle delete mode 100644 spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/ConditionalOnPropertyPrefix.java delete mode 100644 spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/GleanApiClientAutoConfig.java delete mode 100644 spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/GleanApiClientAutoConfigProperties.java delete mode 100644 spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/OnPropertyPrefixCondition.java delete mode 100644 spring/glean-api-client-spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 spring/glean-api-client-spring-boot-starter/build.gradle create mode 100644 src/main/java/com/glean/api_client/glean_api_client/models/components/CreateWorkflowRequest.java create mode 100644 src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAgentRequest.java create mode 100644 src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAgentRequestBuilder.java create mode 100644 src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAgentResponse.java create mode 100644 src/main/java/com/glean/api_client/glean_api_client/models/operations/async/CreateAgentRequestBuilder.java create mode 100644 src/main/java/com/glean/api_client/glean_api_client/models/operations/async/CreateAgentResponse.java create mode 100644 src/main/java/com/glean/api_client/glean_api_client/operations/CreateAgent.java diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 2687bb9f..c570e9f3 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,26 +1,26 @@ lockVersion: 2.0.0 id: 0359d4fe-2923-46fc-aaca-cf70b48dcfa1 management: - docChecksum: f945598f65bd3d18fa64e0f4961a6114 + docChecksum: b432548b29519fa4ca9a037b9aa97ff9 docVersion: 0.9.0 - speakeasyVersion: 1.771.0 - generationVersion: 2.893.0 - releaseVersion: 0.13.1 - configChecksum: d71729687a43ca8615eddfaa55f55d73 + speakeasyVersion: 1.776.0 + generationVersion: 2.900.1 + releaseVersion: 0.13.2 + configChecksum: 01f92ca30e2bf918b3bac1a614226956 repoURL: https://github.com/gleanwork/api-client-java.git installationURL: https://github.com/gleanwork/api-client-java published: true persistentEdits: - generation_id: 80b9a894-73cd-4094-9cb1-9e21d44a6243 - pristine_commit_hash: b075f4faa68b3b0e26c9ea82e9aad4b5e7cfca0b - pristine_tree_hash: ea0f232fefae79fa3cf902a8fa77686f15cbce0d + generation_id: e4b89a8f-fe31-41ec-9698-bd01c69fbba1 + pristine_commit_hash: 1475d7665153bc3af4b8ae1951de6a5108487950 + pristine_tree_hash: 98bf42512583fc1244a7e4af6bff2d46e9a5d82f features: java: acceptHeaders: 2.81.2 additionalDependencies: 0.1.0 additionalProperties: 0.0.1 constsAndDefaults: 0.1.3 - core: 3.55.26 + core: 3.55.27 deprecations: 2.81.2 downloadStreams: 0.1.1 examples: 2.81.9 @@ -46,8 +46,8 @@ trackedFiles: pristine_git_object: 3d1f9b105935ea1eded859513fe6b38b36bd9154 build.gradle: id: f07866736216 - last_write_checksum: sha1:3777e03abfdb7dd4bbcc0817770ca5b95cc2f8d4 - pristine_git_object: 3815c3c2e292f1dce484e2cd13537c30ca8d5e28 + last_write_checksum: sha1:d8da0281b581d806d9b623a03d690bca14ac140b + pristine_git_object: c5cbe897d1517fb85ebae18f860dc6bc2ee47a37 docs/models/components/ActionAuthType.md: id: 85f17dd1d9c7 last_write_checksum: sha1:e2e0e2b4617367b35aab4d1092d820c2b1856072 @@ -592,6 +592,10 @@ trackedFiles: id: f48640a2b92e last_write_checksum: sha1:50bf41f1e87fbb8f22e6b21fb13cd13231b65d83 pristine_git_object: 7f7a0c5c81e4397cb2a6722fe795beddb61d0d57 + docs/models/components/CreateWorkflowRequest.md: + id: 2f7b9751ee87 + last_write_checksum: sha1:8905e9bd939b310ffd1133225c28474ba0131c48 + pristine_git_object: 9f5ba1262f38a1863d8042637d6ac53cc3f00bfd docs/models/components/CurrentActiveUsers.md: id: 2ad4e5a05724 last_write_checksum: sha1:056073a3ab6641fe73c575c2126a1c4aa53084ae @@ -1390,8 +1394,8 @@ trackedFiles: pristine_git_object: a77fb307ccec626ed108b6fd2783c4a192b2d250 docs/models/components/GroupType.md: id: e527414e9f2b - last_write_checksum: sha1:be6ebc6fc34b0d0772b91c4a20dacf525e910f30 - pristine_git_object: 2cb4bd094e9e4c367a84efbcece6727a850f6c5d + last_write_checksum: sha1:52adaec5dfe8b9a9b50581e4c9c360802e5aac89 + pristine_git_object: 8b607f8095df714cefe60cdf1e6d52d01adb6f67 docs/models/components/HideBuiltInFacet.md: id: a49ccbc67d8e last_write_checksum: sha1:bdfee32ac5ecb4734039172cda501305ad9278f3 @@ -2524,6 +2528,14 @@ trackedFiles: id: b0564f4e0239 last_write_checksum: sha1:2174466825b5b23a9639536e91497adda6f34fdc pristine_git_object: f3110ff4316b7494ab46264b04d5ff57ede8b055 + docs/models/operations/CreateAgentRequest.md: + id: 2d553a0f150b + last_write_checksum: sha1:63f293b44c6bd1fd3db426e20b4d53dfbb2c2ca3 + pristine_git_object: e8b5e9160356854af045b20e985bbdf1f41d336b + docs/models/operations/CreateAgentResponse.md: + id: 391c23cd4f10 + last_write_checksum: sha1:3243aab5bd4b1c16e624e15037db6d9cd8bdb057 + pristine_git_object: 05fa443a6bec19b87f0d66823f06558ade195b6d docs/models/operations/CreateAndStreamRunResponse.md: id: 6b095cc4a9d3 last_write_checksum: sha1:8ded27214783aab6c0376ee63278f9fefd61094b @@ -3334,8 +3346,8 @@ trackedFiles: pristine_git_object: f3ecb5fda2b888721a48e50acb4e541bcc09a757 docs/sdks/agents/README.md: id: 5965d8232fd8 - last_write_checksum: sha1:c4ec2132a5b0d9a6e77fbdf32e36173943281114 - pristine_git_object: c47e91f53aaafff86b288f8640599bc338e14028 + last_write_checksum: sha1:87cc311cb445f843121fe08246d922af7a8bf6a6 + pristine_git_object: 1fe959f7fad70d6333fb86fc96e2319edea655c4 docs/sdks/announcements/README.md: id: 3d2e130a217c last_write_checksum: sha1:d518fe37c613bdef6f738b2e1ef52918bc782324 @@ -3474,8 +3486,8 @@ trackedFiles: pristine_git_object: 3decbce5bd40edbe278c1c5d2dbf585808e51d9a gradle.properties: id: 2afbb999f001 - last_write_checksum: sha1:46be99bbf76b75fe0807135250659205e6775716 - pristine_git_object: f6a8718adb619a358b954f720eb36ca1cad651e0 + last_write_checksum: sha1:bd3287b5990a48c2f3da46acc554222af8b3b9ee + pristine_git_object: 0b215eeb630619c5ad8ff02b6b69e1a44c04dce5 gradle/wrapper/gradle-wrapper.jar: id: ec27dae6e852 last_write_checksum: sha1:f725fb1467084142d74fd7cd8eab691ab3442611 @@ -3498,44 +3510,16 @@ trackedFiles: pristine_git_object: 7bc3d081e634d7b1a5963fba9d88a70f36238435 settings.gradle: id: 05efc8b16577 - last_write_checksum: sha1:5b9925ebcb7a7de1a29c744b4610002aa3718c0d - pristine_git_object: 0326ca672ac2094353a5b2566acd9bc5c1a4a897 - spring/glean-api-client-spring-boot-autoconfigure/build.gradle: - id: ebaf72a89df9 - last_write_checksum: sha1:5b1fceceabf7ff0a77de2a5f194684f9fcedf289 - pristine_git_object: 3bbefc4f1d8e13b2b439b1db0f87d60c90ac4273 - ? spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/ConditionalOnPropertyPrefix.java - : id: c17b99382f55 - last_write_checksum: sha1:259632357c39872eccdac0c535b79cba34ae4a82 - pristine_git_object: f18ce057dd1a4d7496475e4d3158cc44bd91f97a - ? spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/GleanApiClientAutoConfig.java - : id: dc219279f3d6 - last_write_checksum: sha1:e56cdded7ec031b330b0554d1468602628ae7880 - pristine_git_object: f9dfd60812fdf89e93f5b8e75b196ccad2ba2f90 - ? spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/GleanApiClientAutoConfigProperties.java - : id: 5111ca066791 - last_write_checksum: sha1:3570912b428b0fce42dc094898b98b0b6012a30a - pristine_git_object: ccfade089c2459702ade65e7570f1ef7755779df - ? spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/OnPropertyPrefixCondition.java - : id: "269180435615" - last_write_checksum: sha1:640d6066b79200fb274e0e75c28c3597ff15f9e3 - pristine_git_object: c5bf1eefe0976aa3bc878612de3b791ac7138d0c - ? spring/glean-api-client-spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports - : id: 1d31cd304c7e - last_write_checksum: sha1:a14bfccaa39986cddbe006470279d7e90535b64f - pristine_git_object: 5b50a32ff977e64ffb21740bc135176a8d621372 - spring/glean-api-client-spring-boot-starter/build.gradle: - id: 3d6db738c149 - last_write_checksum: sha1:aa7a39c8fc77900fb7ca55818ba6503e9a511b68 - pristine_git_object: 351259849677ed68dc011159a5fd06995d26151a + last_write_checksum: sha1:b6bfdcd318b0d36bec967f6941ae1fd1e5ea653c + pristine_git_object: 5228fb0c98cb42a2e9dabdb2255b0c1f60f72deb src/main/java/com/glean/api_client/glean_api_client/Activity.java: id: 56fcd6e483c1 last_write_checksum: sha1:848e2a80ac0d761c8b96e15fdf460b45d76ae370 pristine_git_object: df42bc238520dfa6a790833984bfc1e386b3510e src/main/java/com/glean/api_client/glean_api_client/Agents.java: id: 69615daff4b4 - last_write_checksum: sha1:f76c5b532fda8218cd9cc7d64949556bfe060753 - pristine_git_object: 42ff73f8c6b5d1888cc8c3a9478560269ff692d5 + last_write_checksum: sha1:fa174d355d792f253f0ffa8be4adaf49bd4b8b20 + pristine_git_object: bc56c524014ed94f38cad21669910c29be0b5e4a src/main/java/com/glean/api_client/glean_api_client/Announcements.java: id: 23fcf3ba5c75 last_write_checksum: sha1:41a393ad53e8dedc383c224a3b789e80f936b114 @@ -3550,8 +3534,8 @@ trackedFiles: pristine_git_object: c4b4a844fc24a20d724ee016bc00cfb0125c28f9 src/main/java/com/glean/api_client/glean_api_client/AsyncAgents.java: id: 5fb5adf2262c - last_write_checksum: sha1:e7c6f8a8a19f57844a65baed29457c52f16ae816 - pristine_git_object: dd04fd0e104d97d0125e6c3014a3c16539c28430 + last_write_checksum: sha1:c074c9ecd3150109944d143dad4c0d0d8e6b629c + pristine_git_object: fa11a40b96185612b46f5106028d3862821cd78d src/main/java/com/glean/api_client/glean_api_client/AsyncAnnouncements.java: id: a4630e10d992 last_write_checksum: sha1:7c3ded3cbef281f4de46835f65ca4348af14137c @@ -3778,8 +3762,8 @@ trackedFiles: pristine_git_object: 5706517df674b1759ffae3aa7188e507d598e462 src/main/java/com/glean/api_client/glean_api_client/Glean.java: id: ebe9053b14eb - last_write_checksum: sha1:972dea7c6c0a631ad8785a5f18a555c5fdeee87b - pristine_git_object: 7df143d9b39e0381b521a2bd51374402460cff7d + last_write_checksum: sha1:c9c3f12cb78819f1deb108d839076b94c1a624b4 + pristine_git_object: 6daa8699181d8cc44cfefbcf7c8b84675451c918 src/main/java/com/glean/api_client/glean_api_client/Governance.java: id: 2d4a3c95da6a last_write_checksum: sha1:0f382cfcb96689435a4b397b1105ff9641d98eac @@ -3838,8 +3822,8 @@ trackedFiles: pristine_git_object: ffae914775eb41ff311371f62504344a59d090fd src/main/java/com/glean/api_client/glean_api_client/SDKConfiguration.java: id: d5fcc61f5992 - last_write_checksum: sha1:742fb3b77d9c085432fd7a4a6c714a48e340d865 - pristine_git_object: 85a9705d1ee61b4b74045edf8a7bde90a196da4f + last_write_checksum: sha1:9b7b3a3cf88211d8cba6d5ee548a7a31cfcdfec6 + pristine_git_object: 313c97b22346cb7ae1a0a9b8539ee8c1222b14dd src/main/java/com/glean/api_client/glean_api_client/Search.java: id: f22d94b920b5 last_write_checksum: sha1:ac38d1ed47be207940dd6fb7e4c688dddccc6a8b @@ -4408,6 +4392,10 @@ trackedFiles: id: 50ede4f97a18 last_write_checksum: sha1:39dbfd5ca7e56d57c2217ee168a9f1dcdb6d5000 pristine_git_object: cd92ec8e614cf9b95fee675b5aace3e9fb934c76 + src/main/java/com/glean/api_client/glean_api_client/models/components/CreateWorkflowRequest.java: + id: 5787c28d8983 + last_write_checksum: sha1:a7eded022b04750c89ac87652f0a4ad653255756 + pristine_git_object: 1b1c289fc55e7966f76846dc3d7544815605e88f src/main/java/com/glean/api_client/glean_api_client/models/components/CurrentActiveUsers.java: id: 270d2a2bdf80 last_write_checksum: sha1:cf530d74648b55590453964714865916465f069c @@ -5206,8 +5194,8 @@ trackedFiles: pristine_git_object: d7cb67eda79c3263b460c3a90d735083a5ef118f src/main/java/com/glean/api_client/glean_api_client/models/components/GroupType.java: id: bc799be0dc57 - last_write_checksum: sha1:2fb53c8c5433d79deffb77674fa4a4d23c193651 - pristine_git_object: 3192586850eafa5466fbc00129456a74b7d75127 + last_write_checksum: sha1:3906f2c53423796bb06111e7690a2fd3814c0c6c + pristine_git_object: bb3a832de03562ccceffd405423afd9d6c43c2a2 src/main/java/com/glean/api_client/glean_api_client/models/components/HideBuiltInFacet.java: id: 6e2c851b0491 last_write_checksum: sha1:05032e0e1e2b4bebed932e1b142ea9714618da9e @@ -6328,6 +6316,10 @@ trackedFiles: id: 865504b1d554 last_write_checksum: sha1:33d63c0c540725e5564005c3d8abc121d9ba4d6a pristine_git_object: 885c6c62e437b980f651a1b43ac4d5d4d036a950 + src/main/java/com/glean/api_client/glean_api_client/models/operations//async/CreateAgentRequestBuilder.java: + id: c7498521cc37 + last_write_checksum: sha1:b0394e6c241ad2b3f9513b8a6deb3e7a460f604f + pristine_git_object: 7d2e9a9c666f7d24cfc4de447659e4cefc64bbe7 src/main/java/com/glean/api_client/glean_api_client/models/operations//async/CreateAndStreamRunRequestBuilder.java: id: 075f3b249c34 last_write_checksum: sha1:12a46ee4e7e62926fe4220227ea336c0d35fc37f @@ -6908,6 +6900,18 @@ trackedFiles: id: bd90925f5643 last_write_checksum: sha1:b15ddea9923c3fec55bffa058de9d2890dfbe75a pristine_git_object: 7667b3f47c3582a8ef4d7999c8a7b36ee807cbca + src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAgentRequest.java: + id: 177d8e375f2b + last_write_checksum: sha1:f52d7844473a90c5f38d67dcfc4e85b60ef5b84d + pristine_git_object: cc0d6fff07a7767c328aaf1219f3af6f1e5ade8c + src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAgentRequestBuilder.java: + id: 7b7da64e250d + last_write_checksum: sha1:d4ec0849fde23bc8c62f9ad61516058d02c579cf + pristine_git_object: 5b139437f8eb0d9b17874f89526513a28dd2d909 + src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAgentResponse.java: + id: 8d1ea0305afe + last_write_checksum: sha1:29ed287de75cc07f7e3fd964bc1b8f4742f81c12 + pristine_git_object: f8bb1d83d4c4cd975c8a3769faeab8778b173ea6 src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAndStreamRunRequestBuilder.java: id: db16c6796152 last_write_checksum: sha1:df6fa0966f9f5ea1a6f0edb7c1d2b21a24fb6853 @@ -8228,6 +8232,10 @@ trackedFiles: id: 1f27e2c6ccb4 last_write_checksum: sha1:849be46a6c8cdb6f6477055bdd15e686899ec930 pristine_git_object: 5528ffffea345e524a3c2068c6867f6757e93575 + src/main/java/com/glean/api_client/glean_api_client/models/operations/async/CreateAgentResponse.java: + id: 3d342a42df89 + last_write_checksum: sha1:916b79b1c93ebca3075284fd65bb2adb1d73314c + pristine_git_object: 91c283e2e56f90a08ce6d349015f854c4a4e81c6 src/main/java/com/glean/api_client/glean_api_client/models/operations/async/CreateAndStreamRunResponse.java: id: 98386214f4a5 last_write_checksum: sha1:4961b28bfe83e8711c27e3198c726da6a1bba858 @@ -8744,6 +8752,10 @@ trackedFiles: id: 2f3fcbc23100 last_write_checksum: sha1:9c97f5e3b1ad04d72019e57f509e0a75613577e5 pristine_git_object: 9532330c50ea43b0760de90d803d8b460d75a19a + src/main/java/com/glean/api_client/glean_api_client/operations/CreateAgent.java: + id: 7aa85409b860 + last_write_checksum: sha1:5b1b5fef7929931d73317233333b754414164e4a + pristine_git_object: 17a52b0363726c9b9d7020390c1f8da3b596fc28 src/main/java/com/glean/api_client/glean_api_client/operations/CreateAndStreamRun.java: id: b8ec40595118 last_write_checksum: sha1:19cd9fce7f5f76a964ebaa19d5266763da8f59e4 @@ -10412,6 +10424,13 @@ examples: application/json: {"status": "MISSING"} "400": application/json: {} + createAgent: + speakeasy-default-create-agent: + requestBody: + application/json: {} + responses: + "200": + application/json: {"workflow": {"author": {"name": "George Clooney", "obfuscatedId": "abc123"}, "lastDraftSavedBy": {"name": "George Clooney", "obfuscatedId": "abc123"}, "lastUpdatedBy": {"name": "George Clooney", "obfuscatedId": "abc123"}}} examplesVersion: 1.0.2 generatedTests: activity: "2025-06-09T18:03:44Z" @@ -10554,9 +10573,7 @@ generatedTests: get_/rest/api/v1/tools/list: "2025-06-09T18:03:44Z" post_/rest/api/v1/tools/call: "2025-06-09T18:03:44Z" listpolicies: "2025-06-09T18:03:44Z" -releaseNotes: | - ## Java SDK Changes: - * `glean.client.chat.create()`: `response.status[202]` **Added** (Breaking ⚠️) +releaseNotes: "## Java SDK Changes:\n* `glean.agents.createAgent()`: **Added**\n* `glean.client.announcements.create()`: \n * `request.createAnnouncementRequest.body.structuredList[].document.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added**\n * `response.body.structuredList[].document.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.announcements.update()`: \n * `request.updateAnnouncementRequest.body.structuredList[].document.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added**\n * `response.body.structuredList[].document.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.answers.create()`: \n * `request.createAnswerRequest.data.addedRoles[].group.type.enum(collectionAudience)` **Added**\n * `response.addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.answers.update()`: \n * `request.editAnswerRequest.addedRoles[].group.type.enum(collectionAudience)` **Added**\n * `response.addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.answers.retrieve()`: `response.answerResult.answer.addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.answers.list()`: `response.answerResults[].answer.addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.chat.create()`: \n * `request.chatRequest.messages[].citations[].sourceDocument.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added**\n * `response.messages[].citations[].sourceDocument.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.chat.retrieve()`: `response.chatResult.chat.createdBy.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.chat.list()`: `response.chatResults[].chat.createdBy.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.chat.createStream()`: \n * `request.chatRequest.messages[].citations[].sourceDocument.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.collections.addItems()`: `response.collection.addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.collections.create()`: \n * `request.createCollectionRequest.addedRoles[].group.type.enum(collectionAudience)` **Added**\n * `response.union(class (0)).collection.addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.collections.deleteItem()`: `response.collection.addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.collections.update()`: \n * `request.editCollectionRequest.addedRoles[].group.type.enum(collectionAudience)` **Added**\n * `response.addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.collections.updateItem()`: `response.collection.addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.collections.retrieve()`: `response.collection.addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.collections.list()`: `response.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.documents.retrieve()`: `response.documents.Map.union(Document).metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.documents.retrieveByFacets()`: `response.documents[].metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.insights.retrieve()`: `response.gleanAssist.activityInsights[].user.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.messages.retrieve()`: `response.searchResponse.results[].structuredResults[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.pins.update()`: `response.attribution.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.pins.retrieve()`: `response.pin.attribution.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.pins.list()`: `response.pins[].attribution.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.pins.create()`: `response.attribution.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.search.queryAsAdmin()`: \n * `request.searchRequest.sourceDocument.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added**\n * `response.results[].structuredResults[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.search.autocomplete()`: `response.results[].document.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.search.retrieveFeed()`: `response.results[].primaryEntry.createdBy.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.search.recommendations()`: \n * `request.recommendationsRequest.sourceDocument.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added**\n * `response.results[].structuredResults[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.search.query()`: \n * `request.searchRequest.sourceDocument.metadata.author.relatedDocuments[].results[].structuredResults[].customEntity.roles[].group.type.enum(collectionAudience)` **Added**\n * `response.results[].structuredResults[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.entities.list()`: `response.results[].relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.entities.readPeople()`: `response.results[].relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.shortcuts.create()`: \n * `request.createShortcutRequest.data.addedRoles[].group.type.enum(collectionAudience)` **Added**\n * `response.shortcut.addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.shortcuts.retrieve()`: `response.shortcut.addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.shortcuts.list()`: `response.shortcuts[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.shortcuts.update()`: \n * `request.updateShortcutRequest.addedRoles[].group.type.enum(collectionAudience)` **Added**\n * `response.shortcut.addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.verification.addReminder()`: `response.metadata.lastVerifier.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.verification.list()`: `response.documents[].metadata.lastVerifier.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n* `glean.client.verification.verify()`: `response.metadata.lastVerifier.relatedDocuments[].querySuggestion.ranges[].document.metadata.collections[].addedRoles[].group.type.enum(collectionAudience)` **Added**\n" generatedFiles: - .gitattributes - USAGE.md diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index e1890819..f0225fe1 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -30,7 +30,7 @@ generation: generateNewTests: false skipResponseBodyAssertions: false java: - version: 0.13.1 + version: 0.13.2 additionalDependencies: [] additionalPlugins: [] artifactID: glean-api-client diff --git a/.speakeasy/glean-merged-spec.yaml b/.speakeasy/glean-merged-spec.yaml index 78ed030c..66b2329f 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: 8041c7f73ed7b1a8bb52c21b4736355b3d3ac705 + x-source-commit-sha: e84874c823e13189cd25e4dd8f7ef14ab1e10d1f 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: bcfb45a263878a9d08bcb4117a44e970b498dc10 + x-open-api-commit-sha: d497795166198bd2af608417781152c0e227e4eb x-speakeasy-name: 'Glean API' servers: - url: https://{instance}-be.glean.com @@ -910,6 +910,40 @@ paths: description: Internal server error. security: - APIToken: [] + /rest/api/v1/agents: + post: + tags: + - Agents + summary: Create an agent + description: Create an agent. + operationId: createAgent + x-visibility: Preview + parameters: + - $ref: "#/components/parameters/locale" + - $ref: "#/components/parameters/timezoneOffset" + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateWorkflowRequest" + responses: + "200": + description: Success + content: + application/json: + schema: + $ref: "#/components/schemas/CreateWorkflowResponse" + "400": + description: Bad request + "401": + description: Not Authorized + "403": + description: Forbidden + "500": + description: Internal server error + security: + - APIToken: [] /rest/api/v1/agents/{agent_id}: get: tags: @@ -6019,6 +6053,8 @@ components: GroupType: type: string description: The type of user group + x-enumDescriptions: + COLLECTION_AUDIENCE: Refers to any viewers of the Collection. enum: - DEPARTMENT - ALL @@ -6028,6 +6064,9 @@ components: - LOCATION - REGION - EXTERNAL_GROUP + - COLLECTION_AUDIENCE + x-speakeasy-enum-descriptions: + COLLECTION_AUDIENCE: Refers to any viewers of the Collection. Group: required: - type @@ -8990,6 +9029,80 @@ components: items: type: string description: IDs of files to delete. + WorkflowDraftableProperties: + properties: + name: + type: string + description: The name of the workflow. + WorkflowMutableProperties: + type: object + allOf: + - $ref: "#/components/schemas/WorkflowDraftableProperties" + - type: object + CreateWorkflowRequest: + allOf: + - $ref: "#/components/schemas/WorkflowMutableProperties" + - type: object + properties: + transient: + type: boolean + description: Used to create a transient workflow. + parentWorkflowId: + type: string + description: id of the parent workflow for transient workflows + WorkflowMetadata: + allOf: + - type: object + properties: + author: + $ref: "#/components/schemas/Person" + createTimestamp: + type: integer + description: Server Unix timestamp of the creation time. + lastUpdateTimestamp: + type: integer + description: Server Unix timestamp of the last update time. + lastDraftSavedAt: + type: integer + description: Server Unix timestamp of the last time the draft was saved. + lastDraftSavedBy: + description: The person who last saved the draft. + $ref: "#/components/schemas/Person" + lastDraftGitAuthorId: + type: string + description: ID of the VCS user (e.g. GitHub username) who last saved the draft. Set only by the draft save path via the external Git integration API. + lastUpdatedBy: + $ref: "#/components/schemas/Person" + AttributionProperties: {} + Workflow: + allOf: + - $ref: "#/components/schemas/PermissionedObject" + - $ref: "#/components/schemas/WorkflowMutableProperties" + - $ref: "#/components/schemas/WorkflowMetadata" + - $ref: "#/components/schemas/AttributionProperties" + - type: object + properties: + id: + type: string + description: The ID of the workflow. + verified: + type: boolean + readOnly: true + description: When present, indicates this workflow is admin-verified. Set via the dedicated admin settings endpoint, not by regular edits. + showOrganizationAsAuthor: + type: boolean + readOnly: true + description: When true, displays organization name instead of author name in agent card. Set via the dedicated admin settings endpoint, not by regular edits. + WorkflowResult: + type: object + required: + - workflow + properties: + workflow: + $ref: "#/components/schemas/Workflow" + CreateWorkflowResponse: + allOf: + - $ref: "#/components/schemas/WorkflowResult" Agent: title: Agent type: object @@ -9042,16 +9155,6 @@ components: message: type: string description: Client-facing error message describing what went wrong - WorkflowDraftableProperties: - properties: - name: - type: string - description: The name of the workflow. - WorkflowMutableProperties: - type: object - allOf: - - $ref: "#/components/schemas/WorkflowDraftableProperties" - - type: object EditWorkflowRequest: allOf: - $ref: "#/components/schemas/WorkflowMutableProperties" @@ -11310,7 +11413,6 @@ components: description: A list of removed user roles for the Workflow. items: $ref: "#/components/schemas/UserRoleSpecification" - AttributionProperties: {} PromptTemplate: allOf: - $ref: "#/components/schemas/PromptTemplateMutableProperties" @@ -11386,55 +11488,6 @@ components: runCount: $ref: "#/components/schemas/CountInfo" description: This tracks how many times this prompt template was run. If user runs a prompt template after modifying the original one, it still counts as a run for the original template. - WorkflowMetadata: - allOf: - - type: object - properties: - author: - $ref: "#/components/schemas/Person" - createTimestamp: - type: integer - description: Server Unix timestamp of the creation time. - lastUpdateTimestamp: - type: integer - description: Server Unix timestamp of the last update time. - lastDraftSavedAt: - type: integer - description: Server Unix timestamp of the last time the draft was saved. - lastDraftSavedBy: - description: The person who last saved the draft. - $ref: "#/components/schemas/Person" - lastDraftGitAuthorId: - type: string - description: ID of the VCS user (e.g. GitHub username) who last saved the draft. Set only by the draft save path via the external Git integration API. - lastUpdatedBy: - $ref: "#/components/schemas/Person" - Workflow: - allOf: - - $ref: "#/components/schemas/PermissionedObject" - - $ref: "#/components/schemas/WorkflowMutableProperties" - - $ref: "#/components/schemas/WorkflowMetadata" - - $ref: "#/components/schemas/AttributionProperties" - - type: object - properties: - id: - type: string - description: The ID of the workflow. - verified: - type: boolean - readOnly: true - description: When present, indicates this workflow is admin-verified. Set via the dedicated admin settings endpoint, not by regular edits. - showOrganizationAsAuthor: - type: boolean - readOnly: true - description: When true, displays organization name instead of author name in agent card. Set via the dedicated admin settings endpoint, not by regular edits. - WorkflowResult: - type: object - required: - - workflow - properties: - workflow: - $ref: "#/components/schemas/Workflow" UserActivity: properties: actor: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 8e73db0c..1d70b98b 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,9 +1,9 @@ -speakeasyVersion: 1.771.0 +speakeasyVersion: 1.776.0 sources: Glean API: sourceNamespace: glean-api-specs - sourceRevisionDigest: sha256:847b1f126f78c86bb63c1c27b6053ba6a9afe8855aab3e82d1f7f71501a5e840 - sourceBlobDigest: sha256:b685acc261c79f1c7579b236eaff1ea63982eb1f4be4c318bd6c9a24998c6132 + sourceRevisionDigest: sha256:3def0dc0b004295449e619031ef8c25dec022e656ea557da7d1becbfdcc4ac2a + sourceBlobDigest: sha256:0c77b5cc4099e7543e10b0b009fc99e1973ee18ad9d1f5cc495f05bc281a19a8 tags: - latest Glean-OAS: @@ -17,10 +17,10 @@ targets: glean: source: Glean API sourceNamespace: glean-api-specs - sourceRevisionDigest: sha256:847b1f126f78c86bb63c1c27b6053ba6a9afe8855aab3e82d1f7f71501a5e840 - sourceBlobDigest: sha256:b685acc261c79f1c7579b236eaff1ea63982eb1f4be4c318bd6c9a24998c6132 + sourceRevisionDigest: sha256:3def0dc0b004295449e619031ef8c25dec022e656ea557da7d1becbfdcc4ac2a + sourceBlobDigest: sha256:0c77b5cc4099e7543e10b0b009fc99e1973ee18ad9d1f5cc495f05bc281a19a8 codeSamplesNamespace: glean-api-specs-java-code-samples - codeSamplesRevisionDigest: sha256:23fd3d90cd31a167fd68d0b445256a33d9ed6f54ac66a8602d421692ecf9aa78 + codeSamplesRevisionDigest: sha256:e7986a33af64c6ac98803edc669175023f6a308f7135a730ef2e63c2256d7434 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 9c671da9..c02f261b 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ The samples below show how a published SDK artifact is used: Gradle: ```groovy -implementation 'com.glean.api-client:glean-api-client:0.13.1' +implementation 'com.glean.api-client:glean-api-client:0.13.2' ``` Maven: @@ -75,7 +75,7 @@ Maven: com.glean.api-client glean-api-client - 0.13.1 + 0.13.2 ``` @@ -410,6 +410,7 @@ For more information on obtaining the appropriate token type, please contact you ### [Agents](docs/sdks/agents/README.md) +* [createAgent](docs/sdks/agents/README.md#createagent) - Create an agent * [editAgent](docs/sdks/agents/README.md#editagent) - Edit an agent ### [Authentication](docs/sdks/authentication/README.md) @@ -745,10 +746,10 @@ public class Application { many more subclasses in the JDK platform). **Inherit from [`GleanError`](./src/main/java/models/errors/GleanError.java)**: -* [`com.glean.api_client.glean_api_client.models.errors.ErrorResponse`](./src/main/java/models/errors/com.glean.api_client.glean_api_client.models.errors.ErrorResponse.java): Error response returned for failed requests. Applicable to 9 of 129 methods.* -* [`com.glean.api_client.glean_api_client.models.errors.ErrorInfoResponse`](./src/main/java/models/errors/com.glean.api_client.glean_api_client.models.errors.ErrorInfoResponse.java): Error response for custom metadata operations. Applicable to 5 of 129 methods.* -* [`com.glean.api_client.glean_api_client.models.errors.CollectionError`](./src/main/java/models/errors/com.glean.api_client.glean_api_client.models.errors.CollectionError.java): Semantic error. Status code `422`. Applicable to 3 of 129 methods.* -* [`com.glean.api_client.glean_api_client.models.errors.GleanDataError`](./src/main/java/models/errors/com.glean.api_client.glean_api_client.models.errors.GleanDataError.java): Forbidden. Applicable to 2 of 129 methods.* +* [`com.glean.api_client.glean_api_client.models.errors.ErrorResponse`](./src/main/java/models/errors/com.glean.api_client.glean_api_client.models.errors.ErrorResponse.java): Error response returned for failed requests. Applicable to 9 of 130 methods.* +* [`com.glean.api_client.glean_api_client.models.errors.ErrorInfoResponse`](./src/main/java/models/errors/com.glean.api_client.glean_api_client.models.errors.ErrorInfoResponse.java): Error response for custom metadata operations. Applicable to 5 of 130 methods.* +* [`com.glean.api_client.glean_api_client.models.errors.CollectionError`](./src/main/java/models/errors/com.glean.api_client.glean_api_client.models.errors.CollectionError.java): Semantic error. Status code `422`. Applicable to 3 of 130 methods.* +* [`com.glean.api_client.glean_api_client.models.errors.GleanDataError`](./src/main/java/models/errors/com.glean.api_client.glean_api_client.models.errors.GleanDataError.java): Forbidden. Applicable to 2 of 130 methods.* diff --git a/RELEASES.md b/RELEASES.md index 1a5841db..a9a9b880 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -748,4 +748,14 @@ Based on: ### Generated - [java v0.13.1] . ### Releases -- [Maven Central v0.13.1] https://central.sonatype.com/artifact/com.glean.api-client/glean-api-client/0.13.1 - . \ No newline at end of file +- [Maven Central v0.13.1] https://central.sonatype.com/artifact/com.glean.api-client/glean-api-client/0.13.1 - . + +## 2026-06-11 04:43:13 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.776.0 (2.900.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [java v0.13.2] . +### Releases +- [Maven Central v0.13.2] https://central.sonatype.com/artifact/com.glean.api-client/glean-api-client/0.13.2 - . \ No newline at end of file diff --git a/build.gradle b/build.gradle index 3815c3c2..c5cbe897 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,6 @@ plugins { id 'signing' // V2 publishing plugin (Sonatype Central Portal) id 'cl.franciscosolis.sonatype-central-upload' version '1.0.3' - id "io.spring.dependency-management" version "1.1.6" apply false } compileJava.options.encoding = "UTF-8" @@ -85,47 +84,6 @@ dependencies { api 'org.reactivestreams:reactive-streams:1.0.4' } -ext { - springBootVersion = '2.7.18' -} - -subprojects { - if (name in [ - 'glean-api-client-spring-boot-autoconfigure', - 'glean-api-client-spring-boot-starter' - ]) { - // Ensure subprojects use the same group and version as root project - group = rootProject.group - version = rootProject.version - - apply { - plugin "java-library" - plugin "io.spring.dependency-management" - plugin "maven-publish" - plugin "signing" - plugin "cl.franciscosolis.sonatype-central-upload" - } - dependencyManagement { - imports { - mavenBom "org.springframework.boot:spring-boot-dependencies:${rootProject.springBootVersion}" - } - } - repositories { - mavenCentral() - } - java { - withSourcesJar() - withJavadocJar() - } - tasks.withType(JavaCompile).configureEach { - options.release = 11 - } - - // Apply publishing configuration to all subprojects - they'll check for publishingConfig internally - apply from: rootProject.file('publishing.gradle') - } -} - ext { publishingConfig = [ groupId: group, diff --git a/docs/models/components/CreateWorkflowRequest.md b/docs/models/components/CreateWorkflowRequest.md new file mode 100644 index 00000000..9f5ba126 --- /dev/null +++ b/docs/models/components/CreateWorkflowRequest.md @@ -0,0 +1,10 @@ +# CreateWorkflowRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | +| `name` | *Optional\* | :heavy_minus_sign: | The name of the workflow. | +| `transient_` | *Optional\* | :heavy_minus_sign: | Used to create a transient workflow. | +| `parentWorkflowId` | *Optional\* | :heavy_minus_sign: | id of the parent workflow for transient workflows | \ No newline at end of file diff --git a/docs/models/components/GroupType.md b/docs/models/components/GroupType.md index 2cb4bd09..8b607f80 100644 --- a/docs/models/components/GroupType.md +++ b/docs/models/components/GroupType.md @@ -16,13 +16,14 @@ GroupType custom = GroupType.of("custom_value"); ## Values -| Name | Value | -| ---------------- | ---------------- | -| `DEPARTMENT` | DEPARTMENT | -| `ALL` | ALL | -| `TEAM` | TEAM | -| `JOB_TITLE` | JOB_TITLE | -| `ROLE_TYPE` | ROLE_TYPE | -| `LOCATION` | LOCATION | -| `REGION` | REGION | -| `EXTERNAL_GROUP` | EXTERNAL_GROUP | \ No newline at end of file +| Name | Value | +| --------------------- | --------------------- | +| `DEPARTMENT` | DEPARTMENT | +| `ALL` | ALL | +| `TEAM` | TEAM | +| `JOB_TITLE` | JOB_TITLE | +| `ROLE_TYPE` | ROLE_TYPE | +| `LOCATION` | LOCATION | +| `REGION` | REGION | +| `EXTERNAL_GROUP` | EXTERNAL_GROUP | +| `COLLECTION_AUDIENCE` | COLLECTION_AUDIENCE | \ No newline at end of file diff --git a/docs/models/operations/CreateAgentRequest.md b/docs/models/operations/CreateAgentRequest.md new file mode 100644 index 00000000..e8b5e916 --- /dev/null +++ b/docs/models/operations/CreateAgentRequest.md @@ -0,0 +1,10 @@ +# CreateAgentRequest + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `locale` | *Optional\* | :heavy_minus_sign: | The client's preferred locale in rfc5646 format (e.g. `en`, `ja`, `pt-BR`). If omitted, the `Accept-Language` will be used. If not present or not supported, defaults to the closest match or `en`. | +| `timezoneOffset` | *Optional\* | :heavy_minus_sign: | The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC. | +| `createWorkflowRequest` | [CreateWorkflowRequest](../../models/components/CreateWorkflowRequest.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/CreateAgentResponse.md b/docs/models/operations/CreateAgentResponse.md new file mode 100644 index 00000000..05fa443a --- /dev/null +++ b/docs/models/operations/CreateAgentResponse.md @@ -0,0 +1,11 @@ +# CreateAgentResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `workflowResult` | [Optional\](../../models/components/WorkflowResult.md) | :heavy_minus_sign: | Success | \ No newline at end of file diff --git a/docs/sdks/agents/README.md b/docs/sdks/agents/README.md index c47e91f5..1fe959f7 100644 --- a/docs/sdks/agents/README.md +++ b/docs/sdks/agents/README.md @@ -4,8 +4,62 @@ ### Available Operations +* [createAgent](#createagent) - Create an agent * [editAgent](#editagent) - Edit an agent +## createAgent + +Create an agent. + +### Example Usage + + +```java +package hello.world; + +import com.glean.api_client.glean_api_client.Glean; +import com.glean.api_client.glean_api_client.models.components.CreateWorkflowRequest; +import com.glean.api_client.glean_api_client.models.operations.CreateAgentResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Glean sdk = Glean.builder() + .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", "")) + .build(); + + CreateAgentResponse res = sdk.agents().createAgent() + .createWorkflowRequest(CreateWorkflowRequest.builder() + .build()) + .call(); + + if (res.workflowResult().isPresent()) { + System.out.println(res.workflowResult().get()); + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `locale` | *Optional\* | :heavy_minus_sign: | The client's preferred locale in rfc5646 format (e.g. `en`, `ja`, `pt-BR`). If omitted, the `Accept-Language` will be used. If not present or not supported, defaults to the closest match or `en`. | +| `timezoneOffset` | *Optional\* | :heavy_minus_sign: | The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC. | +| `createWorkflowRequest` | [CreateWorkflowRequest](../../models/components/CreateWorkflowRequest.md) | :heavy_check_mark: | N/A | + +### Response + +**[CreateAgentResponse](../../models/operations/CreateAgentResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/APIException | 4XX, 5XX | \*/\* | + ## editAgent Creates a draft or publishes an [agent](https://developers.glean.com/agents/agents-api). Use `isDraft=true` to save a draft, or `isDraft=false` (or omit) to publish immediately. Only draft and publish modes are supported. diff --git a/gradle.properties b/gradle.properties index f6a8718a..0b215eeb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ groupId=com.glean.api-client artifactId=glean-api-client -version=0.13.1 +version=0.13.2 org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g diff --git a/settings.gradle b/settings.gradle index 0326ca67..5228fb0c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -9,12 +9,6 @@ rootProject.name = 'glean-api-client' -include 'glean-api-client-spring-boot-autoconfigure' -include 'glean-api-client-spring-boot-starter' - -project(':glean-api-client-spring-boot-autoconfigure').projectDir = file('spring/glean-api-client-spring-boot-autoconfigure') -project(':glean-api-client-spring-boot-starter').projectDir = file('spring/glean-api-client-spring-boot-starter') - // Apply additional settings if the file exists if (file('settings-extra.gradle').exists()) { apply from: 'settings-extra.gradle' diff --git a/spring/glean-api-client-spring-boot-autoconfigure/build.gradle b/spring/glean-api-client-spring-boot-autoconfigure/build.gradle deleted file mode 100644 index 3bbefc4f..00000000 --- a/spring/glean-api-client-spring-boot-autoconfigure/build.gradle +++ /dev/null @@ -1,35 +0,0 @@ -description = 'glean-api-client Spring Boot Auto Configuration' - -// Publishing configuration overrides -ext { - publishingConfig = [ - groupId: rootProject.group, - artifactId: 'glean-api-client-spring-boot-autoconfigure', - version: rootProject.version, - name: 'Glean Java SDK - Spring Boot Auto Configuration', - description: 'Spring Boot auto-configuration for the Glean Java SDK.', - ] -} - -dependencies { - api project(':') - implementation 'org.springframework.boot:spring-boot-autoconfigure' - annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' - testImplementation 'org.springframework.boot:spring-boot-starter-test' - testRuntimeOnly 'org.junit.platform:junit-platform-launcher' -} - -test { - useJUnitPlatform() -} - -jar { - dependsOn 'generatePomFileForMavenPublication' - archiveBaseName = 'glean-api-client-spring-boot-autoconfigure' - into("META-INF/maven/com.glean.api-client/glean-api-client-spring-boot-autoconfigure") { - from(layout.buildDirectory.file("pom.xml")) { - // Only include if it exists to avoid build ordering issues - duplicatesStrategy = DuplicatesStrategy.INCLUDE - } - } -} \ No newline at end of file diff --git a/spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/ConditionalOnPropertyPrefix.java b/spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/ConditionalOnPropertyPrefix.java deleted file mode 100644 index f18ce057..00000000 --- a/spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/ConditionalOnPropertyPrefix.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - * @generated-id: c17b99382f55 - */ -package com.glean.api_client.glean_api_client; - -import org.springframework.context.annotation.Conditional; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Conditional annotation that matches when any properties exist under the specified prefix. - * This is useful for conditionally creating beans only when configuration properties - * are present under a specific prefix. - * - *

Example usage: - *

- * @Bean
- * @ConditionalOnPropertyPrefix(prefix = "myapp.security")
- * public SecuritySource securitySource() {
- *     // This bean will only be created if properties like myapp.security.* exist
- * }
- * 
- */ -@Target({ ElementType.TYPE, ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) -@Documented -@Conditional(OnPropertyPrefixCondition.class) -public @interface ConditionalOnPropertyPrefix { - - /** - * The property prefix to check for. Properties starting with this prefix - * (followed by a dot) will be considered when determining if the condition matches. - * - * @return the property prefix - */ - String prefix(); -} \ No newline at end of file diff --git a/spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/GleanApiClientAutoConfig.java b/spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/GleanApiClientAutoConfig.java deleted file mode 100644 index f9dfd608..00000000 --- a/spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/GleanApiClientAutoConfig.java +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - * @generated-id: dc219279f3d6 - */ -package com.glean.api_client.glean_api_client; - -import org.springframework.boot.autoconfigure.AutoConfiguration; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import java.util.concurrent.TimeUnit; - -import com.glean.api_client.glean_api_client.utils.BackoffStrategy; -import com.glean.api_client.glean_api_client.utils.HTTPClient; -import com.glean.api_client.glean_api_client.utils.RetryConfig; -import com.glean.api_client.glean_api_client.utils.SpeakeasyHTTPClient; -import java.lang.IllegalStateException; -import java.lang.String; -import java.lang.System; -import java.util.Optional; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.function.Consumer; - - -/** - * Spring Boot Auto Configuration for glean-api-client SDK - * This configuration class automatically configures the glean-api-client SDK - * when Spring Boot detects it on the classpath. - */ -@AutoConfiguration -@ConditionalOnClass(Glean.class) -@EnableConfigurationProperties(GleanApiClientAutoConfigProperties.class) -public class GleanApiClientAutoConfig { - - /** - * Constructor. - */ - public GleanApiClientAutoConfig() { - } - - /** - * Creates a RetryConfig bean from properties if retry is enabled. - * - * @param properties the configuration properties - * @return A configured RetryConfig instance - */ - @Bean - @ConditionalOnMissingBean - @ConditionalOnProperty(prefix = "gleanapiclient.retry-config", name = "strategy") - public RetryConfig retryConfig(GleanApiClientAutoConfigProperties properties) { - GleanApiClientAutoConfigProperties.RetryConfig retryProps = properties.getRetryConfig(); - - if (RetryConfig.Strategy.BACKOFF.equals(retryProps.getStrategy())) { - GleanApiClientAutoConfigProperties.RetryConfig.Backoff backoff = retryProps.getBackoff(); - return RetryConfig.builder() - .backoff( - BackoffStrategy.builder() - .initialInterval(backoff.getInitialInterval().toMillis(), TimeUnit.MILLISECONDS) - .maxInterval(backoff.getMaxInterval().toMillis(), TimeUnit.MILLISECONDS) - .maxElapsedTime(backoff.getMaxElapsedTime().toMillis(), TimeUnit.MILLISECONDS) - .baseFactor(backoff.getBaseFactor()) - .jitterFactor(backoff.getJitterFactor()) - .retryConnectError(backoff.isRetryConnectError()) - .retryReadTimeoutError(backoff.isRetryReadTimeoutError()) - .build() - ) - .build(); - } - - // Default retry config for other strategies - return RetryConfig.builder().build(); - } - /** - * Creates a {@code Consumer} bean for HTTP debug logging if none exists. - * This logger is used by the SpeakeasyHTTPClient for debug output when debug logging is enabled. - * By default, it logs to {@code System.out}, but can be customized by providing your own {@code Consumer} bean. - * - * @return A {@code Consumer} that logs messages to {@code System.out} - */ - @Bean - @ConditionalOnMissingBean - public Consumer httpLogger() { - return System.out::println; - } - /** - * Creates an HTTPClient bean if none exists. - * - * @param properties the configuration properties - * @param httpLogger the logger for HTTP debug output - * @return A configured HTTPClient instance - */ - @Bean - @ConditionalOnMissingBean - public HTTPClient httpClient(GleanApiClientAutoConfigProperties properties, Consumer httpLogger) { - GleanApiClientAutoConfigProperties.HttpClient httpClientProps = properties.getHttpClient(); - - // Configure the static logger - SpeakeasyHTTPClient.setLogger(httpLogger); - - if (httpClientProps != null) { - // Configure debug logging - SpeakeasyHTTPClient.setDebugLogging(httpClientProps.isEnableDebugLogging()); - - // Configure redacted headers - if (httpClientProps.getRedactedHeaders() != null && !httpClientProps.getRedactedHeaders().isEmpty()) { - SpeakeasyHTTPClient.setRedactedHeaders(httpClientProps.getRedactedHeaders()); - } - } - - return new SpeakeasyHTTPClient(); - } - /** - * Creates a SecuritySource bean if none exists and security properties are configured. - * - * @param properties the configuration properties - * @return A configured SecuritySource instance - */ - @Bean - @ConditionalOnMissingBean - @ConditionalOnPropertyPrefix(prefix = "gleanapiclient.security") - public SecuritySource securitySource(GleanApiClientAutoConfigProperties properties) {GleanApiClientAutoConfigProperties.Security securityProps = properties.getSecurity(); - com.glean.api_client.glean_api_client.models.components.Security.Builder securityBuilder = com.glean.api_client.glean_api_client.models.components.Security.builder(); - boolean hasAnySecurityConfiguration = false; - // Build APIToken security from direct properties (primitive value) - if (securityProps.getAPIToken() != null) { - securityBuilder.apiToken(securityProps.getAPIToken()); - hasAnySecurityConfiguration = true; - } - - if (!hasAnySecurityConfiguration) { - throw new IllegalStateException("Security configuration is present but no security options are configured. " + - "Please configure at least one security option in your application properties."); - } - - return SecuritySource.of(securityBuilder.build()); - } - - /** - * Creates the SDKConfiguration bean as the single source of truth for all SDK configuration. - * - * @param properties the configuration properties - * @param httpClient the HTTP client bean - * @param hooks the hooks bean - * @param asyncHooks the async hooks bean - * @param securitySource the security source bean (optional) - * @param retryConfig the retry config bean (optional) - * @return A configured SDKConfiguration instance - */ - @Bean - @ConditionalOnMissingBean - public SDKConfiguration sdkConfiguration( - GleanApiClientAutoConfigProperties properties, - HTTPClient httpClient, - com.glean.api_client.glean_api_client.utils.Hooks hooks, - com.glean.api_client.glean_api_client.utils.AsyncHooks asyncHooks, - SecuritySource securitySource, - Optional retryConfig) { - - SDKConfiguration sdkConfiguration = new SDKConfiguration(); - - sdkConfiguration.setClient(httpClient); - - sdkConfiguration.setHooks(hooks); - sdkConfiguration.setAsyncHooks(asyncHooks); - sdkConfiguration.setSecuritySource(securitySource); - - if (properties.getServerUrl() != null) { - sdkConfiguration.setServerUrl(properties.getServerUrl()); - } - sdkConfiguration.setServerIdx(properties.getServerIdx()); - - sdkConfiguration.setRetryConfig(retryConfig); - - return sdkConfiguration; - } - - /** - * Creates the main SDK bean using the configured SDKConfiguration. - * - * @param sdkConfiguration the configured SDKConfiguration bean - * @return A configured Glean instance - */ - @Bean - @ConditionalOnMissingBean - public Glean glean(SDKConfiguration sdkConfiguration) { - return new Glean(sdkConfiguration); - } - - /** - * Creates an AsyncHooks bean if none exists. - * - * @return A configured AsyncHooks instance - */ - @Bean - @ConditionalOnMissingBean - public com.glean.api_client.glean_api_client.utils.AsyncHooks asyncHooks() { - return new com.glean.api_client.glean_api_client.utils.AsyncHooks(); - } - - /** - * Creates a ScheduledExecutorService for async retry operations if none exists. - * - * @return A configured ScheduledExecutorService instance - */ - @Bean - @ConditionalOnMissingBean - public ScheduledExecutorService retryScheduler() { - return Executors.newSingleThreadScheduledExecutor(); - } - - /** - * Creates a Hooks configuration bean if none exists. - * - * @return A configured Hooks instance - */ - @Bean - @ConditionalOnMissingBean - public com.glean.api_client.glean_api_client.utils.Hooks hooks() { - return new com.glean.api_client.glean_api_client.utils.Hooks(); - } - /** - * Creates a Client sub-SDK bean if none exists. - * - * @param glean the main SDK instance - * @return A configured Client instance - */ - @Bean - @ConditionalOnMissingBean - public Client client(Glean glean) { - return glean.client(); - } - /** - * Creates a Authentication sub-SDK bean if none exists. - * - * @param glean the main SDK instance - * @return A configured Authentication instance - */ - @Bean - @ConditionalOnMissingBean - public Authentication authentication(Glean glean) { - return glean.authentication(); - } - /** - * Creates a Chat sub-SDK bean if none exists. - * - * @param glean the main SDK instance - * @return A configured Chat instance - */ - @Bean - @ConditionalOnMissingBean - public Chat chat(Glean glean) { - return glean.chat(); - } - /** - * Creates a Agents sub-SDK bean if none exists. - * - * @param glean the main SDK instance - * @return A configured Agents instance - */ - @Bean - @ConditionalOnMissingBean - public Agents agents(Glean glean) { - return glean.agents(); - } - /** - * Creates a Entities sub-SDK bean if none exists. - * - * @param glean the main SDK instance - * @return A configured Entities instance - */ - @Bean - @ConditionalOnMissingBean - public Entities entities(Glean glean) { - return glean.entities(); - } - /** - * Creates a Tools sub-SDK bean if none exists. - * - * @param glean the main SDK instance - * @return A configured Tools instance - */ - @Bean - @ConditionalOnMissingBean - public Tools tools(Glean glean) { - return glean.tools(); - } - /** - * Creates a Indexing sub-SDK bean if none exists. - * - * @param glean the main SDK instance - * @return A configured Indexing instance - */ - @Bean - @ConditionalOnMissingBean - public Indexing indexing(Glean glean) { - return glean.indexing(); - } - /** - * Creates a Troubleshooting sub-SDK bean if none exists. - * - * @param glean the main SDK instance - * @return A configured Troubleshooting instance - */ - @Bean - @ConditionalOnMissingBean - public Troubleshooting troubleshooting(Glean glean) { - return glean.troubleshooting(); - } - /** - * Creates a Governance sub-SDK bean if none exists. - * - * @param glean the main SDK instance - * @return A configured Governance instance - */ - @Bean - @ConditionalOnMissingBean - public Governance governance(Glean glean) { - return glean.governance(); - } - /** - * Creates a Datasources sub-SDK bean if none exists. - * - * @param glean the main SDK instance - * @return A configured Datasources instance - */ - @Bean - @ConditionalOnMissingBean - public Datasources datasources(Glean glean) { - return glean.datasources(); - } - - /** - * Creates the async SDK bean if none exists. - * - * @param glean the main SDK instance - * @param sdkConfiguration the configured SDKConfiguration bean - * @return A configured AsyncGlean instance - */ - @Bean - @ConditionalOnMissingBean - public AsyncGlean asyncGlean(Glean glean, SDKConfiguration sdkConfiguration) { - return new AsyncGlean(glean, sdkConfiguration); - } - /** - * Creates an AsyncClient sub-SDK bean if none exists. - * - * @param asyncGlean the async SDK instance - * @return A configured AsyncClient instance - */ - @Bean - @ConditionalOnMissingBean - public AsyncClient asyncClient(AsyncGlean asyncGlean) { - return asyncGlean.client(); - } - /** - * Creates an AsyncAuthentication sub-SDK bean if none exists. - * - * @param asyncGlean the async SDK instance - * @return A configured AsyncAuthentication instance - */ - @Bean - @ConditionalOnMissingBean - public AsyncAuthentication asyncAuthentication(AsyncGlean asyncGlean) { - return asyncGlean.authentication(); - } - /** - * Creates an AsyncChat sub-SDK bean if none exists. - * - * @param asyncGlean the async SDK instance - * @return A configured AsyncChat instance - */ - @Bean - @ConditionalOnMissingBean - public AsyncChat asyncChat(AsyncGlean asyncGlean) { - return asyncGlean.chat(); - } - /** - * Creates an AsyncAgents sub-SDK bean if none exists. - * - * @param asyncGlean the async SDK instance - * @return A configured AsyncAgents instance - */ - @Bean - @ConditionalOnMissingBean - public AsyncAgents asyncAgents(AsyncGlean asyncGlean) { - return asyncGlean.agents(); - } - /** - * Creates an AsyncEntities sub-SDK bean if none exists. - * - * @param asyncGlean the async SDK instance - * @return A configured AsyncEntities instance - */ - @Bean - @ConditionalOnMissingBean - public AsyncEntities asyncEntities(AsyncGlean asyncGlean) { - return asyncGlean.entities(); - } - /** - * Creates an AsyncTools sub-SDK bean if none exists. - * - * @param asyncGlean the async SDK instance - * @return A configured AsyncTools instance - */ - @Bean - @ConditionalOnMissingBean - public AsyncTools asyncTools(AsyncGlean asyncGlean) { - return asyncGlean.tools(); - } - /** - * Creates an AsyncIndexing sub-SDK bean if none exists. - * - * @param asyncGlean the async SDK instance - * @return A configured AsyncIndexing instance - */ - @Bean - @ConditionalOnMissingBean - public AsyncIndexing asyncIndexing(AsyncGlean asyncGlean) { - return asyncGlean.indexing(); - } - /** - * Creates an AsyncTroubleshooting sub-SDK bean if none exists. - * - * @param asyncGlean the async SDK instance - * @return A configured AsyncTroubleshooting instance - */ - @Bean - @ConditionalOnMissingBean - public AsyncTroubleshooting asyncTroubleshooting(AsyncGlean asyncGlean) { - return asyncGlean.troubleshooting(); - } - /** - * Creates an AsyncGovernance sub-SDK bean if none exists. - * - * @param asyncGlean the async SDK instance - * @return A configured AsyncGovernance instance - */ - @Bean - @ConditionalOnMissingBean - public AsyncGovernance asyncGovernance(AsyncGlean asyncGlean) { - return asyncGlean.governance(); - } - /** - * Creates an AsyncDatasources sub-SDK bean if none exists. - * - * @param asyncGlean the async SDK instance - * @return A configured AsyncDatasources instance - */ - @Bean - @ConditionalOnMissingBean - public AsyncDatasources asyncDatasources(AsyncGlean asyncGlean) { - return asyncGlean.datasources(); - } -} \ No newline at end of file diff --git a/spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/GleanApiClientAutoConfigProperties.java b/spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/GleanApiClientAutoConfigProperties.java deleted file mode 100644 index ccfade08..00000000 --- a/spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/GleanApiClientAutoConfigProperties.java +++ /dev/null @@ -1,518 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - * @generated-id: 5111ca066791 - */ -package com.glean.api_client.glean_api_client; - -import org.springframework.boot.context.properties.ConfigurationProperties; - -import java.time.Duration; -import java.lang.String; -import java.util.Collection; -import java.util.Set; - - -/** - * Spring Boot Configuration Properties for glean-api-client SDK - */ -@ConfigurationProperties(prefix = "gleanapiclient") -public class GleanApiClientAutoConfigProperties { - - /** - * Constructor. - */ - public GleanApiClientAutoConfigProperties() { - } - - /** - * The base URL for the API server. If not specified, the SDK will use the default server URL. - */ - private String serverUrl; - - /** - * Configuration for retry behavior when API calls fail due to transient errors. - */ - private RetryConfig retryConfig = new RetryConfig(); - - /** - * HTTP client configuration for API requests. - */ - private HttpClient httpClient = new HttpClient(); - /** - * The index of the server to use from the list of available servers (0-based). Defaults to the first server. - */ - private int serverIdx = 0; - /** - * Server variable configuration for parameterized server URLs defined in the OpenAPI specification. - */ - private ServerVariables serverVariables = new ServerVariables(); - /** - * Security configuration for API authentication. - */ - private Security security = new Security(); - - /** - * Gets the base URL for the API server. - * - * @return the base URL for the API server - */ - public String getServerUrl() { - return serverUrl; - } - - /** - * Sets the base URL for the API server. - * - * @param serverUrl the base URL for the API server - */ - public void setServerUrl(String serverUrl) { - this.serverUrl = serverUrl; - } - - /** - * Gets the retry configuration for API calls that fail due to transient errors. - * - * @return the retry configuration - */ - public RetryConfig getRetryConfig() { - return retryConfig; - } - - /** - * Sets the retry configuration for API calls that fail due to transient errors. - * - * @param retryConfig the retry configuration to use - */ - public void setRetryConfig(RetryConfig retryConfig) { - this.retryConfig = retryConfig; - } - - /** - * Gets the HTTP client configuration for API requests. - * - * @return the HTTP client configuration - */ - public HttpClient getHttpClient() { - return httpClient; - } - - /** - * Sets the HTTP client configuration for API requests. - * - * @param httpClient the HTTP client configuration to use - */ - public void setHttpClient(HttpClient httpClient) { - this.httpClient = httpClient; - } - /** - * Gets the index of the server to use from the list of available servers (0-based). - * - * @return the server index - */ - public int getServerIdx() { - return serverIdx; - } - - /** - * Sets the index of the server to use from the list of available servers (0-based). - * - * @param serverIdx the server index to use - */ - public void setServerIdx(int serverIdx) { - this.serverIdx = serverIdx; - } - /** - * Gets the server variable configuration for parameterized server URLs. - * - * @return the server variables configuration - */ - public ServerVariables getServerVariables() { - return serverVariables; - } - - /** - * Sets the server variable configuration for parameterized server URLs. - * - * @param serverVariables the server variables configuration to use - */ - public void setServerVariables(ServerVariables serverVariables) { - this.serverVariables = serverVariables; - } - /** - * Gets the security configuration for API authentication. - * - * @return the security configuration - */ - public Security getSecurity() { - return security; - } - - /** - * Sets the security configuration for API authentication. - * - * @param security the security configuration to use - */ - public void setSecurity(Security security) { - this.security = security; - } - - /** - * Retry configuration properties - */ - public static class RetryConfig { - - /** - * Constructor. - */ - public RetryConfig() { - } - - /** - * The retry strategy to use for failed requests. - */ - private com.glean.api_client.glean_api_client.utils.RetryConfig.Strategy strategy; - - /** - * Configuration for exponential backoff retry strategy. Only used when strategy is set to BACKOFF. - */ - private Backoff backoff = new Backoff(); - - /** - * Gets the retry strategy to use for failed requests. - * - * @return the retry strategy - */ - public com.glean.api_client.glean_api_client.utils.RetryConfig.Strategy getStrategy() { - return strategy; - } - - /** - * Sets the retry strategy to use for failed requests. - * - * @param strategy the retry strategy to use - */ - public void setStrategy(com.glean.api_client.glean_api_client.utils.RetryConfig.Strategy strategy) { - this.strategy = strategy; - } - - /** - * Gets the backoff configuration for exponential backoff retry strategy. - * - * @return the backoff configuration - */ - public Backoff getBackoff() { - return backoff; - } - - /** - * Sets the backoff configuration for exponential backoff retry strategy. - * - * @param backoff the backoff configuration to use - */ - public void setBackoff(Backoff backoff) { - this.backoff = backoff; - } - - /** - * Backoff retry configuration matching BackoffStrategy fields - */ - public static class Backoff { - - /** - * Constructor. - */ - public Backoff() { - } - - /** - * The initial delay before the first retry attempt. Supports duration formats like "500ms", "1s", "2m". - */ - private Duration initialInterval = Duration.ofMillis(500); - - /** - * The maximum delay between retry attempts. The backoff will not exceed this value. - */ - private Duration maxInterval = Duration.ofSeconds(60); - - /** - * The maximum total time to spend on all retry attempts. Retries will stop after this duration. - */ - private Duration maxElapsedTime = Duration.ofHours(1); - - /** - * The multiplier for exponential backoff. Each retry delay is multiplied by this factor (e.g., 1.5 means 50% increase). - */ - private double baseFactor = 1.5; - - /** - * Random jitter factor to avoid thundering herd problems. Value between 0.0 (no jitter) and 1.0 (full jitter). - */ - private double jitterFactor = 0.5; - - /** - * Whether to retry requests that fail due to connection errors (e.g., connection refused, timeout). - */ - private boolean retryConnectError = false; - - /** - * Whether to retry requests that fail due to read timeout errors (server doesn't respond within timeout). - */ - private boolean retryReadTimeoutError = false; - - /** - * Gets the initial delay before the first retry attempt. - * - * @return the initial delay duration - */ - public Duration getInitialInterval() { - return initialInterval; - } - - /** - * Sets the initial delay before the first retry attempt. - * - * @param initialInterval the initial delay duration - */ - public void setInitialInterval(Duration initialInterval) { - this.initialInterval = initialInterval; - } - - /** - * Gets the maximum delay between retry attempts. - * - * @return the maximum delay duration - */ - public Duration getMaxInterval() { - return maxInterval; - } - - /** - * Sets the maximum delay between retry attempts. - * - * @param maxInterval the maximum delay duration - */ - public void setMaxInterval(Duration maxInterval) { - this.maxInterval = maxInterval; - } - - /** - * Gets the maximum total time to spend on all retry attempts. - * - * @return the maximum elapsed time duration - */ - public Duration getMaxElapsedTime() { - return maxElapsedTime; - } - - /** - * Sets the maximum total time to spend on all retry attempts. - * - * @param maxElapsedTime the maximum elapsed time duration - */ - public void setMaxElapsedTime(Duration maxElapsedTime) { - this.maxElapsedTime = maxElapsedTime; - } - - /** - * Gets the multiplier for exponential backoff. - * - * @return the base factor for exponential backoff - */ - public double getBaseFactor() { - return baseFactor; - } - - /** - * Sets the multiplier for exponential backoff. - * - * @param baseFactor the base factor for exponential backoff - */ - public void setBaseFactor(double baseFactor) { - this.baseFactor = baseFactor; - } - - /** - * Gets the random jitter factor to avoid thundering herd problems. - * - * @return the jitter factor (0.0 to 1.0) - */ - public double getJitterFactor() { - return jitterFactor; - } - - /** - * Sets the random jitter factor to avoid thundering herd problems. - * - * @param jitterFactor the jitter factor (0.0 to 1.0) - */ - public void setJitterFactor(double jitterFactor) { - this.jitterFactor = jitterFactor; - } - - /** - * Gets whether to retry requests that fail due to connection errors. - * - * @return true if connection errors should be retried, false otherwise - */ - public boolean isRetryConnectError() { - return retryConnectError; - } - - /** - * Sets whether to retry requests that fail due to connection errors. - * - * @param retryConnectError true to retry connection errors, false otherwise - */ - public void setRetryConnectError(boolean retryConnectError) { - this.retryConnectError = retryConnectError; - } - - /** - * Gets whether to retry requests that fail due to read timeout errors. - * - * @return true if read timeout errors should be retried, false otherwise - */ - public boolean isRetryReadTimeoutError() { - return retryReadTimeoutError; - } - - /** - * Sets whether to retry requests that fail due to read timeout errors. - * - * @param retryReadTimeoutError true to retry read timeout errors, false otherwise - */ - public void setRetryReadTimeoutError(boolean retryReadTimeoutError) { - this.retryReadTimeoutError = retryReadTimeoutError; - } - } - } - - /** - * HTTP client configuration properties - */ - public static class HttpClient { - - /** - * Constructor. - */ - public HttpClient() { - } - - /** - * Whether to enable debug logging for HTTP requests and responses, including JSON body content. - */ - private boolean enableDebugLogging = false; - - /** - * Collection of header names (case-insensitive) whose values will be redacted in debug logs. - * By default, Authorization and X-API-KEY headers are redacted for security. - */ - private Collection redactedHeaders = Set.of("Authorization", "X-API-KEY"); - - /** - * Gets whether debug logging is enabled for HTTP requests and responses. - * - * @return true if debug logging is enabled, false otherwise - */ - public boolean isEnableDebugLogging() { - return enableDebugLogging; - } - - /** - * Sets whether to enable debug logging for HTTP requests and responses. - * - * @param enableDebugLogging true to enable debug logging, false otherwise - */ - public void setEnableDebugLogging(boolean enableDebugLogging) { - this.enableDebugLogging = enableDebugLogging; - } - - /** - * Gets the collection of header names whose values will be redacted in debug logs. - * - * @return the collection of header names to redact - */ - public Collection getRedactedHeaders() { - return redactedHeaders; - } - - /** - * Sets the collection of header names whose values will be redacted in debug logs. - * - * @param redactedHeaders the collection of header names to redact - */ - public void setRedactedHeaders(Collection redactedHeaders) { - this.redactedHeaders = redactedHeaders; - } - } - - /** - * Server variables configuration properties - */ - public static class ServerVariables { - - /** - * Constructor. - */ - public ServerVariables() { - } - - /** - * The instance name (typically the email domain without the TLD) that determines the deployment - * backend. - */ - private String instance = "instance-name"; - - /** - * Gets the instance server variable for URL substitution. - * - * @return the instance value - */ - public String getInstance() { - return instance; - } - - /** - * Sets the instance server variable for URL substitution. - * - * @param instance the instance value to use - */ - public void setInstance(String instance) { - this.instance = instance; - } - } - - /** - * Security configuration properties - */ - public static class Security { - - /** - * Constructor. - */ - public Security() { - } - /** - * APIToken for authentication. - */ - private String apiToken; - - /** - * Gets the APIToken value. - * - * @return the APIToken value - */ - public String getAPIToken() { - return apiToken; - } - - /** - * Sets the APIToken value. - * - * @param apiToken the APIToken value to use - */ - public void setAPIToken(String apiToken) { - this.apiToken = apiToken; - } - } -} \ No newline at end of file diff --git a/spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/OnPropertyPrefixCondition.java b/spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/OnPropertyPrefixCondition.java deleted file mode 100644 index c5bf1eef..00000000 --- a/spring/glean-api-client-spring-boot-autoconfigure/src/main/java/com/glean/api_client/glean_api_client/OnPropertyPrefixCondition.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - * @generated-id: 269180435615 - */ -package com.glean.api_client.glean_api_client; - -import org.springframework.boot.autoconfigure.condition.ConditionMessage; -import org.springframework.boot.autoconfigure.condition.ConditionOutcome; -import org.springframework.boot.autoconfigure.condition.SpringBootCondition; -import org.springframework.boot.context.properties.bind.Binder; -import org.springframework.context.annotation.ConditionContext; -import org.springframework.core.type.AnnotatedTypeMetadata; -import org.springframework.core.env.Environment; - -import java.util.Map; - -/** - * Custom condition that checks if any properties exist under a given prefix. - * This is used to conditionally create beans only when configuration properties - * are present under a specific prefix. - */ -public class OnPropertyPrefixCondition extends SpringBootCondition { - - /** - * Default constructor for OnPropertyPrefixCondition. - */ - public OnPropertyPrefixCondition() { - // Default constructor - } - - @Override - public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - Map attributes = metadata.getAnnotationAttributes(ConditionalOnPropertyPrefix.class.getName()); - if (attributes == null) { - return ConditionOutcome.noMatch("@ConditionalOnPropertyPrefix annotation not found"); - } - - String prefix = (String) attributes.get("prefix"); - if (prefix == null || prefix.isEmpty()) { - return ConditionOutcome.noMatch("Property prefix is empty"); - } - - Environment environment = context.getEnvironment(); - - // Check if any properties exist under the given prefix - boolean hasPropertiesUnderPrefix = hasPropertiesWithPrefix(environment, prefix); - - ConditionMessage.Builder message = ConditionMessage.forCondition(ConditionalOnPropertyPrefix.class, prefix); - - if (hasPropertiesUnderPrefix) { - return ConditionOutcome.match(message.found("properties").items(prefix + ".*")); - } else { - return ConditionOutcome.noMatch(message.didNotFind("properties").items(prefix + ".*")); - } - } - - private boolean hasPropertiesWithPrefix(Environment environment, String prefix) { - try { - // Use Spring Boot's Binder to check if any properties exist under the prefix - Binder binder = Binder.get(environment); - - // Try to bind to a Map to see if any properties exist under the prefix - return binder.bind(prefix, Map.class).isBound(); - } catch (Exception e) { - // If we can't determine, assume no properties exist - return false; - } - } -} \ No newline at end of file diff --git a/spring/glean-api-client-spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring/glean-api-client-spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index 5b50a32f..00000000 --- a/spring/glean-api-client-spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ /dev/null @@ -1 +0,0 @@ -com.glean.api_client.glean_api_client.GleanApiClientAutoConfig \ No newline at end of file diff --git a/spring/glean-api-client-spring-boot-starter/build.gradle b/spring/glean-api-client-spring-boot-starter/build.gradle deleted file mode 100644 index 35125984..00000000 --- a/spring/glean-api-client-spring-boot-starter/build.gradle +++ /dev/null @@ -1,29 +0,0 @@ -description = 'glean-api-client Spring Boot Starter' - -// Publishing configuration overrides -ext { - publishingConfig = [ - groupId: rootProject.group, - artifactId: 'glean-api-client-spring-boot-starter', - version: rootProject.version, - name: 'Glean Java SDK - Spring Boot Starter', - description: 'Spring Boot starter for the Glean Java SDK.', - ] -} - -dependencies { - api project(':') - api project(':glean-api-client-spring-boot-autoconfigure') - api "org.springframework.boot:spring-boot-starter:${rootProject.springBootVersion}" -} - -jar { - dependsOn 'generatePomFileForMavenPublication' - archiveBaseName = 'glean-api-client-spring-boot-starter' - into("META-INF/maven/com.glean.api-client/glean-api-client-spring-boot-starter") { - from(layout.buildDirectory.file("pom.xml")) { - // Only include if it exists to avoid build ordering issues - duplicatesStrategy = DuplicatesStrategy.INCLUDE - } - } -} \ No newline at end of file diff --git a/src/main/java/com/glean/api_client/glean_api_client/Agents.java b/src/main/java/com/glean/api_client/glean_api_client/Agents.java index 42ff73f8..bc56c524 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Agents.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Agents.java @@ -6,10 +6,15 @@ import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; +import com.glean.api_client.glean_api_client.models.components.CreateWorkflowRequest; import com.glean.api_client.glean_api_client.models.components.EditWorkflowRequest; +import com.glean.api_client.glean_api_client.models.operations.CreateAgentRequest; +import com.glean.api_client.glean_api_client.models.operations.CreateAgentRequestBuilder; +import com.glean.api_client.glean_api_client.models.operations.CreateAgentResponse; import com.glean.api_client.glean_api_client.models.operations.EditAgentRequest; import com.glean.api_client.glean_api_client.models.operations.EditAgentRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.EditAgentResponse; +import com.glean.api_client.glean_api_client.operations.CreateAgent; import com.glean.api_client.glean_api_client.operations.EditAgent; import com.glean.api_client.glean_api_client.utils.Headers; import java.lang.Long; @@ -36,6 +41,56 @@ public AsyncAgents async() { return asyncSDK; } + /** + * Create an agent + * + *

Create an agent. + * + * @return The call builder + */ + public CreateAgentRequestBuilder createAgent() { + return new CreateAgentRequestBuilder(sdkConfiguration); + } + + /** + * Create an agent + * + *

Create an agent. + * + * @param createWorkflowRequest + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public CreateAgentResponse createAgent(CreateWorkflowRequest createWorkflowRequest) { + return createAgent(Optional.empty(), Optional.empty(), createWorkflowRequest); + } + + /** + * Create an agent + * + *

Create an agent. + * + * @param locale The client's preferred locale in rfc5646 format (e.g. `en`, `ja`, `pt-BR`). If omitted, the `Accept-Language` will be used. If not present or not supported, defaults to the closest match or `en`. + * @param timezoneOffset The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC. + * @param createWorkflowRequest + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public CreateAgentResponse createAgent( + Optional locale, Optional timezoneOffset, + CreateWorkflowRequest createWorkflowRequest) { + CreateAgentRequest request = + CreateAgentRequest + .builder() + .locale(locale) + .timezoneOffset(timezoneOffset) + .createWorkflowRequest(createWorkflowRequest) + .build(); + RequestOperation operation + = new CreateAgent.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); + } + /** * Edit an agent * diff --git a/src/main/java/com/glean/api_client/glean_api_client/AsyncAgents.java b/src/main/java/com/glean/api_client/glean_api_client/AsyncAgents.java index dd04fd0e..fa11a40b 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/AsyncAgents.java +++ b/src/main/java/com/glean/api_client/glean_api_client/AsyncAgents.java @@ -6,10 +6,15 @@ import static com.glean.api_client.glean_api_client.operations.Operations.AsyncRequestOperation; +import com.glean.api_client.glean_api_client.models.components.CreateWorkflowRequest; import com.glean.api_client.glean_api_client.models.components.EditWorkflowRequest; +import com.glean.api_client.glean_api_client.models.operations.CreateAgentRequest; import com.glean.api_client.glean_api_client.models.operations.EditAgentRequest; +import com.glean.api_client.glean_api_client.models.operations.async.CreateAgentRequestBuilder; +import com.glean.api_client.glean_api_client.models.operations.async.CreateAgentResponse; import com.glean.api_client.glean_api_client.models.operations.async.EditAgentRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.async.EditAgentResponse; +import com.glean.api_client.glean_api_client.operations.CreateAgent; import com.glean.api_client.glean_api_client.operations.EditAgent; import com.glean.api_client.glean_api_client.utils.Headers; import java.lang.Long; @@ -38,6 +43,56 @@ public Agents sync() { } + /** + * Create an agent + * + *

Create an agent. + * + * @return The async call builder + */ + public CreateAgentRequestBuilder createAgent() { + return new CreateAgentRequestBuilder(sdkConfiguration); + } + + /** + * Create an agent + * + *

Create an agent. + * + * @param createWorkflowRequest + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture createAgent(CreateWorkflowRequest createWorkflowRequest) { + return createAgent(Optional.empty(), Optional.empty(), createWorkflowRequest); + } + + /** + * Create an agent + * + *

Create an agent. + * + * @param locale The client's preferred locale in rfc5646 format (e.g. `en`, `ja`, `pt-BR`). If omitted, the `Accept-Language` will be used. If not present or not supported, defaults to the closest match or `en`. + * @param timezoneOffset The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC. + * @param createWorkflowRequest + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture createAgent( + Optional locale, Optional timezoneOffset, + CreateWorkflowRequest createWorkflowRequest) { + CreateAgentRequest request = + CreateAgentRequest + .builder() + .locale(locale) + .timezoneOffset(timezoneOffset) + .createWorkflowRequest(createWorkflowRequest) + .build(); + AsyncRequestOperation operation + = new CreateAgent.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + /** * Edit an agent * diff --git a/src/main/java/com/glean/api_client/glean_api_client/Glean.java b/src/main/java/com/glean/api_client/glean_api_client/Glean.java index 7df143d9..6daa8699 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Glean.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Glean.java @@ -305,7 +305,7 @@ public static Builder builder() { return new Builder(); } - public Glean(SDKConfiguration sdkConfiguration) { + private Glean(SDKConfiguration sdkConfiguration) { sdkConfiguration.initialize(); this.client = new Client(sdkConfiguration); this.authentication = new Authentication(sdkConfiguration); diff --git a/src/main/java/com/glean/api_client/glean_api_client/SDKConfiguration.java b/src/main/java/com/glean/api_client/glean_api_client/SDKConfiguration.java index 85a9705d..313c97b2 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/SDKConfiguration.java +++ b/src/main/java/com/glean/api_client/glean_api_client/SDKConfiguration.java @@ -25,8 +25,8 @@ public class SDKConfiguration { private static final String LANGUAGE = "java"; public static final String OPENAPI_DOC_VERSION = "0.9.0"; - public static final String SDK_VERSION = "0.13.1"; - public static final String GEN_VERSION = "2.893.0"; + public static final String SDK_VERSION = "0.13.2"; + public static final String GEN_VERSION = "2.900.1"; private static final String BASE_PACKAGE = "com.glean.api_client.glean_api_client"; public static final String USER_AGENT = String.format("speakeasy-sdk/%s %s %s %s %s", diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/CreateWorkflowRequest.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/CreateWorkflowRequest.java new file mode 100644 index 00000000..1b1c289f --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/CreateWorkflowRequest.java @@ -0,0 +1,250 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 5787c28d8983 + */ +package com.glean.api_client.glean_api_client.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.glean.api_client.glean_api_client.utils.Utils; +import java.lang.Boolean; +import java.lang.Override; +import java.lang.String; +import java.util.Optional; + + +public class CreateWorkflowRequest { + /** + * The name of the workflow. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("name") + private Optional name; + + /** + * Used to create a transient workflow. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("transient") + private Optional transient_; + + /** + * id of the parent workflow for transient workflows + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("parentWorkflowId") + private Optional parentWorkflowId; + + @JsonCreator + public CreateWorkflowRequest( + @JsonProperty("name") Optional name, + @JsonProperty("transient") Optional transient_, + @JsonProperty("parentWorkflowId") Optional parentWorkflowId) { + Utils.checkNotNull(name, "name"); + Utils.checkNotNull(transient_, "transient_"); + Utils.checkNotNull(parentWorkflowId, "parentWorkflowId"); + this.name = name; + this.transient_ = transient_; + this.parentWorkflowId = parentWorkflowId; + } + + public CreateWorkflowRequest() { + this(Optional.empty(), Optional.empty(), Optional.empty()); + } + + /** + * The name of the workflow. + */ + @JsonIgnore + public Optional name() { + return name; + } + + /** + * Used to create a transient workflow. + */ + @JsonIgnore + public Optional transient_() { + return transient_; + } + + /** + * id of the parent workflow for transient workflows + */ + @JsonIgnore + public Optional parentWorkflowId() { + return parentWorkflowId; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * The name of the workflow. + */ + public CreateWorkflowRequest withName(String name) { + Utils.checkNotNull(name, "name"); + this.name = Optional.ofNullable(name); + return this; + } + + + /** + * The name of the workflow. + */ + public CreateWorkflowRequest withName(Optional name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + /** + * Used to create a transient workflow. + */ + public CreateWorkflowRequest withTransient(boolean transient_) { + Utils.checkNotNull(transient_, "transient_"); + this.transient_ = Optional.ofNullable(transient_); + return this; + } + + + /** + * Used to create a transient workflow. + */ + public CreateWorkflowRequest withTransient(Optional transient_) { + Utils.checkNotNull(transient_, "transient_"); + this.transient_ = transient_; + return this; + } + + /** + * id of the parent workflow for transient workflows + */ + public CreateWorkflowRequest withParentWorkflowId(String parentWorkflowId) { + Utils.checkNotNull(parentWorkflowId, "parentWorkflowId"); + this.parentWorkflowId = Optional.ofNullable(parentWorkflowId); + return this; + } + + + /** + * id of the parent workflow for transient workflows + */ + public CreateWorkflowRequest withParentWorkflowId(Optional parentWorkflowId) { + Utils.checkNotNull(parentWorkflowId, "parentWorkflowId"); + this.parentWorkflowId = parentWorkflowId; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateWorkflowRequest other = (CreateWorkflowRequest) o; + return + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.transient_, other.transient_) && + Utils.enhancedDeepEquals(this.parentWorkflowId, other.parentWorkflowId); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + name, transient_, parentWorkflowId); + } + + @Override + public String toString() { + return Utils.toString(CreateWorkflowRequest.class, + "name", name, + "transient_", transient_, + "parentWorkflowId", parentWorkflowId); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private Optional name = Optional.empty(); + + private Optional transient_ = Optional.empty(); + + private Optional parentWorkflowId = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * The name of the workflow. + */ + public Builder name(String name) { + Utils.checkNotNull(name, "name"); + this.name = Optional.ofNullable(name); + return this; + } + + /** + * The name of the workflow. + */ + public Builder name(Optional name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + + /** + * Used to create a transient workflow. + */ + public Builder transient_(boolean transient_) { + Utils.checkNotNull(transient_, "transient_"); + this.transient_ = Optional.ofNullable(transient_); + return this; + } + + /** + * Used to create a transient workflow. + */ + public Builder transient_(Optional transient_) { + Utils.checkNotNull(transient_, "transient_"); + this.transient_ = transient_; + return this; + } + + + /** + * id of the parent workflow for transient workflows + */ + public Builder parentWorkflowId(String parentWorkflowId) { + Utils.checkNotNull(parentWorkflowId, "parentWorkflowId"); + this.parentWorkflowId = Optional.ofNullable(parentWorkflowId); + return this; + } + + /** + * id of the parent workflow for transient workflows + */ + public Builder parentWorkflowId(Optional parentWorkflowId) { + Utils.checkNotNull(parentWorkflowId, "parentWorkflowId"); + this.parentWorkflowId = parentWorkflowId; + return this; + } + + public CreateWorkflowRequest build() { + + return new CreateWorkflowRequest( + name, transient_, parentWorkflowId); + } + + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/GroupType.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/GroupType.java index 31925868..bb3a832d 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/components/GroupType.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/GroupType.java @@ -34,6 +34,7 @@ public class GroupType { public static final GroupType LOCATION = new GroupType("LOCATION"); public static final GroupType REGION = new GroupType("REGION"); public static final GroupType EXTERNAL_GROUP = new GroupType("EXTERNAL_GROUP"); + public static final GroupType COLLECTION_AUDIENCE = new GroupType("COLLECTION_AUDIENCE"); // This map will grow whenever a Color gets created with a new // unrecognized value (a potential memory leak if the user is not @@ -115,6 +116,7 @@ private static final Map createValuesMap() { map.put("LOCATION", LOCATION); map.put("REGION", REGION); map.put("EXTERNAL_GROUP", EXTERNAL_GROUP); + map.put("COLLECTION_AUDIENCE", COLLECTION_AUDIENCE); return map; } @@ -128,6 +130,7 @@ private static final Map createEnumsMap() { map.put("LOCATION", GroupTypeEnum.LOCATION); map.put("REGION", GroupTypeEnum.REGION); map.put("EXTERNAL_GROUP", GroupTypeEnum.EXTERNAL_GROUP); + map.put("COLLECTION_AUDIENCE", GroupTypeEnum.COLLECTION_AUDIENCE); return map; } @@ -141,7 +144,8 @@ public enum GroupTypeEnum { ROLE_TYPE("ROLE_TYPE"), LOCATION("LOCATION"), REGION("REGION"), - EXTERNAL_GROUP("EXTERNAL_GROUP"),; + EXTERNAL_GROUP("EXTERNAL_GROUP"), + COLLECTION_AUDIENCE("COLLECTION_AUDIENCE"),; private final String value; diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAgentRequest.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAgentRequest.java new file mode 100644 index 00000000..cc0d6fff --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAgentRequest.java @@ -0,0 +1,241 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 177d8e375f2b + */ +package com.glean.api_client.glean_api_client.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.glean.api_client.glean_api_client.models.components.CreateWorkflowRequest; +import com.glean.api_client.glean_api_client.utils.SpeakeasyMetadata; +import com.glean.api_client.glean_api_client.utils.Utils; +import java.lang.Long; +import java.lang.Override; +import java.lang.String; +import java.util.Optional; + + +public class CreateAgentRequest { + /** + * The client's preferred locale in rfc5646 format (e.g. `en`, `ja`, `pt-BR`). If omitted, the + * `Accept-Language` will be used. + * + *

If not present or not supported, defaults to the closest match or `en`. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=locale") + private Optional locale; + + /** + * The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours + * behind UTC. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=timezoneOffset") + private Optional timezoneOffset; + + + @SpeakeasyMetadata("request:mediaType=application/json") + private CreateWorkflowRequest createWorkflowRequest; + + @JsonCreator + public CreateAgentRequest( + Optional locale, + Optional timezoneOffset, + CreateWorkflowRequest createWorkflowRequest) { + Utils.checkNotNull(locale, "locale"); + Utils.checkNotNull(timezoneOffset, "timezoneOffset"); + Utils.checkNotNull(createWorkflowRequest, "createWorkflowRequest"); + this.locale = locale; + this.timezoneOffset = timezoneOffset; + this.createWorkflowRequest = createWorkflowRequest; + } + + public CreateAgentRequest( + CreateWorkflowRequest createWorkflowRequest) { + this(Optional.empty(), Optional.empty(), createWorkflowRequest); + } + + /** + * The client's preferred locale in rfc5646 format (e.g. `en`, `ja`, `pt-BR`). If omitted, the + * `Accept-Language` will be used. + * + *

If not present or not supported, defaults to the closest match or `en`. + */ + @JsonIgnore + public Optional locale() { + return locale; + } + + /** + * The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours + * behind UTC. + */ + @JsonIgnore + public Optional timezoneOffset() { + return timezoneOffset; + } + + @JsonIgnore + public CreateWorkflowRequest createWorkflowRequest() { + return createWorkflowRequest; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * The client's preferred locale in rfc5646 format (e.g. `en`, `ja`, `pt-BR`). If omitted, the + * `Accept-Language` will be used. + * + *

If not present or not supported, defaults to the closest match or `en`. + */ + public CreateAgentRequest withLocale(String locale) { + Utils.checkNotNull(locale, "locale"); + this.locale = Optional.ofNullable(locale); + return this; + } + + + /** + * The client's preferred locale in rfc5646 format (e.g. `en`, `ja`, `pt-BR`). If omitted, the + * `Accept-Language` will be used. + * + *

If not present or not supported, defaults to the closest match or `en`. + */ + public CreateAgentRequest withLocale(Optional locale) { + Utils.checkNotNull(locale, "locale"); + this.locale = locale; + return this; + } + + /** + * The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours + * behind UTC. + */ + public CreateAgentRequest withTimezoneOffset(long timezoneOffset) { + Utils.checkNotNull(timezoneOffset, "timezoneOffset"); + this.timezoneOffset = Optional.ofNullable(timezoneOffset); + return this; + } + + + /** + * The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours + * behind UTC. + */ + public CreateAgentRequest withTimezoneOffset(Optional timezoneOffset) { + Utils.checkNotNull(timezoneOffset, "timezoneOffset"); + this.timezoneOffset = timezoneOffset; + return this; + } + + public CreateAgentRequest withCreateWorkflowRequest(CreateWorkflowRequest createWorkflowRequest) { + Utils.checkNotNull(createWorkflowRequest, "createWorkflowRequest"); + this.createWorkflowRequest = createWorkflowRequest; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAgentRequest other = (CreateAgentRequest) o; + return + Utils.enhancedDeepEquals(this.locale, other.locale) && + Utils.enhancedDeepEquals(this.timezoneOffset, other.timezoneOffset) && + Utils.enhancedDeepEquals(this.createWorkflowRequest, other.createWorkflowRequest); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + locale, timezoneOffset, createWorkflowRequest); + } + + @Override + public String toString() { + return Utils.toString(CreateAgentRequest.class, + "locale", locale, + "timezoneOffset", timezoneOffset, + "createWorkflowRequest", createWorkflowRequest); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private Optional locale = Optional.empty(); + + private Optional timezoneOffset = Optional.empty(); + + private CreateWorkflowRequest createWorkflowRequest; + + private Builder() { + // force use of static builder() method + } + + + /** + * The client's preferred locale in rfc5646 format (e.g. `en`, `ja`, `pt-BR`). If omitted, the + * `Accept-Language` will be used. + * + *

If not present or not supported, defaults to the closest match or `en`. + */ + public Builder locale(String locale) { + Utils.checkNotNull(locale, "locale"); + this.locale = Optional.ofNullable(locale); + return this; + } + + /** + * The client's preferred locale in rfc5646 format (e.g. `en`, `ja`, `pt-BR`). If omitted, the + * `Accept-Language` will be used. + * + *

If not present or not supported, defaults to the closest match or `en`. + */ + public Builder locale(Optional locale) { + Utils.checkNotNull(locale, "locale"); + this.locale = locale; + return this; + } + + + /** + * The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours + * behind UTC. + */ + public Builder timezoneOffset(long timezoneOffset) { + Utils.checkNotNull(timezoneOffset, "timezoneOffset"); + this.timezoneOffset = Optional.ofNullable(timezoneOffset); + return this; + } + + /** + * The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours + * behind UTC. + */ + public Builder timezoneOffset(Optional timezoneOffset) { + Utils.checkNotNull(timezoneOffset, "timezoneOffset"); + this.timezoneOffset = timezoneOffset; + return this; + } + + + public Builder createWorkflowRequest(CreateWorkflowRequest createWorkflowRequest) { + Utils.checkNotNull(createWorkflowRequest, "createWorkflowRequest"); + this.createWorkflowRequest = createWorkflowRequest; + return this; + } + + public CreateAgentRequest build() { + + return new CreateAgentRequest( + locale, timezoneOffset, createWorkflowRequest); + } + + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAgentRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAgentRequestBuilder.java new file mode 100644 index 00000000..5b139437 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAgentRequestBuilder.java @@ -0,0 +1,78 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 7b7da64e250d + */ +package com.glean.api_client.glean_api_client.models.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +import com.glean.api_client.glean_api_client.SDKConfiguration; +import com.glean.api_client.glean_api_client.models.components.CreateWorkflowRequest; +import com.glean.api_client.glean_api_client.operations.CreateAgent; +import com.glean.api_client.glean_api_client.utils.Headers; +import com.glean.api_client.glean_api_client.utils.Utils; +import java.lang.Long; +import java.lang.String; +import java.util.Optional; + +public class CreateAgentRequestBuilder { + + private Optional locale = Optional.empty(); + private Optional timezoneOffset = Optional.empty(); + private CreateWorkflowRequest createWorkflowRequest; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public CreateAgentRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public CreateAgentRequestBuilder locale(String locale) { + Utils.checkNotNull(locale, "locale"); + this.locale = Optional.of(locale); + return this; + } + + public CreateAgentRequestBuilder locale(Optional locale) { + Utils.checkNotNull(locale, "locale"); + this.locale = locale; + return this; + } + + public CreateAgentRequestBuilder timezoneOffset(long timezoneOffset) { + Utils.checkNotNull(timezoneOffset, "timezoneOffset"); + this.timezoneOffset = Optional.of(timezoneOffset); + return this; + } + + public CreateAgentRequestBuilder timezoneOffset(Optional timezoneOffset) { + Utils.checkNotNull(timezoneOffset, "timezoneOffset"); + this.timezoneOffset = timezoneOffset; + return this; + } + + public CreateAgentRequestBuilder createWorkflowRequest(CreateWorkflowRequest createWorkflowRequest) { + Utils.checkNotNull(createWorkflowRequest, "createWorkflowRequest"); + this.createWorkflowRequest = createWorkflowRequest; + return this; + } + + + private CreateAgentRequest buildRequest() { + + CreateAgentRequest request = new CreateAgentRequest(locale, + timezoneOffset, + createWorkflowRequest); + + return request; + } + + public CreateAgentResponse call() { + + RequestOperation operation + = new CreateAgent.Sync(sdkConfiguration, _headers); + CreateAgentRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAgentResponse.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAgentResponse.java new file mode 100644 index 00000000..f8bb1d83 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAgentResponse.java @@ -0,0 +1,254 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 8d1ea0305afe + */ +package com.glean.api_client.glean_api_client.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.glean.api_client.glean_api_client.models.components.WorkflowResult; +import com.glean.api_client.glean_api_client.utils.Response; +import com.glean.api_client.glean_api_client.utils.Utils; +import java.io.InputStream; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; + + +public class CreateAgentResponse implements Response { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional workflowResult; + + @JsonCreator + public CreateAgentResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional workflowResult) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(workflowResult, "workflowResult"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.workflowResult = workflowResult; + } + + public CreateAgentResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional workflowResult() { + return (Optional) workflowResult; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public CreateAgentResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public CreateAgentResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public CreateAgentResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public CreateAgentResponse withWorkflowResult(WorkflowResult workflowResult) { + Utils.checkNotNull(workflowResult, "workflowResult"); + this.workflowResult = Optional.ofNullable(workflowResult); + return this; + } + + + /** + * Success + */ + public CreateAgentResponse withWorkflowResult(Optional workflowResult) { + Utils.checkNotNull(workflowResult, "workflowResult"); + this.workflowResult = workflowResult; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAgentResponse other = (CreateAgentResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.workflowResult, other.workflowResult); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + workflowResult); + } + + @Override + public String toString() { + return Utils.toString(CreateAgentResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "workflowResult", workflowResult); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional workflowResult = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder workflowResult(WorkflowResult workflowResult) { + Utils.checkNotNull(workflowResult, "workflowResult"); + this.workflowResult = Optional.ofNullable(workflowResult); + return this; + } + + /** + * Success + */ + public Builder workflowResult(Optional workflowResult) { + Utils.checkNotNull(workflowResult, "workflowResult"); + this.workflowResult = workflowResult; + return this; + } + + public CreateAgentResponse build() { + + return new CreateAgentResponse( + contentType, statusCode, rawResponse, + workflowResult); + } + + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/async/CreateAgentRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/async/CreateAgentRequestBuilder.java new file mode 100644 index 00000000..7d2e9a9c --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/async/CreateAgentRequestBuilder.java @@ -0,0 +1,81 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 3c6b45f64178 + */ +package com.glean.api_client.glean_api_client.models.operations.async; + +import static com.glean.api_client.glean_api_client.operations.Operations.AsyncRequestOperation; + +import com.glean.api_client.glean_api_client.SDKConfiguration; +import com.glean.api_client.glean_api_client.models.components.CreateWorkflowRequest; +import com.glean.api_client.glean_api_client.models.operations.CreateAgentRequest; +import com.glean.api_client.glean_api_client.operations.CreateAgent; +import com.glean.api_client.glean_api_client.utils.Headers; +import com.glean.api_client.glean_api_client.utils.Utils; +import java.lang.Long; +import java.lang.String; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; + +public class CreateAgentRequestBuilder { + + private Optional locale = Optional.empty(); + private Optional timezoneOffset = Optional.empty(); + private CreateWorkflowRequest createWorkflowRequest; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public CreateAgentRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public CreateAgentRequestBuilder locale(String locale) { + Utils.checkNotNull(locale, "locale"); + this.locale = Optional.of(locale); + return this; + } + + public CreateAgentRequestBuilder locale(Optional locale) { + Utils.checkNotNull(locale, "locale"); + this.locale = locale; + return this; + } + + public CreateAgentRequestBuilder timezoneOffset(long timezoneOffset) { + Utils.checkNotNull(timezoneOffset, "timezoneOffset"); + this.timezoneOffset = Optional.of(timezoneOffset); + return this; + } + + public CreateAgentRequestBuilder timezoneOffset(Optional timezoneOffset) { + Utils.checkNotNull(timezoneOffset, "timezoneOffset"); + this.timezoneOffset = timezoneOffset; + return this; + } + + public CreateAgentRequestBuilder createWorkflowRequest(CreateWorkflowRequest createWorkflowRequest) { + Utils.checkNotNull(createWorkflowRequest, "createWorkflowRequest"); + this.createWorkflowRequest = createWorkflowRequest; + return this; + } + + + private CreateAgentRequest buildRequest() { + + CreateAgentRequest request = new CreateAgentRequest(locale, + timezoneOffset, + createWorkflowRequest); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new CreateAgent.Async(sdkConfiguration, _headers); + CreateAgentRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/async/CreateAgentResponse.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/async/CreateAgentResponse.java new file mode 100644 index 00000000..91c283e2 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/async/CreateAgentResponse.java @@ -0,0 +1,254 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 3d342a42df89 + */ +package com.glean.api_client.glean_api_client.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.glean.api_client.glean_api_client.models.components.WorkflowResult; +import com.glean.api_client.glean_api_client.utils.AsyncResponse; +import com.glean.api_client.glean_api_client.utils.Blob; +import com.glean.api_client.glean_api_client.utils.Utils; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; + + +public class CreateAgentResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional workflowResult; + + @JsonCreator + public CreateAgentResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional workflowResult) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(workflowResult, "workflowResult"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.workflowResult = workflowResult; + } + + public CreateAgentResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional workflowResult() { + return (Optional) workflowResult; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public CreateAgentResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public CreateAgentResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public CreateAgentResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public CreateAgentResponse withWorkflowResult(WorkflowResult workflowResult) { + Utils.checkNotNull(workflowResult, "workflowResult"); + this.workflowResult = Optional.ofNullable(workflowResult); + return this; + } + + + /** + * Success + */ + public CreateAgentResponse withWorkflowResult(Optional workflowResult) { + Utils.checkNotNull(workflowResult, "workflowResult"); + this.workflowResult = workflowResult; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAgentResponse other = (CreateAgentResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.workflowResult, other.workflowResult); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + workflowResult); + } + + @Override + public String toString() { + return Utils.toString(CreateAgentResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "workflowResult", workflowResult); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional workflowResult = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder workflowResult(WorkflowResult workflowResult) { + Utils.checkNotNull(workflowResult, "workflowResult"); + this.workflowResult = Optional.ofNullable(workflowResult); + return this; + } + + /** + * Success + */ + public Builder workflowResult(Optional workflowResult) { + Utils.checkNotNull(workflowResult, "workflowResult"); + this.workflowResult = workflowResult; + return this; + } + + public CreateAgentResponse build() { + + return new CreateAgentResponse( + contentType, statusCode, rawResponse, + workflowResult); + } + + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/CreateAgent.java b/src/main/java/com/glean/api_client/glean_api_client/operations/CreateAgent.java new file mode 100644 index 00000000..17a52b03 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/CreateAgent.java @@ -0,0 +1,266 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 7aa85409b860 + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; +import static com.glean.api_client.glean_api_client.utils.Exceptions.unchecked; +import static com.glean.api_client.glean_api_client.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.glean.api_client.glean_api_client.SDKConfiguration; +import com.glean.api_client.glean_api_client.SecuritySource; +import com.glean.api_client.glean_api_client.models.components.WorkflowResult; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.CreateAgentRequest; +import com.glean.api_client.glean_api_client.models.operations.CreateAgentResponse; +import com.glean.api_client.glean_api_client.utils.Blob; +import com.glean.api_client.glean_api_client.utils.HTTPClient; +import com.glean.api_client.glean_api_client.utils.HTTPRequest; +import com.glean.api_client.glean_api_client.utils.Headers; +import com.glean.api_client.glean_api_client.utils.Hook.AfterErrorContextImpl; +import com.glean.api_client.glean_api_client.utils.Hook.AfterSuccessContextImpl; +import com.glean.api_client.glean_api_client.utils.Hook.BeforeRequestContextImpl; +import com.glean.api_client.glean_api_client.utils.SerializedBody; +import com.glean.api_client.glean_api_client.utils.Utils.JsonShape; +import com.glean.api_client.glean_api_client.utils.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; + + +public class CreateAgent { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = Utils.templateUrl( + this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createAgent", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createAgent", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createAgent", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/agents"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "createWorkflowRequest", + "json", + false); + if (serializedRequestBody == null) { + throw new IllegalArgumentException("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + + req.addQueryParams(Utils.getQueryParams( + klass, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(CreateAgentRequest request) throws Exception { + HttpRequest req = buildRequest(request, CreateAgentRequest.class, new TypeReference() {}); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(CreateAgentRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public CreateAgentResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreateAgentResponse.Builder resBuilder = + CreateAgentResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + CreateAgentResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withWorkflowResult(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "4XX")) { + // no content + throw APIException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { + // no content + throw APIException.from("API error occurred", response); + } + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(CreateAgentRequest request) throws Exception { + HttpRequest req = buildRequest(request, CreateAgentRequest.class, new TypeReference() {}); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(CreateAgentRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + com.glean.api_client.glean_api_client.models.operations.async.CreateAgentResponse.Builder resBuilder = + com.glean.api_client.glean_api_client.models.operations.async.CreateAgentResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + com.glean.api_client.glean_api_client.models.operations.async.CreateAgentResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withWorkflowResult); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} From 8e34eb6825fb7c34bc433a977e3d6f3efad1b7af Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Thu, 11 Jun 2026 04:48:52 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow