diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 2aed8a27..92366086 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 0359d4fe-2923-46fc-aaca-cf70b48dcfa1 management: - docChecksum: bb65a174a6b697994f7bde3845843d9d + docChecksum: b0738d0775f5848e1288d7ca6b0400e4 docVersion: 0.9.0 - speakeasyVersion: 1.580.2 - generationVersion: 2.656.5 - releaseVersion: 0.7.0 - configChecksum: 5763d80380dc0fbbb84875250841f11a + speakeasyVersion: 1.603.0 + generationVersion: 2.681.1 + releaseVersion: 0.8.0 + configChecksum: 9d45cfc637ac0c88f5647f855791005b repoURL: https://github.com/gleanwork/api-client-java.git published: true features: @@ -14,7 +14,7 @@ features: additionalDependencies: 0.1.0 additionalProperties: 0.0.1 constsAndDefaults: 0.1.1 - core: 3.44.0 + core: 3.45.3 deprecations: 2.81.1 examples: 2.81.6 flattening: 2.81.1 @@ -376,6 +376,10 @@ generatedFiles: - docs/models/components/ListShortcutsPaginatedResponse.md - docs/models/components/ManualFeedbackInfo.md - docs/models/components/ManualFeedbackInfoSource.md + - docs/models/components/ManualFeedbackInfoVote.md + - docs/models/components/ManualFeedbackSideBySideInfo.md + - docs/models/components/ManualFeedbackSideBySideInfoSource.md + - docs/models/components/ManualFeedbackSideBySideInfoVote.md - docs/models/components/Meeting.md - docs/models/components/Message.md - docs/models/components/MessageTextBlock.md @@ -442,6 +446,7 @@ generatedFiles: - docs/models/components/ReportStatusResponseStatus.md - docs/models/components/RequestType.md - docs/models/components/ResponseHint.md + - docs/models/components/ResponseMetadata.md - docs/models/components/ResponseStatus.md - docs/models/components/RestrictionFilters.md - docs/models/components/ResultDocument.md @@ -479,6 +484,7 @@ generatedFiles: - docs/models/components/ShortcutInsightsResponse.md - docs/models/components/ShortcutMutableProperties.md - docs/models/components/ShortcutsPaginationMetadata.md + - docs/models/components/SideBySideImplementation.md - docs/models/components/SocialNetwork.md - docs/models/components/SocialNetworkDefinition.md - docs/models/components/SortOptions.md @@ -554,7 +560,6 @@ generatedFiles: - docs/models/components/VerifyRequest.md - docs/models/components/VerifyRequestAction.md - docs/models/components/ViewerInfo.md - - docs/models/components/Vote.md - docs/models/components/WarningType.md - docs/models/components/Workflow.md - docs/models/components/WorkflowFeedbackInfo.md @@ -1116,6 +1121,10 @@ generatedFiles: - src/main/java/com/glean/api_client/glean_api_client/models/components/ListShortcutsPaginatedResponse.java - src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackInfo.java - src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackInfoSource.java + - src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackInfoVote.java + - src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackSideBySideInfo.java + - src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackSideBySideInfoSource.java + - src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackSideBySideInfoVote.java - src/main/java/com/glean/api_client/glean_api_client/models/components/Meeting.java - src/main/java/com/glean/api_client/glean_api_client/models/components/Message.java - src/main/java/com/glean/api_client/glean_api_client/models/components/MessageTextBlock.java @@ -1182,6 +1191,7 @@ generatedFiles: - src/main/java/com/glean/api_client/glean_api_client/models/components/ReportStatusResponseStatus.java - src/main/java/com/glean/api_client/glean_api_client/models/components/RequestType.java - src/main/java/com/glean/api_client/glean_api_client/models/components/ResponseHint.java + - src/main/java/com/glean/api_client/glean_api_client/models/components/ResponseMetadata.java - src/main/java/com/glean/api_client/glean_api_client/models/components/ResponseStatus.java - src/main/java/com/glean/api_client/glean_api_client/models/components/RestrictionFilters.java - src/main/java/com/glean/api_client/glean_api_client/models/components/ResultDocument.java @@ -1219,6 +1229,7 @@ generatedFiles: - src/main/java/com/glean/api_client/glean_api_client/models/components/ShortcutInsightsResponse.java - src/main/java/com/glean/api_client/glean_api_client/models/components/ShortcutMutableProperties.java - src/main/java/com/glean/api_client/glean_api_client/models/components/ShortcutsPaginationMetadata.java + - src/main/java/com/glean/api_client/glean_api_client/models/components/SideBySideImplementation.java - src/main/java/com/glean/api_client/glean_api_client/models/components/SocialNetwork.java - src/main/java/com/glean/api_client/glean_api_client/models/components/SocialNetworkDefinition.java - src/main/java/com/glean/api_client/glean_api_client/models/components/SortOptions.java @@ -1294,7 +1305,6 @@ generatedFiles: - src/main/java/com/glean/api_client/glean_api_client/models/components/VerifyRequest.java - src/main/java/com/glean/api_client/glean_api_client/models/components/VerifyRequestAction.java - src/main/java/com/glean/api_client/glean_api_client/models/components/ViewerInfo.java - - src/main/java/com/glean/api_client/glean_api_client/models/components/Vote.java - src/main/java/com/glean/api_client/glean_api_client/models/components/WarningType.java - src/main/java/com/glean/api_client/glean_api_client/models/components/Workflow.java - src/main/java/com/glean/api_client/glean_api_client/models/components/WorkflowFeedbackInfo.java @@ -1554,116 +1564,116 @@ generatedFiles: - src/main/java/com/glean/api_client/glean_api_client/models/operations/UploadchatfilesResponse.java - src/main/java/com/glean/api_client/glean_api_client/models/operations/VerifyRequestBuilder.java - src/main/java/com/glean/api_client/glean_api_client/models/operations/VerifyResponse.java - - src/main/java/com/glean/api_client/glean_api_client/operations/ActivityOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/AddcollectionitemsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/AddverificationreminderOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/AdminsearchOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/AutocompleteOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/ChatOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/ChatStreamOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/CreateAndStreamRunOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/CreateAndWaitRunOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/CreateannouncementOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/CreateanswerOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/CreateauthtokenOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/CreatecollectionOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/CreatepolicyOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/CreatereportOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/CreateshortcutOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/DeleteallchatsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/DeleteannouncementOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/DeleteanswerOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/DeletechatfilesOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/DeletechatsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/DeletecollectionOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/DeletecollectionitemOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/DeleteshortcutOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/DownloadpolicycsvOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/DownloadreportcsvOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/EditanswerOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/EditcollectionOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/EditcollectionitemOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/EditpinOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/FeedOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/FeedbackOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/GetAgentOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/GetAgentSchemasOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/GetRestApiV1ToolsListOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/GetanswerOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/GetchatOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/GetchatapplicationOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/GetchatfilesOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/GetcollectionOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/GetdocpermissionsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/GetdocumentsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/GetdocumentsbyfacetsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/GetdocvisibilityOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/GetpinOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/GetpolicyOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/GetreportstatusOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/GetshortcutOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/InsightsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/ListanswersOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/ListchatsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/ListcollectionsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/ListentitiesOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/ListpinsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/ListpoliciesOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/ListshortcutsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/ListverificationsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/MessagesOperation.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Activity.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Addcollectionitems.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Addverificationreminder.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Adminsearch.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Autocomplete.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Chat.java + - src/main/java/com/glean/api_client/glean_api_client/operations/ChatStream.java + - src/main/java/com/glean/api_client/glean_api_client/operations/CreateAndStreamRun.java + - src/main/java/com/glean/api_client/glean_api_client/operations/CreateAndWaitRun.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Createannouncement.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Createanswer.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Createauthtoken.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Createcollection.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Createpolicy.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Createreport.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Createshortcut.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Deleteallchats.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Deleteannouncement.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Deleteanswer.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Deletechatfiles.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Deletechats.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Deletecollection.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Deletecollectionitem.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Deleteshortcut.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Downloadpolicycsv.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Downloadreportcsv.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Editanswer.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Editcollection.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Editcollectionitem.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Editpin.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Feed.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Feedback.java + - src/main/java/com/glean/api_client/glean_api_client/operations/GetAgent.java + - src/main/java/com/glean/api_client/glean_api_client/operations/GetAgentSchemas.java + - src/main/java/com/glean/api_client/glean_api_client/operations/GetRestApiV1ToolsList.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Getanswer.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Getchat.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Getchatapplication.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Getchatfiles.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Getcollection.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Getdocpermissions.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Getdocuments.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Getdocumentsbyfacets.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Getdocvisibility.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Getpin.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Getpolicy.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Getreportstatus.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Getshortcut.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Insights.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Listanswers.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Listchats.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Listcollections.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Listentities.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Listpins.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Listpolicies.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Listshortcuts.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Listverifications.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Messages.java - src/main/java/com/glean/api_client/glean_api_client/operations/Operations.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PeopleOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PinOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1AdddatasourceOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BetausersOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexdocumentsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexemployeesOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexgroupsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexmembershipsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexshortcutsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexteamsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexusersOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1CheckdocumentaccessOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceDocumentOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceDocumentsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceStatusOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceUserOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeletedocumentOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeleteemployeeOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeletegroupOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeletemembershipOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeleteteamOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeleteuserOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1GetdatasourceconfigOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1GetdocumentcountOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1GetdocumentstatusOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1GetusercountOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexdocumentOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexdocumentsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexemployeeOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexgroupOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexmembershipOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexteamOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexuserOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1ProcessalldocumentsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1ProcessallemployeesandteamsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1ProcessallmembershipsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1RotatetokenOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1UpdatepermissionsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1UploadshortcutsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/PostRestApiV1ToolsCallOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/RecommendationsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/SearchAgentsOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/SearchOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/SetdocvisibilityOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/SummarizeOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/UnpinOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/UpdateannouncementOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/UpdatepolicyOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/UpdateshortcutOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/UploadchatfilesOperation.java - - src/main/java/com/glean/api_client/glean_api_client/operations/VerifyOperation.java + - src/main/java/com/glean/api_client/glean_api_client/operations/People.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Pin.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Adddatasource.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Betausers.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexdocuments.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexemployees.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexgroups.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexmemberships.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexshortcuts.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexteams.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexusers.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Checkdocumentaccess.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceDocument.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceDocuments.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceStatus.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceUser.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deletedocument.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deleteemployee.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deletegroup.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deletemembership.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deleteteam.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deleteuser.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Getdatasourceconfig.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Getdocumentcount.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Getdocumentstatus.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Getusercount.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexdocument.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexdocuments.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexemployee.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexgroup.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexmembership.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexteam.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexuser.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Processalldocuments.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Processallemployeesandteams.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Processallmemberships.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Rotatetoken.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Updatepermissions.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Uploadshortcuts.java + - src/main/java/com/glean/api_client/glean_api_client/operations/PostRestApiV1ToolsCall.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Recommendations.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Search.java + - src/main/java/com/glean/api_client/glean_api_client/operations/SearchAgents.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Setdocvisibility.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Summarize.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Unpin.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Updateannouncement.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Updatepolicy.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Updateshortcut.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Uploadchatfiles.java + - src/main/java/com/glean/api_client/glean_api_client/operations/Verify.java - src/main/java/com/glean/api_client/glean_api_client/utils/BackoffStrategy.java - src/main/java/com/glean/api_client/glean_api_client/utils/BigDecimalString.java - src/main/java/com/glean/api_client/glean_api_client/utils/BigIntegerString.java @@ -1701,6 +1711,7 @@ generatedFiles: - src/main/java/com/glean/api_client/glean_api_client/utils/RequestBody.java - src/main/java/com/glean/api_client/glean_api_client/utils/RequestMetadata.java - src/main/java/com/glean/api_client/glean_api_client/utils/Response.java + - src/main/java/com/glean/api_client/glean_api_client/utils/ResponseWithBody.java - src/main/java/com/glean/api_client/glean_api_client/utils/Retries.java - src/main/java/com/glean/api_client/glean_api_client/utils/RetryConfig.java - src/main/java/com/glean/api_client/glean_api_client/utils/Security.java @@ -2116,6 +2127,7 @@ generatedFiles: - tests/mockserver/internal/sdk/models/components/listshortcutspaginatedrequest.go - tests/mockserver/internal/sdk/models/components/listshortcutspaginatedresponse.go - tests/mockserver/internal/sdk/models/components/manualfeedbackinfo.go + - tests/mockserver/internal/sdk/models/components/manualfeedbacksidebysideinfo.go - tests/mockserver/internal/sdk/models/components/meeting.go - tests/mockserver/internal/sdk/models/components/message.go - tests/mockserver/internal/sdk/models/components/messagesrequest.go @@ -2194,6 +2206,7 @@ generatedFiles: - tests/mockserver/internal/sdk/models/components/shortcutinsightsresponse.go - tests/mockserver/internal/sdk/models/components/shortcutmutableproperties.go - tests/mockserver/internal/sdk/models/components/shortcutspaginationmetadata.go + - tests/mockserver/internal/sdk/models/components/sidebysideimplementation.go - tests/mockserver/internal/sdk/models/components/socialnetwork.go - tests/mockserver/internal/sdk/models/components/socialnetworkdefinition.go - tests/mockserver/internal/sdk/models/components/sortoptions.go diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 97870990..41926e67 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -21,7 +21,7 @@ generation: generateNewTests: false skipResponseBodyAssertions: false java: - version: 0.7.0 + version: 0.8.0 additionalDependencies: [] additionalPlugins: [] artifactID: glean-api-client @@ -31,6 +31,7 @@ java: companyName: Glean companyURL: https://www.glean.com defaultErrorName: APIException + enableAsync: false enableCustomCodeRegions: false envVarPrefix: GLEAN flattenGlobalSecurity: true diff --git a/.speakeasy/glean-merged-spec.yaml b/.speakeasy/glean-merged-spec.yaml index e41f9253..e77a6900 100644 --- a/.speakeasy/glean-merged-spec.yaml +++ b/.speakeasy/glean-merged-spec.yaml @@ -2245,7 +2245,7 @@ paths: /api/index/v1/indexdocuments: post: summary: Index documents - description: Adds or updates multiple documents in the index. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#choosing-indexdocuments-vs-bulkindexdocuments) documentation for an explanation of when to use this endpoint. + description: Adds or updates multiple documents in the index. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-indexing/choosing-indexdocuments-vs-bulkindexdocuments) documentation for an explanation of when to use this endpoint. tags: - Documents requestBody: @@ -2271,7 +2271,7 @@ paths: /api/index/v1/bulkindexdocuments: post: summary: Bulk index documents - description: Replaces the documents in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + description: Replaces the documents in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. tags: - Documents requestBody: @@ -2403,7 +2403,7 @@ paths: /api/index/v1/bulkindexusers: post: summary: Bulk index users - description: Replaces the users in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + description: Replaces the users in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. tags: - Permissions requestBody: @@ -2451,7 +2451,7 @@ paths: /api/index/v1/bulkindexgroups: post: summary: Bulk index groups - description: Replaces the groups in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + description: Replaces the groups in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. tags: - Permissions requestBody: @@ -2499,7 +2499,7 @@ paths: /api/index/v1/bulkindexmemberships: post: summary: Bulk index memberships for a group - description: Replaces the memberships for a group in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + description: Replaces the memberships for a group in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. tags: - Permissions requestBody: @@ -2622,7 +2622,7 @@ paths: description: | Gather information about the datasource's overall status. Currently in beta, might undergo breaking changes without prior notice. - Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. + Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. tags: - Troubleshooting parameters: @@ -2653,7 +2653,7 @@ paths: description: | Gives various information that would help in debugging related to a particular document. Currently in beta, might undergo breaking changes without prior notice. - Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. + Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. tags: - Troubleshooting parameters: @@ -2691,7 +2691,7 @@ paths: description: | Gives various information that would help in debugging related to a batch of documents. Currently in beta, might undergo breaking changes without prior notice. - Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. + Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. tags: - Troubleshooting parameters: @@ -2729,7 +2729,7 @@ paths: description: | Gives various information that would help in debugging related to a particular user. Currently in beta, might undergo breaking changes without prior notice. - Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. + Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. tags: - Troubleshooting parameters: @@ -2765,7 +2765,7 @@ paths: description: | Check if a given user has access to access a document in a custom datasource - Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. + Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. tags: - Troubleshooting requestBody: @@ -2797,7 +2797,7 @@ paths: description: | Intended for debugging/validation. Fetches the current upload and indexing status of documents. - Tip: Use [/debug/{datasource}/document](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/#debug-datasource-document) for richer information. + Tip: Use [/debug/{datasource}/document](https://developers.glean.com/indexing/debugging/datasource-document) for richer information. tags: - Troubleshooting requestBody: @@ -2829,7 +2829,7 @@ paths: description: | Fetches document count for the specified custom datasource. - Tip: Use [/debug/{datasource}/status](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/#debug-datasource-status) for richer information. + Tip: Use [/debug/{datasource}/status](https://developers.glean.com/indexing/debugging/datasource-status) for richer information. tags: - Troubleshooting requestBody: @@ -2861,7 +2861,7 @@ paths: description: | Fetches user count for the specified custom datasource. - Tip: Use [/debug/{datasource}/status](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/#debug-datasource-status) for richer information. + Tip: Use [/debug/{datasource}/status](https://developers.glean.com/indexing/debugging/datasource-status) for richer information. tags: - Troubleshooting requestBody: @@ -2963,7 +2963,7 @@ paths: /api/index/v1/rotatetoken: post: summary: Rotate token - description: Rotates the secret value inside the Indexing API token and returns the new raw secret. All other properties of the token are unchanged. In order to rotate the secret value, include the token as the bearer token in the `/rotatetoken` request. Please refer to [Token rotation](https://developers.glean.com/docs/indexing_api_token_rotation/) documentation for more information. + description: Rotates the secret value inside the Indexing API token and returns the new raw secret. All other properties of the token are unchanged. In order to rotate the secret value, include the token as the bearer token in the `/rotatetoken` request. Please refer to [Token rotation](https://developers.glean.com/indexing/authentication/token-rotation) documentation for more information. tags: - Authentication responses: @@ -3006,7 +3006,7 @@ paths: /api/index/v1/bulkindexemployees: post: summary: Bulk index employees - description: Replaces all the currently indexed employees using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + description: Replaces all the currently indexed employees using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. tags: - People requestBody: @@ -3121,7 +3121,7 @@ paths: /api/index/v1/bulkindexteams: post: summary: Bulk index teams - description: Replaces all the currently indexed teams using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + description: Replaces all the currently indexed teams using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. tags: - People requestBody: @@ -3868,6 +3868,71 @@ components: ratingScale: type: integer description: The scale of comparison for a rating associated with the feedback. Rating values start from one and go up to the maximum specified by ratingScale. For example, a five-option satisfaction rating will have a ratingScale of 5 and a thumbs-up/thumbs-down rating will have a ratingScale of 2. + SideBySideImplementation: + properties: + implementationId: + type: string + description: Unique identifier for this implementation variant. + implementationName: + type: string + description: Human-readable name for this implementation (e.g., "Variant A", "GPT-4", "Claude"). + searchParams: + type: object + description: The search/chat parameters used for this implementation. + additionalProperties: + type: string + response: + type: string + description: The full response generated by this implementation. + responseMetadata: + type: object + description: Metadata about the response (e.g., latency, token count). + properties: + latencyMs: + type: integer + description: Time taken to generate the response in milliseconds. + tokenCount: + type: integer + description: Number of tokens in the response. + modelUsed: + type: string + description: The specific model version used. + ManualFeedbackSideBySideInfo: + properties: + email: + type: string + description: The email address of the user who submitted the side-by-side feedback. + source: + type: string + description: The source associated with the side-by-side feedback event. + enum: + - LIVE_EVAL + - CHAT + - SEARCH + query: + type: string + description: The query or prompt that was evaluated across multiple implementations. + implementations: + type: array + description: Array of implementations that were compared side-by-side. + items: + $ref: "#/components/schemas/SideBySideImplementation" + evaluationSessionId: + type: string + description: Unique identifier for this evaluation session to group related feedback events. + implementationId: + type: string + description: The ID of the implementation this specific feedback event is for. + vote: + type: string + description: The vote for this specific implementation. + enum: + - UPVOTE + - DOWNVOTE + - NEUTRAL + comments: + type: string + description: Specific feedback comments for this implementation. SeenFeedbackInfo: properties: isExplicit: @@ -3938,6 +4003,7 @@ components: FOCUS_IN: The user clicked into an interactive element, e.g. the search box. LAST_TOKEN: The final token of a streaming response is received. MANUAL_FEEDBACK: The user submitted textual manual feedback regarding the object. + MANUAL_FEEDBACK_SIDE_BY_SIDE: The user submitted comparative feedback for multiple side-by-side implementations. MARK_AS_READ: The user explicitly marked the content as read. MESSAGE: The user attempted to send a message using their default messaing app. MIDDLE_CLICK: The user middle clicked the object's primary link with the intent to open its full representation in a new tab. @@ -3967,6 +4033,7 @@ components: - FOCUS_IN - LAST_TOKEN - MANUAL_FEEDBACK + - MANUAL_FEEDBACK_SIDE_BY_SIDE - MARK_AS_READ - MESSAGE - MIDDLE_CLICK @@ -4021,6 +4088,8 @@ components: description: The UI element associated with the event, if any. manualFeedbackInfo: $ref: "#/components/schemas/ManualFeedbackInfo" + manualFeedbackSideBySideInfo: + $ref: "#/components/schemas/ManualFeedbackSideBySideInfo" seenFeedbackInfo: $ref: "#/components/schemas/SeenFeedbackInfo" userViewInfo: @@ -5395,6 +5464,68 @@ components: description: The document's document_category(.proto). sourceDocument: $ref: "#/components/schemas/Document" + FollowupAction: + description: A follow-up action that can be invoked by the user after a response. The action parameters are not included and need to be predicted/filled separately. + properties: + actionRunId: + type: string + description: Unique identifier for this actionRun recommendation event. + actionInstanceId: + type: string + description: The ID of the action instance that will be invoked. + actionId: + type: string + description: The ID of the associated action. + recommendationText: + type: string + description: Text to be displayed to the user when recommending the action instance. + actionLabel: + type: string + description: The label to be used when displaying a button to execute this action instance. + userConfirmationRequired: + type: boolean + description: Whether user confirmation is needed before executing this action instance. + GeneratedQna: + properties: + question: + type: string + description: Search query rephrased into a question. + answer: + type: string + description: Answer generated for the given query or the generated question. + followUpPrompts: + type: array + items: + type: string + description: List of all follow-up prompts generated for the given query or the generated question. + followupActions: + description: List of follow-up actions generated for the given query or the generated question. + type: array + items: + $ref: "#/components/schemas/FollowupAction" + ranges: + type: array + items: + $ref: "#/components/schemas/TextRange" + description: Answer subsections to mark with special formatting (citations, bolding etc) + status: + type: string + enum: + - COMPUTING + - DISABLED + - FAILED + - NO_ANSWER + - SKIPPED + - STREAMING + - SUCCEEDED + - TIMEOUT + description: Status of backend generating the answer + cursor: + type: string + description: An opaque cursor representing the search request + trackingToken: + type: string + description: An opaque token that represents this particular result in this particular query. To be used for /feedback reporting. SearchResult: required: - url @@ -5748,6 +5879,8 @@ components: $ref: "#/components/schemas/CustomEntity" answer: $ref: "#/components/schemas/Answer" + generatedQna: + $ref: "#/components/schemas/GeneratedQna" extractedQnA: $ref: "#/components/schemas/ExtractedQnA" meeting: @@ -6994,6 +7127,7 @@ components: enum: - AWAITING_AUTH - AUTHORIZED + - AUTH_DISABLED client_url: type: string format: url @@ -7162,6 +7296,9 @@ components: action: description: Basic information about an action. This can be used to construct rich-text messages with action references. $ref: "#/components/schemas/ToolInfo" + citation: + description: Inline citation. + $ref: "#/components/schemas/ChatMessageCitation" ChatMessage: description: A message that is rendered as one coherent unit with one given sender. properties: @@ -7169,7 +7306,7 @@ components: $ref: "#/components/schemas/AgentConfig" description: Describes the agent config that generated this message. Populated on responses and not required on requests. author: - default: USER + default: GLEAN_AI enum: - USER - GLEAN_AI @@ -7248,7 +7385,7 @@ components: description: The id of the Chat that context should be retrieved from and messages added to. An empty id starts a new Chat, and the Chat is saved if saveChat is true. messages: type: array - description: A list of chat messages, from most recent to least recent. It can be assumed that the first chat message in the list is the user's most recent query. + description: A list of chat messages, from most recent to least recent. At least one message must specify a USER author. items: $ref: "#/components/schemas/ChatMessage" agentConfig: @@ -8277,68 +8414,6 @@ components: datasourceInstanceDisplayName: type: string description: The datasource instance display name from which the document was extracted. This is used for appinstance facet filter for datasources that support multiple instances. - FollowupAction: - description: A follow-up action that can be invoked by the user after a response. The action parameters are not included and need to be predicted/filled separately. - properties: - actionRunId: - type: string - description: Unique identifier for this actionRun recommendation event. - actionInstanceId: - type: string - description: The ID of the action instance that will be invoked. - actionId: - type: string - description: The ID of the associated action. - recommendationText: - type: string - description: Text to be displayed to the user when recommending the action instance. - actionLabel: - type: string - description: The label to be used when displaying a button to execute this action instance. - userConfirmationRequired: - type: boolean - description: Whether user confirmation is needed before executing this action instance. - GeneratedQna: - properties: - question: - type: string - description: Search query rephrased into a question. - answer: - type: string - description: Answer generated for the given query or the generated question. - followUpPrompts: - type: array - items: - type: string - description: List of all follow-up prompts generated for the given query or the generated question. - followupActions: - description: List of follow-up actions generated for the given query or the generated question. - type: array - items: - $ref: "#/components/schemas/FollowupAction" - ranges: - type: array - items: - $ref: "#/components/schemas/TextRange" - description: Answer subsections to mark with special formatting (citations, bolding etc) - status: - type: string - enum: - - COMPUTING - - DISABLED - - FAILED - - NO_ANSWER - - SKIPPED - - STREAMING - - SUCCEEDED - - TIMEOUT - description: Status of backend generating the answer - cursor: - type: string - description: An opaque cursor representing the search request - trackingToken: - type: string - description: An opaque token that represents this particular result in this particular query. To be used for /feedback reporting. InvalidOperatorValueError: properties: key: @@ -8441,6 +8516,10 @@ components: searchedQuery: type: string description: The actual query used to perform search and return results. + searchedQueryWithoutNegation: + type: string + description: The query used to perform search and return results, with negated terms and facets removed. + x-includeEmpty: true searchedQueryRanges: type: array items: @@ -8765,11 +8844,6 @@ components: type: integer description: Timeout in milliseconds for the request. A `408` error will be returned if handling the request takes longer. example: 5000 - people: - type: array - description: People associated with the search request. Hints to the server to fetch additional information for these people. Note that in this request, an email may be used as a person's obfuscatedId value. - items: - $ref: "#/components/schemas/Person" disableSpellcheck: type: boolean description: Whether or not to disable spellcheck. @@ -10118,7 +10192,7 @@ components: The permalink for viewing the document. **Note: viewURL is a required field if id was not set when uploading the document.**' permissions: $ref: "#/components/schemas/DocumentPermissionsDefinition" - description: The permissions that define who can view this document in the search results. Please refer to [this](https://developers.glean.com/docs/indexing_api_permissions/) for more details. + description: The permissions that define who can view this document in the search results. Please refer to [this](https://developers.glean.com/indexing/documents/permissions) for more details. required: - permissions - datasource @@ -10620,7 +10694,7 @@ components: description: The current owner of the document, if not the author. permissions: $ref: "#/components/schemas/DocumentPermissionsDefinition" - description: The permissions that define who can view this document in the search results. Please refer to [this](https://developers.glean.com/docs/indexing_api_permissions/) for more details. + description: The permissions that define who can view this document in the search results. Please refer to [this](https://developers.glean.com/indexing/documents/permissions) for more details. createdAt: type: integer format: int64 @@ -10654,7 +10728,7 @@ components: type: array items: $ref: "#/components/schemas/CustomProperty" - description: Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/docs/facets_and_operators_for_custom_datasources/). + description: Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/indexing/datasource/custom-properties/operators_and_facets). required: - datasource CommentDefinition: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 031541ed..a497915b 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,12 +1,12 @@ -speakeasyVersion: 1.580.2 +speakeasyVersion: 1.603.0 sources: Glean API: sourceNamespace: glean-api-specs - sourceRevisionDigest: sha256:57fc6af98e6e9e98c92547985293be8fafd52d2a1d1ef88d4b24636743b9f119 - sourceBlobDigest: sha256:01cf4577ff2f15ba160b16bba410571a8ba0c5fefa7e6dd7101edef7ef7c68dc + sourceRevisionDigest: sha256:8f18d79a0a7d8f51de7edd5bc8ca3ccc569b81832ffc44ce95a27a12e67b9b7d + sourceBlobDigest: sha256:bb3e5a453f03cbdecf3fb3925768ef4cb0b3119083d9d36c341e1ecd721cde8b tags: - latest - - speakeasy-sdk-regen-1751974088 + - speakeasy-sdk-regen-1752597383 Glean-OAS: sourceNamespace: glean-oas sourceRevisionDigest: sha256:8841834dd58ddd4e2dcf98fc90fbd06fbf3626a29df941503cce55b9548a5317 @@ -18,10 +18,10 @@ targets: glean: source: Glean API sourceNamespace: glean-api-specs - sourceRevisionDigest: sha256:57fc6af98e6e9e98c92547985293be8fafd52d2a1d1ef88d4b24636743b9f119 - sourceBlobDigest: sha256:01cf4577ff2f15ba160b16bba410571a8ba0c5fefa7e6dd7101edef7ef7c68dc + sourceRevisionDigest: sha256:8f18d79a0a7d8f51de7edd5bc8ca3ccc569b81832ffc44ce95a27a12e67b9b7d + sourceBlobDigest: sha256:bb3e5a453f03cbdecf3fb3925768ef4cb0b3119083d9d36c341e1ecd721cde8b codeSamplesNamespace: glean-api-specs-java-code-samples - codeSamplesRevisionDigest: sha256:696df3780275658d9e4fab559fceb2dc36adeff8f6055db8303641ed1f4e7d6c + codeSamplesRevisionDigest: sha256:e2f179bd27ebe8ef2e5db4899dbce44b41be5a1a46f7d62f7df45af109b6df27 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 3eae6223..46bfb248 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ The samples below show how a published SDK artifact is used: Gradle: ```groovy -implementation 'com.glean.api-client:glean-api-client:0.7.0' +implementation 'com.glean.api-client:glean-api-client:0.8.0' ``` Maven: @@ -71,7 +71,7 @@ Maven: com.glean.api-client glean-api-client - 0.7.0 + 0.8.0 ``` @@ -116,6 +116,7 @@ public class Application { .chatRequest(ChatRequest.builder() .messages(List.of( ChatMessage.builder() + .author(Author.USER) .fragments(List.of( ChatMessageFragment.builder() .text("What are the company holidays this year?") @@ -154,6 +155,7 @@ public class Application { .chatRequest(ChatRequest.builder() .messages(List.of( ChatMessage.builder() + .author(Author.USER) .fragments(List.of( ChatMessageFragment.builder() .text("What are the company holidays this year?") diff --git a/RELEASES.md b/RELEASES.md index 5c84faf6..3d1c4c06 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -178,4 +178,14 @@ Based on: ### Generated - [java v0.7.0] . ### Releases -- [Maven Central v0.7.0] https://central.sonatype.com/artifact/com.glean.api-client/glean-api-client/0.7.0 - . \ No newline at end of file +- [Maven Central v0.7.0] https://central.sonatype.com/artifact/com.glean.api-client/glean-api-client/0.7.0 - . + +## 2025-08-12 20:06:24 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.603.0 (2.681.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [java v0.8.0] . +### Releases +- [Maven Central v0.8.0] https://central.sonatype.com/artifact/com.glean.api-client/glean-api-client/0.8.0 - . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md index 7b772ec3..19e44e91 100644 --- a/USAGE.md +++ b/USAGE.md @@ -20,6 +20,7 @@ public class Application { .chatRequest(ChatRequest.builder() .messages(List.of( ChatMessage.builder() + .author(Author.USER) .fragments(List.of( ChatMessageFragment.builder() .text("What are the company holidays this year?") @@ -56,6 +57,7 @@ public class Application { .chatRequest(ChatRequest.builder() .messages(List.of( ChatMessage.builder() + .author(Author.USER) .fragments(List.of( ChatMessageFragment.builder() .text("What are the company holidays this year?") diff --git a/build.gradle b/build.gradle index 9241f163..294210a3 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ plugins { id 'maven-publish' id 'signing' id 'cl.franciscosolis.sonatype-central-upload' version '1.0.3' - id "com.adarshr.test-logger" version "3.2.0" + id "com.adarshr.test-logger" version "4.0.0" } compileJava.options.encoding = "UTF-8" @@ -60,7 +60,7 @@ javadoc { } tasks.withType(Javadoc) { - failOnError false + failOnError = false options.addStringOption('Xdoclint:none', '-quiet') } @@ -106,7 +106,7 @@ publishing { // https://github.com/gradle/gradle/issues/18619 groupId = "com.glean.api-client" artifactId = "glean-api-client" - version = "0.7.0" + version = "0.8.0" from components.java @@ -160,7 +160,7 @@ tasks.named('test') { } testlogger { - showStandardStreams true + showStandardStreams = true } test { diff --git a/docs/models/components/AuthConfigStatus.md b/docs/models/components/AuthConfigStatus.md index 0b010bdf..60f45500 100644 --- a/docs/models/components/AuthConfigStatus.md +++ b/docs/models/components/AuthConfigStatus.md @@ -8,4 +8,5 @@ Auth status of the tool. | Name | Value | | --------------- | --------------- | | `AWAITING_AUTH` | AWAITING_AUTH | -| `AUTHORIZED` | AUTHORIZED | \ No newline at end of file +| `AUTHORIZED` | AUTHORIZED | +| `AUTH_DISABLED` | AUTH_DISABLED | \ No newline at end of file diff --git a/docs/models/components/ChatMessageFragment.md b/docs/models/components/ChatMessageFragment.md index 95123f67..6bec6e75 100644 --- a/docs/models/components/ChatMessageFragment.md +++ b/docs/models/components/ChatMessageFragment.md @@ -12,4 +12,5 @@ Represents a part of a ChatMessage that originates from a single action/tool. It | `text` | *Optional\* | :heavy_minus_sign: | N/A | | | `querySuggestion` | [Optional\](../../models/components/QuerySuggestion.md) | :heavy_minus_sign: | N/A | {
"query": "app:github type:pull author:mortimer",
"label": "Mortimer's PRs",
"datasource": "github"
} | | `file` | [Optional\](../../models/components/ChatFile.md) | :heavy_minus_sign: | Structure for file uploaded by a user for Chat. | | -| `action` | [Optional\](../../models/components/ToolInfo.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| `action` | [Optional\](../../models/components/ToolInfo.md) | :heavy_minus_sign: | N/A | | +| `citation` | [Optional\](../../models/components/ChatMessageCitation.md) | :heavy_minus_sign: | Information about the source for a ChatMessage. | | \ No newline at end of file diff --git a/docs/models/components/ChatRequest.md b/docs/models/components/ChatRequest.md index 56da69e5..3fcaa43e 100644 --- a/docs/models/components/ChatRequest.md +++ b/docs/models/components/ChatRequest.md @@ -7,7 +7,7 @@ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `saveChat` | *Optional\* | :heavy_minus_sign: | Save the current interaction as a Chat for the user to access and potentially continue later. | | | `chatId` | *Optional\* | :heavy_minus_sign: | The id of the Chat that context should be retrieved from and messages added to. An empty id starts a new Chat, and the Chat is saved if saveChat is true. | | -| `messages` | List\<[ChatMessage](../../models/components/ChatMessage.md)> | :heavy_check_mark: | A list of chat messages, from most recent to least recent. It can be assumed that the first chat message in the list is the user's most recent query. | | +| `messages` | List\<[ChatMessage](../../models/components/ChatMessage.md)> | :heavy_check_mark: | A list of chat messages, from most recent to least recent. At least one message must specify a USER author. | | | `agentConfig` | [Optional\](../../models/components/AgentConfig.md) | :heavy_minus_sign: | Describes the agent that executes the request. | | | `inclusions` | [Optional\](../../models/components/ChatRestrictionFilters.md) | :heavy_minus_sign: | N/A | | | `exclusions` | [Optional\](../../models/components/ChatRestrictionFilters.md) | :heavy_minus_sign: | N/A | | diff --git a/docs/models/components/DocumentDefinition.md b/docs/models/components/DocumentDefinition.md index 8c28c399..9268058a 100644 --- a/docs/models/components/DocumentDefinition.md +++ b/docs/models/components/DocumentDefinition.md @@ -29,4 +29,4 @@ Indexable document structure | `status` | *Optional\* | :heavy_minus_sign: | N/A | | `additionalUrls` | List\<*String*> | :heavy_minus_sign: | Additional variations of the URL that this document points to. | | `comments` | List\<[CommentDefinition](../../models/components/CommentDefinition.md)> | :heavy_minus_sign: | Comments associated with the document. | -| `customProperties` | List\<[CustomProperty](../../models/components/CustomProperty.md)> | :heavy_minus_sign: | Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/docs/facets_and_operators_for_custom_datasources/). | \ No newline at end of file +| `customProperties` | List\<[CustomProperty](../../models/components/CustomProperty.md)> | :heavy_minus_sign: | Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/indexing/datasource/custom-properties/operators_and_facets). | \ No newline at end of file diff --git a/docs/models/components/Event.md b/docs/models/components/Event.md index d33c6f60..0970431d 100644 --- a/docs/models/components/Event.md +++ b/docs/models/components/Event.md @@ -5,34 +5,35 @@ The action the user took within a Glean client with respect to the object referr ## Values -| Name | Value | -| ----------------- | ----------------- | -| `CLICK` | CLICK | -| `CONTAINER_CLICK` | CONTAINER_CLICK | -| `COPY_LINK` | COPY_LINK | -| `CREATE` | CREATE | -| `DISMISS` | DISMISS | -| `DOWNVOTE` | DOWNVOTE | -| `EMAIL` | EMAIL | -| `EXECUTE` | EXECUTE | -| `FILTER` | FILTER | -| `FIRST_TOKEN` | FIRST_TOKEN | -| `FOCUS_IN` | FOCUS_IN | -| `LAST_TOKEN` | LAST_TOKEN | -| `MANUAL_FEEDBACK` | MANUAL_FEEDBACK | -| `MARK_AS_READ` | MARK_AS_READ | -| `MESSAGE` | MESSAGE | -| `MIDDLE_CLICK` | MIDDLE_CLICK | -| `PAGE_BLUR` | PAGE_BLUR | -| `PAGE_FOCUS` | PAGE_FOCUS | -| `PAGE_LEAVE` | PAGE_LEAVE | -| `PREVIEW` | PREVIEW | -| `RELATED_CLICK` | RELATED_CLICK | -| `RIGHT_CLICK` | RIGHT_CLICK | -| `SECTION_CLICK` | SECTION_CLICK | -| `SEEN` | SEEN | -| `SHARE` | SHARE | -| `SHOW_MORE` | SHOW_MORE | -| `UPVOTE` | UPVOTE | -| `VIEW` | VIEW | -| `VISIBLE` | VISIBLE | \ No newline at end of file +| Name | Value | +| ------------------------------ | ------------------------------ | +| `CLICK` | CLICK | +| `CONTAINER_CLICK` | CONTAINER_CLICK | +| `COPY_LINK` | COPY_LINK | +| `CREATE` | CREATE | +| `DISMISS` | DISMISS | +| `DOWNVOTE` | DOWNVOTE | +| `EMAIL` | EMAIL | +| `EXECUTE` | EXECUTE | +| `FILTER` | FILTER | +| `FIRST_TOKEN` | FIRST_TOKEN | +| `FOCUS_IN` | FOCUS_IN | +| `LAST_TOKEN` | LAST_TOKEN | +| `MANUAL_FEEDBACK` | MANUAL_FEEDBACK | +| `MANUAL_FEEDBACK_SIDE_BY_SIDE` | MANUAL_FEEDBACK_SIDE_BY_SIDE | +| `MARK_AS_READ` | MARK_AS_READ | +| `MESSAGE` | MESSAGE | +| `MIDDLE_CLICK` | MIDDLE_CLICK | +| `PAGE_BLUR` | PAGE_BLUR | +| `PAGE_FOCUS` | PAGE_FOCUS | +| `PAGE_LEAVE` | PAGE_LEAVE | +| `PREVIEW` | PREVIEW | +| `RELATED_CLICK` | RELATED_CLICK | +| `RIGHT_CLICK` | RIGHT_CLICK | +| `SECTION_CLICK` | SECTION_CLICK | +| `SEEN` | SEEN | +| `SHARE` | SHARE | +| `SHOW_MORE` | SHOW_MORE | +| `UPVOTE` | UPVOTE | +| `VIEW` | VIEW | +| `VISIBLE` | VISIBLE | \ No newline at end of file diff --git a/docs/models/components/Feedback.md b/docs/models/components/Feedback.md index c4efa5a2..33f08ff5 100644 --- a/docs/models/components/Feedback.md +++ b/docs/models/components/Feedback.md @@ -20,6 +20,7 @@ | `uiTree` | List\<*String*> | :heavy_minus_sign: | The UI element tree associated with the event, if any. | | `uiElement` | *Optional\* | :heavy_minus_sign: | The UI element associated with the event, if any. | | `manualFeedbackInfo` | [Optional\](../../models/components/ManualFeedbackInfo.md) | :heavy_minus_sign: | N/A | +| `manualFeedbackSideBySideInfo` | [Optional\](../../models/components/ManualFeedbackSideBySideInfo.md) | :heavy_minus_sign: | N/A | | `seenFeedbackInfo` | [Optional\](../../models/components/SeenFeedbackInfo.md) | :heavy_minus_sign: | N/A | | `userViewInfo` | [Optional\](../../models/components/UserViewInfo.md) | :heavy_minus_sign: | N/A | | `workflowFeedbackInfo` | [Optional\](../../models/components/WorkflowFeedbackInfo.md) | :heavy_minus_sign: | N/A | diff --git a/docs/models/components/ManualFeedbackInfo.md b/docs/models/components/ManualFeedbackInfo.md index 4a786f01..dfc1b28f 100644 --- a/docs/models/components/ManualFeedbackInfo.md +++ b/docs/models/components/ManualFeedbackInfo.md @@ -18,7 +18,7 @@ | `previousMessages` | List\<*String*> | :heavy_minus_sign: | The array of previous messages in a chat session, ordered by oldest to newest. | | `chatTranscript` | List\<[FeedbackChatExchange](../../models/components/FeedbackChatExchange.md)> | :heavy_minus_sign: | Array of previous request/response exchanges, ordered by oldest to newest. | | `numQueriesFromFirstRun` | *Optional\* | :heavy_minus_sign: | How many times this query has been run in the past. | -| `vote` | [Optional\](../../models/components/Vote.md) | :heavy_minus_sign: | The vote associated with the Feedback.event.MANUAL_FEEDBACK event. | +| `vote` | [Optional\](../../models/components/ManualFeedbackInfoVote.md) | :heavy_minus_sign: | The vote associated with the Feedback.event.MANUAL_FEEDBACK event. | | `rating` | *Optional\* | :heavy_minus_sign: | A rating associated with the user feedback. The value will be between one and the maximum given by ratingScale, inclusive. | | `ratingKey` | *Optional\* | :heavy_minus_sign: | A description of the rating that contextualizes how it appeared to the user, e.g. "satisfied". | | `ratingScale` | *Optional\* | :heavy_minus_sign: | The scale of comparison for a rating associated with the feedback. Rating values start from one and go up to the maximum specified by ratingScale. For example, a five-option satisfaction rating will have a ratingScale of 5 and a thumbs-up/thumbs-down rating will have a ratingScale of 2. | \ No newline at end of file diff --git a/docs/models/components/Vote.md b/docs/models/components/ManualFeedbackInfoVote.md similarity index 88% rename from docs/models/components/Vote.md rename to docs/models/components/ManualFeedbackInfoVote.md index 75566ee7..401fb94b 100644 --- a/docs/models/components/Vote.md +++ b/docs/models/components/ManualFeedbackInfoVote.md @@ -1,4 +1,4 @@ -# Vote +# ManualFeedbackInfoVote The vote associated with the Feedback.event.MANUAL_FEEDBACK event. diff --git a/docs/models/components/ManualFeedbackSideBySideInfo.md b/docs/models/components/ManualFeedbackSideBySideInfo.md new file mode 100644 index 00000000..8e9b1c9e --- /dev/null +++ b/docs/models/components/ManualFeedbackSideBySideInfo.md @@ -0,0 +1,15 @@ +# ManualFeedbackSideBySideInfo + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `email` | *Optional\* | :heavy_minus_sign: | The email address of the user who submitted the side-by-side feedback. | +| `source` | [Optional\](../../models/components/ManualFeedbackSideBySideInfoSource.md) | :heavy_minus_sign: | The source associated with the side-by-side feedback event. | +| `query` | *Optional\* | :heavy_minus_sign: | The query or prompt that was evaluated across multiple implementations. | +| `implementations` | List\<[SideBySideImplementation](../../models/components/SideBySideImplementation.md)> | :heavy_minus_sign: | Array of implementations that were compared side-by-side. | +| `evaluationSessionId` | *Optional\* | :heavy_minus_sign: | Unique identifier for this evaluation session to group related feedback events. | +| `implementationId` | *Optional\* | :heavy_minus_sign: | The ID of the implementation this specific feedback event is for. | +| `vote` | [Optional\](../../models/components/ManualFeedbackSideBySideInfoVote.md) | :heavy_minus_sign: | The vote for this specific implementation. | +| `comments` | *Optional\* | :heavy_minus_sign: | Specific feedback comments for this implementation. | \ No newline at end of file diff --git a/docs/models/components/ManualFeedbackSideBySideInfoSource.md b/docs/models/components/ManualFeedbackSideBySideInfoSource.md new file mode 100644 index 00000000..ac916e0d --- /dev/null +++ b/docs/models/components/ManualFeedbackSideBySideInfoSource.md @@ -0,0 +1,12 @@ +# ManualFeedbackSideBySideInfoSource + +The source associated with the side-by-side feedback event. + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `LIVE_EVAL` | LIVE_EVAL | +| `CHAT` | CHAT | +| `SEARCH` | SEARCH | \ No newline at end of file diff --git a/docs/models/components/ManualFeedbackSideBySideInfoVote.md b/docs/models/components/ManualFeedbackSideBySideInfoVote.md new file mode 100644 index 00000000..3ba4a1be --- /dev/null +++ b/docs/models/components/ManualFeedbackSideBySideInfoVote.md @@ -0,0 +1,12 @@ +# ManualFeedbackSideBySideInfoVote + +The vote for this specific implementation. + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `UPVOTE` | UPVOTE | +| `DOWNVOTE` | DOWNVOTE | +| `NEUTRAL` | NEUTRAL | \ No newline at end of file diff --git a/docs/models/components/ResponseMetadata.md b/docs/models/components/ResponseMetadata.md new file mode 100644 index 00000000..e0a0a77e --- /dev/null +++ b/docs/models/components/ResponseMetadata.md @@ -0,0 +1,12 @@ +# ResponseMetadata + +Metadata about the response (e.g., latency, token count). + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | +| `latencyMs` | *Optional\* | :heavy_minus_sign: | Time taken to generate the response in milliseconds. | +| `tokenCount` | *Optional\* | :heavy_minus_sign: | Number of tokens in the response. | +| `modelUsed` | *Optional\* | :heavy_minus_sign: | The specific model version used. | \ No newline at end of file diff --git a/docs/models/components/SearchRequest.md b/docs/models/components/SearchRequest.md index d351fd60..74690158 100644 --- a/docs/models/components/SearchRequest.md +++ b/docs/models/components/SearchRequest.md @@ -17,5 +17,4 @@ | `inputDetails` | [Optional\](../../models/components/SearchRequestInputDetails.md) | :heavy_minus_sign: | N/A | {
"hasCopyPaste": true
} | | `requestOptions` | [Optional\](../../models/components/SearchRequestOptions.md) | :heavy_minus_sign: | N/A | {
"datasourceFilter": "JIRA",
"datasourcesFilter": [
"JIRA"
],
"queryOverridesFacetFilters": true,
"facetFilters": [
{
"fieldName": "fieldName",
"values": [
"fieldValues",
"fieldValues"
]
},
{
"fieldName": "fieldName",
"values": [
"fieldValues",
"fieldValues"
]
}
]
} | | `timeoutMillis` | *Optional\* | :heavy_minus_sign: | Timeout in milliseconds for the request. A `408` error will be returned if handling the request takes longer. | 5000 | -| `people` | List\<[Person](../../models/components/Person.md)> | :heavy_minus_sign: | People associated with the search request. Hints to the server to fetch additional information for these people. Note that in this request, an email may be used as a person's obfuscatedId value. | | | `disableSpellcheck` | *Optional\* | :heavy_minus_sign: | Whether or not to disable spellcheck. | | \ No newline at end of file diff --git a/docs/models/components/SearchResponseMetadata.md b/docs/models/components/SearchResponseMetadata.md index 382615a3..6eb5ca36 100644 --- a/docs/models/components/SearchResponseMetadata.md +++ b/docs/models/components/SearchResponseMetadata.md @@ -7,6 +7,7 @@ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `rewrittenQuery` | *Optional\* | :heavy_minus_sign: | A cleaned up or updated version of the query to be displayed in the query box. Useful for mapping visual facets to search operators. | | | `searchedQuery` | *Optional\* | :heavy_minus_sign: | The actual query used to perform search and return results. | | +| `searchedQueryWithoutNegation` | *Optional\* | :heavy_minus_sign: | The query used to perform search and return results, with negated terms and facets removed. | | | `searchedQueryRanges` | List\<[TextRange](../../models/components/TextRange.md)> | :heavy_minus_sign: | The bolded ranges within the searched query. | | | `originalQuery` | *Optional\* | :heavy_minus_sign: | The query text sent by the client in the request. | | | `querySuggestion` | [Optional\](../../models/components/QuerySuggestion.md) | :heavy_minus_sign: | N/A | {
"query": "app:github type:pull author:mortimer",
"label": "Mortimer's PRs",
"datasource": "github"
} | diff --git a/docs/models/components/SideBySideImplementation.md b/docs/models/components/SideBySideImplementation.md new file mode 100644 index 00000000..12b64317 --- /dev/null +++ b/docs/models/components/SideBySideImplementation.md @@ -0,0 +1,12 @@ +# SideBySideImplementation + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | +| `implementationId` | *Optional\* | :heavy_minus_sign: | Unique identifier for this implementation variant. | +| `implementationName` | *Optional\* | :heavy_minus_sign: | Human-readable name for this implementation (e.g., "Variant A", "GPT-4", "Claude"). | +| `searchParams` | Map\ | :heavy_minus_sign: | The search/chat parameters used for this implementation. | +| `response` | *Optional\* | :heavy_minus_sign: | The full response generated by this implementation. | +| `responseMetadata` | [Optional\](../../models/components/ResponseMetadata.md) | :heavy_minus_sign: | Metadata about the response (e.g., latency, token count). | \ No newline at end of file diff --git a/docs/models/components/StructuredResult.md b/docs/models/components/StructuredResult.md index 35479da1..03ca3205 100644 --- a/docs/models/components/StructuredResult.md +++ b/docs/models/components/StructuredResult.md @@ -13,6 +13,7 @@ A single object that can support any object in the work graph. Only a single obj | `team` | [Optional\](../../models/components/Team.md) | :heavy_minus_sign: | N/A | | | `customEntity` | [Optional\](../../models/components/CustomEntity.md) | :heavy_minus_sign: | N/A | | | `answer` | [Optional\](../../models/components/Answer.md) | :heavy_minus_sign: | N/A | | +| `generatedQna` | [Optional\](../../models/components/GeneratedQna.md) | :heavy_minus_sign: | N/A | | | `extractedQnA` | [Optional\](../../models/components/ExtractedQnA.md) | :heavy_minus_sign: | N/A | | | `meeting` | [Optional\](../../models/components/Meeting.md) | :heavy_minus_sign: | N/A | | | `app` | [Optional\](../../models/components/AppResult.md) | :heavy_minus_sign: | N/A | | diff --git a/docs/sdks/activity/README.md b/docs/sdks/activity/README.md index f57fd245..76a2a990 100644 --- a/docs/sdks/activity/README.md +++ b/docs/sdks/activity/README.md @@ -14,6 +14,7 @@ Report user activity that occurs on indexed documents such as viewing or editing ### Example Usage + ```java package hello.world; @@ -89,6 +90,7 @@ Report events that happen to results within a Glean client UI, such as search re ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/agents/README.md b/docs/sdks/agents/README.md index 89468341..021c6cf9 100644 --- a/docs/sdks/agents/README.md +++ b/docs/sdks/agents/README.md @@ -17,6 +17,7 @@ Returns details of an [agent](https://developers.glean.com/agents/agents-api) cr ### Example Usage + ```java package hello.world; @@ -66,6 +67,7 @@ Return [agent](https://developers.glean.com/agents/agents-api)'s input and outpu ### Example Usage + ```java package hello.world; @@ -115,6 +117,7 @@ Search for [agents](https://developers.glean.com/agents/agents-api) by agent nam ### Example Usage + ```java package hello.world; @@ -168,6 +171,7 @@ Executes an [agent](https://developers.glean.com/agents/agents-api) run and retu ### Example Usage + ```java package hello.world; @@ -227,6 +231,7 @@ Executes an [agent](https://developers.glean.com/agents/agents-api) run and retu ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/announcements/README.md b/docs/sdks/announcements/README.md index 6b988623..a519cd7c 100644 --- a/docs/sdks/announcements/README.md +++ b/docs/sdks/announcements/README.md @@ -15,6 +15,7 @@ Create a textual announcement visible to some set of users based on department a ### Example Usage + ```java package hello.world; @@ -21271,6 +21272,7 @@ Delete an existing user-generated announcement. ### Example Usage + ```java package hello.world; @@ -21322,6 +21324,7 @@ Update a textual announcement visible to some set of users based on department a ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/answers/README.md b/docs/sdks/answers/README.md index 594d1b47..f3352463 100644 --- a/docs/sdks/answers/README.md +++ b/docs/sdks/answers/README.md @@ -17,6 +17,7 @@ Create a user-generated Answer that contains a question and answer. ### Example Usage + ```java package hello.world; @@ -1316,6 +1317,7 @@ Delete an existing user-generated Answer. ### Example Usage + ```java package hello.world; @@ -1368,6 +1370,7 @@ Update an existing user-generated Answer. ### Example Usage + ```java package hello.world; @@ -2259,6 +2262,7 @@ Read the details of a particular Answer given its ID. ### Example Usage + ```java package hello.world; @@ -2313,6 +2317,7 @@ List Answers created by the current user. ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/chat/README.md b/docs/sdks/chat/README.md index f51c158a..326ec815 100644 --- a/docs/sdks/chat/README.md +++ b/docs/sdks/chat/README.md @@ -22,6 +22,7 @@ Have a conversation with Glean AI. ### Example Usage + ```java package hello.world; @@ -43,6 +44,7 @@ public class Application { .chatRequest(ChatRequest.builder() .messages(List.of( ChatMessage.builder() + .author(Author.USER) .fragments(List.of( ChatMessageFragment.builder() .text("What are the company holidays this year?") @@ -81,6 +83,7 @@ Deletes all saved Chats a user has had and all their contained conversational co ### Example Usage + ```java package hello.world; @@ -126,6 +129,7 @@ Deletes saved Chats and all their contained conversational content. ### Example Usage + ```java package hello.world; @@ -177,6 +181,7 @@ Retrieves the chat history between Glean Assistant and the user for a given Chat ### Example Usage + ```java package hello.world; @@ -229,6 +234,7 @@ Retrieves all the saved Chats between Glean Assistant and the user. The returned ### Example Usage + ```java package hello.world; @@ -276,6 +282,7 @@ Gets the Chat application details for the specified application ID. ### Example Usage + ```java package hello.world; @@ -328,6 +335,7 @@ Upload files for Chat. ### Example Usage + ```java package hello.world; @@ -387,6 +395,7 @@ Get files uploaded by a user for Chat. ### Example Usage + ```java package hello.world; @@ -441,6 +450,7 @@ Delete files uploaded by a user for Chat. ### Example Usage + ```java package hello.world; @@ -495,6 +505,7 @@ Have a conversation with Glean AI. ### Example Usage + ```java package hello.world; @@ -516,6 +527,7 @@ public class Application { .chatRequest(ChatRequest.builder() .messages(List.of( ChatMessage.builder() + .author(Author.USER) .fragments(List.of( ChatMessageFragment.builder() .text("What are the company holidays this year?") diff --git a/docs/sdks/clientauthentication/README.md b/docs/sdks/clientauthentication/README.md index 66bc1eb0..d0d178b5 100644 --- a/docs/sdks/clientauthentication/README.md +++ b/docs/sdks/clientauthentication/README.md @@ -18,6 +18,7 @@ for use with the Client API (e.g. `/rest/api/v1/*`). ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/clientdocuments/README.md b/docs/sdks/clientdocuments/README.md index 15d82227..596c830a 100644 --- a/docs/sdks/clientdocuments/README.md +++ b/docs/sdks/clientdocuments/README.md @@ -16,6 +16,7 @@ Read the emails of all users who have access to the given document. ### Example Usage + ```java package hello.world; @@ -68,6 +69,7 @@ Read the documents including metadata (does not include enhanced metadata via `/ ### Example Usage + ```java package hello.world; @@ -115,6 +117,7 @@ Read the documents including metadata (does not include enhanced metadata via `/ ### Example Usage + ```java package hello.world; @@ -199,6 +202,7 @@ Generate an AI summary of the requested documents. ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/clientshortcuts/README.md b/docs/sdks/clientshortcuts/README.md index c9d4a999..fb5cb511 100644 --- a/docs/sdks/clientshortcuts/README.md +++ b/docs/sdks/clientshortcuts/README.md @@ -17,6 +17,7 @@ Create a user-generated shortcut that contains an alias and destination URL. ### Example Usage + ```java package hello.world; @@ -1541,6 +1542,7 @@ Delete an existing user-generated shortcut. ### Example Usage + ```java package hello.world; @@ -1592,6 +1594,7 @@ Read a particular shortcut's details given its ID. ### Example Usage + ```java package hello.world; @@ -1646,6 +1649,7 @@ List shortcuts editable/owned by the currently authenticated user. ### Example Usage + ```java package hello.world; @@ -1713,6 +1717,7 @@ Updates the shortcut with the given ID. ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/collections/README.md b/docs/sdks/collections/README.md index f2d6f10e..6734d747 100644 --- a/docs/sdks/collections/README.md +++ b/docs/sdks/collections/README.md @@ -20,6 +20,7 @@ Add items to a Collection. ### Example Usage + ```java package hello.world; @@ -73,6 +74,7 @@ Create a publicly visible (empty) Collection of documents. ### Example Usage + ```java package hello.world; @@ -727,6 +729,7 @@ Delete a Collection given the Collection's ID. ### Example Usage + ```java package hello.world; @@ -784,6 +787,7 @@ Delete a single item from a Collection. ### Example Usage + ```java package hello.world; @@ -838,6 +842,7 @@ Update the properties of an existing Collection. ### Example Usage + ```java package hello.world; @@ -1863,6 +1868,7 @@ Update the URL, Glean Document ID, description of an item within a Collection gi ### Example Usage + ```java package hello.world; @@ -1917,6 +1923,7 @@ Read the details of a Collection given its ID. Does not fetch items in this Coll ### Example Usage + ```java package hello.world; @@ -1970,6 +1977,7 @@ List all existing Collections. ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/datasource/README.md b/docs/sdks/datasource/README.md index ede28266..a21fa3d8 100644 --- a/docs/sdks/datasource/README.md +++ b/docs/sdks/datasource/README.md @@ -12,11 +12,12 @@ Gather information about the datasource's overall status. Currently in beta, might undergo breaking changes without prior notice. -Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. +Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/datasources/README.md b/docs/sdks/datasources/README.md index c9259584..dce7359f 100644 --- a/docs/sdks/datasources/README.md +++ b/docs/sdks/datasources/README.md @@ -14,6 +14,7 @@ Add or update a custom datasource and its schema. ### Example Usage + ```java package hello.world; @@ -76,6 +77,7 @@ Fetches the datasource config for the specified custom datasource. ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/entities/README.md b/docs/sdks/entities/README.md index aebd4a36..2613b73c 100644 --- a/docs/sdks/entities/README.md +++ b/docs/sdks/entities/README.md @@ -14,6 +14,7 @@ List some set of details for all entities that fit the given criteria and return ### Example Usage + ```java package hello.world; @@ -81,6 +82,7 @@ Read people details for the given IDs. ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/indexingauthentication/README.md b/docs/sdks/indexingauthentication/README.md index 1437a081..b2cc5f6e 100644 --- a/docs/sdks/indexingauthentication/README.md +++ b/docs/sdks/indexingauthentication/README.md @@ -9,10 +9,11 @@ ## rotateToken -Rotates the secret value inside the Indexing API token and returns the new raw secret. All other properties of the token are unchanged. In order to rotate the secret value, include the token as the bearer token in the `/rotatetoken` request. Please refer to [Token rotation](https://developers.glean.com/docs/indexing_api_token_rotation/) documentation for more information. +Rotates the secret value inside the Indexing API token and returns the new raw secret. All other properties of the token are unchanged. In order to rotate the secret value, include the token as the bearer token in the `/rotatetoken` request. Please refer to [Token rotation](https://developers.glean.com/indexing/authentication/token-rotation) documentation for more information. ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/indexingdocuments/README.md b/docs/sdks/indexingdocuments/README.md index 4b94905f..346e66d8 100644 --- a/docs/sdks/indexingdocuments/README.md +++ b/docs/sdks/indexingdocuments/README.md @@ -24,6 +24,7 @@ Adds a document to the index or updates an existing document. ### Example Usage + ```java package hello.world; @@ -74,10 +75,11 @@ public class Application { ## index -Adds or updates multiple documents in the index. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#choosing-indexdocuments-vs-bulkindexdocuments) documentation for an explanation of when to use this endpoint. +Adds or updates multiple documents in the index. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-indexing/choosing-indexdocuments-vs-bulkindexdocuments) documentation for an explanation of when to use this endpoint. ### Example Usage + ```java package hello.world; @@ -127,10 +129,11 @@ public class Application { ## bulkIndex -Replaces the documents in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. +Replaces the documents in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. ### Example Usage + ```java package hello.world; @@ -196,6 +199,7 @@ For more frequent document processing, contact Glean support. ### Example Usage + ```java package hello.world; @@ -241,6 +245,7 @@ Deletes the specified document from the index. Succeeds if document is not prese ### Example Usage + ```java package hello.world; @@ -292,11 +297,12 @@ public class Application { Gives various information that would help in debugging related to a particular document. Currently in beta, might undergo breaking changes without prior notice. -Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. +Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. ### Example Usage + ```java package hello.world; @@ -349,11 +355,12 @@ public class Application { Gives various information that would help in debugging related to a batch of documents. Currently in beta, might undergo breaking changes without prior notice. -Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. +Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. ### Example Usage + ```java package hello.world; @@ -411,11 +418,12 @@ public class Application { Check if a given user has access to access a document in a custom datasource -Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. +Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. ### Example Usage + ```java package hello.world; @@ -470,13 +478,14 @@ public class Application { Intended for debugging/validation. Fetches the current upload and indexing status of documents. -Tip: Use [/debug/{datasource}/document](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/#debug-datasource-document) for richer information. +Tip: Use [/debug/{datasource}/document](https://developers.glean.com/indexing/debugging/datasource-document) for richer information. > :warning: **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible. ### Example Usage + ```java package hello.world; @@ -530,13 +539,14 @@ public class Application { Fetches document count for the specified custom datasource. -Tip: Use [/debug/{datasource}/status](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/#debug-datasource-status) for richer information. +Tip: Use [/debug/{datasource}/status](https://developers.glean.com/indexing/debugging/datasource-status) for richer information. > :warning: **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible. ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/indexingshortcuts/README.md b/docs/sdks/indexingshortcuts/README.md index 307a5eaa..483e08a7 100644 --- a/docs/sdks/indexingshortcuts/README.md +++ b/docs/sdks/indexingshortcuts/README.md @@ -14,6 +14,7 @@ Replaces all the currently indexed shortcuts using paginated batch API calls. No ### Example Usage + ```java package hello.world; @@ -80,6 +81,7 @@ Creates glean shortcuts for uploaded shortcuts info. Glean would host the shortc ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/insights/README.md b/docs/sdks/insights/README.md index 2a8985d6..db841303 100644 --- a/docs/sdks/insights/README.md +++ b/docs/sdks/insights/README.md @@ -13,6 +13,7 @@ Reads the aggregate information for each user, query, and content. ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/messages/README.md b/docs/sdks/messages/README.md index 77cd180f..1a25af79 100644 --- a/docs/sdks/messages/README.md +++ b/docs/sdks/messages/README.md @@ -13,6 +13,7 @@ Retrieves list of messages from messaging/chat datasources (e.g. Slack, Teams). ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/people/README.md b/docs/sdks/people/README.md index 7d648b76..64ba82ee 100644 --- a/docs/sdks/people/README.md +++ b/docs/sdks/people/README.md @@ -20,11 +20,12 @@ Gives various information that would help in debugging related to a particular user. Currently in beta, might undergo breaking changes without prior notice. -Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. +Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. ### Example Usage + ```java package hello.world; @@ -76,13 +77,14 @@ public class Application { Fetches user count for the specified custom datasource. -Tip: Use [/debug/{datasource}/status](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/#debug-datasource-status) for richer information. +Tip: Use [/debug/{datasource}/status](https://developers.glean.com/indexing/debugging/datasource-status) for richer information. > :warning: **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible. ### Example Usage + ```java package hello.world; @@ -136,6 +138,7 @@ Adds an employee or updates information about an employee ### Example Usage + ```java package hello.world; @@ -192,10 +195,11 @@ public class Application { ## bulkIndex -Replaces all the currently indexed employees using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. +Replaces all the currently indexed employees using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. ### Example Usage + ```java package hello.world; @@ -277,6 +281,7 @@ Schedules the immediate processing of employees and teams uploaded through the i ### Example Usage + ```java package hello.world; @@ -316,6 +321,7 @@ Delete an employee. Silently succeeds if employee is not present. ### Example Usage + ```java package hello.world; @@ -367,6 +373,7 @@ Adds a team or updates information about a team ### Example Usage + ```java package hello.world; @@ -439,6 +446,7 @@ Delete a team based on provided id. ### Example Usage + ```java package hello.world; @@ -486,10 +494,11 @@ public class Application { ## bulkIndexTeams -Replaces all the currently indexed teams using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. +Replaces all the currently indexed teams using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/permissions/README.md b/docs/sdks/permissions/README.md index 197486bf..e5dd4650 100644 --- a/docs/sdks/permissions/README.md +++ b/docs/sdks/permissions/README.md @@ -24,6 +24,7 @@ Updates the permissions for a given document without modifying document content. ### Example Usage + ```java package hello.world; @@ -78,6 +79,7 @@ Adds a datasource user or updates an existing user. ### Example Usage + ```java package hello.world; @@ -130,10 +132,11 @@ public class Application { ## bulkIndexUsers -Replaces the users in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. +Replaces the users in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. ### Example Usage + ```java package hello.world; @@ -201,6 +204,7 @@ Add or update a group in the datasource. ### Example Usage + ```java package hello.world; @@ -252,10 +256,11 @@ public class Application { ## bulkIndexGroups -Replaces the groups in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. +Replaces the groups in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. ### Example Usage + ```java package hello.world; @@ -317,6 +322,7 @@ Add the memberships of a group in the datasource. ### Example Usage + ```java package hello.world; @@ -368,10 +374,11 @@ public class Application { ## bulkIndexMemberships -Replaces the memberships for a group in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. +Replaces the memberships for a group in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. ### Example Usage + ```java package hello.world; @@ -434,6 +441,7 @@ Schedules the immediate processing of all group memberships uploaded through the ### Example Usage + ```java package hello.world; @@ -479,6 +487,7 @@ Delete the user from the datasource. Silently succeeds if user is not present. ### Example Usage + ```java package hello.world; @@ -531,6 +540,7 @@ Delete group from the datasource. Silently succeeds if group is not present. ### Example Usage + ```java package hello.world; @@ -583,6 +593,7 @@ Delete membership to a group in the specified datasource. Silently succeeds if m ### Example Usage + ```java package hello.world; @@ -638,6 +649,7 @@ Allow the datasource be visible to the specified beta users. The default behavio ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/pins/README.md b/docs/sdks/pins/README.md index b615aa95..0d5208c7 100644 --- a/docs/sdks/pins/README.md +++ b/docs/sdks/pins/README.md @@ -17,6 +17,7 @@ Update an existing user-generated pin. ### Example Usage + ```java package hello.world; @@ -83,6 +84,7 @@ Read pin details given its ID. ### Example Usage + ```java package hello.world; @@ -135,6 +137,7 @@ Lists all pins. ### Example Usage + ```java package hello.world; @@ -187,6 +190,7 @@ Pin a document as a result for a given search query.Pin results that are known t ### Example Usage + ```java package hello.world; @@ -253,6 +257,7 @@ Unpin a previously pinned result. ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/policies/README.md b/docs/sdks/policies/README.md index bd05f9af..da962d2e 100644 --- a/docs/sdks/policies/README.md +++ b/docs/sdks/policies/README.md @@ -17,6 +17,7 @@ Fetches the specified policy version, or the latest if no version is provided. ### Example Usage + ```java package hello.world; @@ -66,6 +67,7 @@ Updates an existing policy. ### Example Usage + ```java package hello.world; @@ -118,6 +120,7 @@ Lists policies with filtering. ### Example Usage + ```java package hello.world; @@ -166,6 +169,7 @@ Creates a new policy with specified specifications and returns its id. ### Example Usage + ```java package hello.world; @@ -218,6 +222,7 @@ Downloads CSV violations report for a specific policy id. This does not support ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/reports/README.md b/docs/sdks/reports/README.md index 3e77f3d5..4d10de44 100644 --- a/docs/sdks/reports/README.md +++ b/docs/sdks/reports/README.md @@ -15,6 +15,7 @@ Creates a new one-time report and executes its batch job. ### Example Usage + ```java package hello.world; @@ -67,6 +68,7 @@ Downloads CSV violations report for a specific report id. ### Example Usage + ```java package hello.world; @@ -115,6 +117,7 @@ Fetches the status of the run corresponding to the report-id. ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/search/README.md b/docs/sdks/search/README.md index b774726e..a71c5c97 100644 --- a/docs/sdks/search/README.md +++ b/docs/sdks/search/README.md @@ -17,6 +17,7 @@ Retrieves results for search query without respect for permissions. This is avai ### Example Usage + ```java package hello.world; @@ -99,6 +100,7 @@ Retrieve query suggestions, operators and documents for the given partially type ### Example Usage + ```java package hello.world; @@ -155,6 +157,7 @@ The personalized feed/home includes different types of contents including sugges ### Example Usage + ```java package hello.world; @@ -208,6 +211,7 @@ Retrieve recommended documents for the given URL or Glean Document ID. ### Example Usage + ```java package hello.world; @@ -451,6 +455,7 @@ Retrieve results from the index for the given query and filters. ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/tools/README.md b/docs/sdks/tools/README.md index 3a77a5e2..25f4e936 100644 --- a/docs/sdks/tools/README.md +++ b/docs/sdks/tools/README.md @@ -14,6 +14,7 @@ Returns a filtered set of available tools based on optional tool name parameters ### Example Usage + ```java package hello.world; @@ -61,6 +62,7 @@ Execute the specified tool with provided parameters ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/verification/README.md b/docs/sdks/verification/README.md index 4610834b..f953fc7f 100644 --- a/docs/sdks/verification/README.md +++ b/docs/sdks/verification/README.md @@ -15,6 +15,7 @@ Creates a verification reminder for the document. Users can create verification ### Example Usage + ```java package hello.world; @@ -68,6 +69,7 @@ Returns the information to be rendered in verification dashboard. Includes infor ### Example Usage + ```java package hello.world; @@ -115,6 +117,7 @@ Verify documents to keep the knowledge up to date within customer corpus. ### Example Usage + ```java package hello.world; diff --git a/docs/sdks/visibilityoverrides/README.md b/docs/sdks/visibilityoverrides/README.md index 7d88ae62..80396770 100644 --- a/docs/sdks/visibilityoverrides/README.md +++ b/docs/sdks/visibilityoverrides/README.md @@ -14,6 +14,7 @@ Fetches the visibility override status of the documents passed. ### Example Usage + ```java package hello.world; @@ -61,6 +62,7 @@ Sets the visibility-override state of the documents specified, effectively hidin ### Example Usage + ```java package hello.world; diff --git a/gradle.properties b/gradle.properties index 8230588b..1ccfddc9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ groupId=com.glean.api-client artifactId=glean-api-client -version=0.7.0 \ No newline at end of file +version=0.8.0 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index d64cd491..1b33c55b 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1af9e093..ff23a68d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a42..23d15a93 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -112,7 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -203,7 +205,7 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. @@ -211,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 6689b85b..5eed7ee8 100755 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,22 +59,22 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell diff --git a/src/main/java/com/glean/api_client/glean_api_client/Activity.java b/src/main/java/com/glean/api_client/glean_api_client/Activity.java index 0020d1ad..660f57ee 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Activity.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Activity.java @@ -11,11 +11,8 @@ import com.glean.api_client.glean_api_client.models.operations.FeedbackRequest; import com.glean.api_client.glean_api_client.models.operations.FeedbackRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.FeedbackResponse; -import com.glean.api_client.glean_api_client.operations.ActivityOperation; -import com.glean.api_client.glean_api_client.operations.FeedbackOperation; import java.lang.Exception; import java.lang.String; -import java.util.List; import java.util.Optional; @@ -25,6 +22,7 @@ public class Activity { Activity(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Report document activity * @@ -47,7 +45,7 @@ public ActivityRequestBuilder report() { */ public ActivityResponse report(com.glean.api_client.glean_api_client.models.components.Activity request) throws Exception { RequestOperation operation - = new ActivityOperation(sdkConfiguration); + = new com.glean.api_client.glean_api_client.operations.Activity.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -84,9 +82,7 @@ public FeedbackResponse feedbackDirect() throws Exception { * @return The response from the API call * @throws Exception if the API call fails */ - public FeedbackResponse feedback( - Optional feedbackQueryParameter, - Optional feedback1) throws Exception { + public FeedbackResponse feedback(Optional feedbackQueryParameter, Optional feedback1) throws Exception { FeedbackRequest request = FeedbackRequest .builder() @@ -94,7 +90,7 @@ public FeedbackResponse feedback( .feedback1(feedback1) .build(); RequestOperation operation - = new FeedbackOperation(sdkConfiguration); + = new com.glean.api_client.glean_api_client.operations.Feedback.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } 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 628f8333..99bfe358 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 @@ -19,15 +19,14 @@ import com.glean.api_client.glean_api_client.models.operations.GetAgentSchemasResponse; import com.glean.api_client.glean_api_client.models.operations.SearchAgentsRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.SearchAgentsResponse; -import com.glean.api_client.glean_api_client.operations.CreateAndStreamRunOperation; -import com.glean.api_client.glean_api_client.operations.CreateAndWaitRunOperation; -import com.glean.api_client.glean_api_client.operations.GetAgentOperation; -import com.glean.api_client.glean_api_client.operations.GetAgentSchemasOperation; -import com.glean.api_client.glean_api_client.operations.SearchAgentsOperation; +import com.glean.api_client.glean_api_client.operations.CreateAndStreamRun; +import com.glean.api_client.glean_api_client.operations.CreateAndWaitRun; +import com.glean.api_client.glean_api_client.operations.GetAgent; +import com.glean.api_client.glean_api_client.operations.GetAgentSchemas; +import com.glean.api_client.glean_api_client.operations.SearchAgents; import java.lang.Exception; import java.lang.Long; import java.lang.String; -import java.util.List; import java.util.Optional; @@ -37,6 +36,7 @@ public class Agents { Agents(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Retrieve an agent * @@ -71,9 +71,7 @@ public GetAgentResponse retrieve(String agentId) throws Exception { * @return The response from the API call * @throws Exception if the API call fails */ - public GetAgentResponse retrieve( - Optional timezoneOffset, - String agentId) throws Exception { + public GetAgentResponse retrieve(Optional timezoneOffset, String agentId) throws Exception { GetAgentRequest request = GetAgentRequest .builder() @@ -81,7 +79,7 @@ public GetAgentResponse retrieve( .agentId(agentId) .build(); RequestOperation operation - = new GetAgentOperation(sdkConfiguration); + = new GetAgent.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -119,9 +117,7 @@ public GetAgentSchemasResponse retrieveSchemas(String agentId) throws Exception * @return The response from the API call * @throws Exception if the API call fails */ - public GetAgentSchemasResponse retrieveSchemas( - Optional timezoneOffset, - String agentId) throws Exception { + public GetAgentSchemasResponse retrieveSchemas(Optional timezoneOffset, String agentId) throws Exception { GetAgentSchemasRequest request = GetAgentSchemasRequest .builder() @@ -129,7 +125,7 @@ public GetAgentSchemasResponse retrieveSchemas( .agentId(agentId) .build(); RequestOperation operation - = new GetAgentSchemasOperation(sdkConfiguration); + = new GetAgentSchemas.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -155,7 +151,7 @@ public SearchAgentsRequestBuilder list() { */ public SearchAgentsResponse list(SearchAgentsRequest request) throws Exception { RequestOperation operation - = new SearchAgentsOperation(sdkConfiguration); + = new SearchAgents.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -181,7 +177,7 @@ public CreateAndStreamRunRequestBuilder runStream() { */ public CreateAndStreamRunResponse runStream(AgentRunCreate request) throws Exception { RequestOperation operation - = new CreateAndStreamRunOperation(sdkConfiguration); + = new CreateAndStreamRun.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -207,7 +203,7 @@ public CreateAndWaitRunRequestBuilder run() { */ public CreateAndWaitRunResponse run(AgentRunCreate request) throws Exception { RequestOperation operation - = new CreateAndWaitRunOperation(sdkConfiguration); + = new CreateAndWaitRun.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Announcements.java b/src/main/java/com/glean/api_client/glean_api_client/Announcements.java index bba6358e..36e67b53 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Announcements.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Announcements.java @@ -14,12 +14,10 @@ import com.glean.api_client.glean_api_client.models.operations.DeleteannouncementResponse; import com.glean.api_client.glean_api_client.models.operations.UpdateannouncementRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.UpdateannouncementResponse; -import com.glean.api_client.glean_api_client.operations.CreateannouncementOperation; -import com.glean.api_client.glean_api_client.operations.DeleteannouncementOperation; -import com.glean.api_client.glean_api_client.operations.UpdateannouncementOperation; +import com.glean.api_client.glean_api_client.operations.Createannouncement; +import com.glean.api_client.glean_api_client.operations.Deleteannouncement; +import com.glean.api_client.glean_api_client.operations.Updateannouncement; import java.lang.Exception; -import java.util.List; -import java.util.Optional; public class Announcements { @@ -28,6 +26,7 @@ public class Announcements { Announcements(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Create Announcement * @@ -50,7 +49,7 @@ public CreateannouncementRequestBuilder create() { */ public CreateannouncementResponse create(CreateAnnouncementRequest request) throws Exception { RequestOperation operation - = new CreateannouncementOperation(sdkConfiguration); + = new Createannouncement.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -76,7 +75,7 @@ public DeleteannouncementRequestBuilder delete() { */ public DeleteannouncementResponse delete(DeleteAnnouncementRequest request) throws Exception { RequestOperation operation - = new DeleteannouncementOperation(sdkConfiguration); + = new Deleteannouncement.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -102,7 +101,7 @@ public UpdateannouncementRequestBuilder update() { */ public UpdateannouncementResponse update(UpdateAnnouncementRequest request) throws Exception { RequestOperation operation - = new UpdateannouncementOperation(sdkConfiguration); + = new Updateannouncement.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Answers.java b/src/main/java/com/glean/api_client/glean_api_client/Answers.java index cf1f6d15..4e4b8fe5 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Answers.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Answers.java @@ -20,14 +20,12 @@ import com.glean.api_client.glean_api_client.models.operations.GetanswerResponse; import com.glean.api_client.glean_api_client.models.operations.ListanswersRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.ListanswersResponse; -import com.glean.api_client.glean_api_client.operations.CreateanswerOperation; -import com.glean.api_client.glean_api_client.operations.DeleteanswerOperation; -import com.glean.api_client.glean_api_client.operations.EditanswerOperation; -import com.glean.api_client.glean_api_client.operations.GetanswerOperation; -import com.glean.api_client.glean_api_client.operations.ListanswersOperation; +import com.glean.api_client.glean_api_client.operations.Createanswer; +import com.glean.api_client.glean_api_client.operations.Deleteanswer; +import com.glean.api_client.glean_api_client.operations.Editanswer; +import com.glean.api_client.glean_api_client.operations.Getanswer; +import com.glean.api_client.glean_api_client.operations.Listanswers; import java.lang.Exception; -import java.util.List; -import java.util.Optional; public class Answers { @@ -36,6 +34,7 @@ public class Answers { Answers(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Create Answer * @@ -58,7 +57,7 @@ public CreateanswerRequestBuilder create() { */ public CreateanswerResponse create(CreateAnswerRequest request) throws Exception { RequestOperation operation - = new CreateanswerOperation(sdkConfiguration); + = new Createanswer.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -84,7 +83,7 @@ public DeleteanswerRequestBuilder delete() { */ public DeleteanswerResponse delete(DeleteAnswerRequest request) throws Exception { RequestOperation operation - = new DeleteanswerOperation(sdkConfiguration); + = new Deleteanswer.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -110,7 +109,7 @@ public EditanswerRequestBuilder update() { */ public EditanswerResponse update(EditAnswerRequest request) throws Exception { RequestOperation operation - = new EditanswerOperation(sdkConfiguration); + = new Editanswer.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -136,7 +135,7 @@ public GetanswerRequestBuilder retrieve() { */ public GetanswerResponse retrieve(GetAnswerRequest request) throws Exception { RequestOperation operation - = new GetanswerOperation(sdkConfiguration); + = new Getanswer.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -162,7 +161,7 @@ public ListanswersRequestBuilder list() { */ public ListanswersResponse list(ListAnswersRequest request) throws Exception { RequestOperation operation - = new ListanswersOperation(sdkConfiguration); + = new Listanswers.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Chat.java b/src/main/java/com/glean/api_client/glean_api_client/Chat.java index 8ba84e0e..119d11ff 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Chat.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Chat.java @@ -41,19 +41,17 @@ import com.glean.api_client.glean_api_client.models.operations.UploadchatfilesRequest; import com.glean.api_client.glean_api_client.models.operations.UploadchatfilesRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.UploadchatfilesResponse; -import com.glean.api_client.glean_api_client.operations.ChatOperation; -import com.glean.api_client.glean_api_client.operations.ChatStreamOperation; -import com.glean.api_client.glean_api_client.operations.DeleteallchatsOperation; -import com.glean.api_client.glean_api_client.operations.DeletechatfilesOperation; -import com.glean.api_client.glean_api_client.operations.DeletechatsOperation; -import com.glean.api_client.glean_api_client.operations.GetchatOperation; -import com.glean.api_client.glean_api_client.operations.GetchatapplicationOperation; -import com.glean.api_client.glean_api_client.operations.GetchatfilesOperation; -import com.glean.api_client.glean_api_client.operations.ListchatsOperation; -import com.glean.api_client.glean_api_client.operations.UploadchatfilesOperation; +import com.glean.api_client.glean_api_client.operations.ChatStream; +import com.glean.api_client.glean_api_client.operations.Deleteallchats; +import com.glean.api_client.glean_api_client.operations.Deletechatfiles; +import com.glean.api_client.glean_api_client.operations.Deletechats; +import com.glean.api_client.glean_api_client.operations.Getchat; +import com.glean.api_client.glean_api_client.operations.Getchatapplication; +import com.glean.api_client.glean_api_client.operations.Getchatfiles; +import com.glean.api_client.glean_api_client.operations.Listchats; +import com.glean.api_client.glean_api_client.operations.Uploadchatfiles; import java.lang.Exception; import java.lang.Long; -import java.util.List; import java.util.Optional; @@ -63,6 +61,7 @@ public class Chat { Chat(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Chat * @@ -97,9 +96,7 @@ public ChatResponse create(ChatRequest chatRequest) throws Exception { * @return The response from the API call * @throws Exception if the API call fails */ - public ChatResponse create( - Optional timezoneOffset, - ChatRequest chatRequest) throws Exception { + public ChatResponse create(Optional timezoneOffset, ChatRequest chatRequest) throws Exception { com.glean.api_client.glean_api_client.models.operations.ChatRequest request = com.glean.api_client.glean_api_client.models.operations.ChatRequest .builder() @@ -107,7 +104,7 @@ public ChatResponse create( .chatRequest(chatRequest) .build(); RequestOperation operation - = new ChatOperation(sdkConfiguration); + = new com.glean.api_client.glean_api_client.operations.Chat.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -150,7 +147,7 @@ public DeleteallchatsResponse deleteAll(Optional timezoneOffset) throws Ex .timezoneOffset(timezoneOffset) .build(); RequestOperation operation - = new DeleteallchatsOperation(sdkConfiguration); + = new Deleteallchats.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -188,9 +185,7 @@ public DeletechatsResponse delete(DeleteChatsRequest deleteChatsRequest) throws * @return The response from the API call * @throws Exception if the API call fails */ - public DeletechatsResponse delete( - Optional timezoneOffset, - DeleteChatsRequest deleteChatsRequest) throws Exception { + public DeletechatsResponse delete(Optional timezoneOffset, DeleteChatsRequest deleteChatsRequest) throws Exception { DeletechatsRequest request = DeletechatsRequest .builder() @@ -198,7 +193,7 @@ public DeletechatsResponse delete( .deleteChatsRequest(deleteChatsRequest) .build(); RequestOperation operation - = new DeletechatsOperation(sdkConfiguration); + = new Deletechats.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -236,9 +231,7 @@ public GetchatResponse retrieve(GetChatRequest getChatRequest) throws Exception * @return The response from the API call * @throws Exception if the API call fails */ - public GetchatResponse retrieve( - Optional timezoneOffset, - GetChatRequest getChatRequest) throws Exception { + public GetchatResponse retrieve(Optional timezoneOffset, GetChatRequest getChatRequest) throws Exception { GetchatRequest request = GetchatRequest .builder() @@ -246,7 +239,7 @@ public GetchatResponse retrieve( .getChatRequest(getChatRequest) .build(); RequestOperation operation - = new GetchatOperation(sdkConfiguration); + = new Getchat.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -289,7 +282,7 @@ public ListchatsResponse list(Optional timezoneOffset) throws Exception { .timezoneOffset(timezoneOffset) .build(); RequestOperation operation - = new ListchatsOperation(sdkConfiguration); + = new Listchats.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -327,9 +320,7 @@ public GetchatapplicationResponse retrieveApplication(GetChatApplicationRequest * @return The response from the API call * @throws Exception if the API call fails */ - public GetchatapplicationResponse retrieveApplication( - Optional timezoneOffset, - GetChatApplicationRequest getChatApplicationRequest) throws Exception { + public GetchatapplicationResponse retrieveApplication(Optional timezoneOffset, GetChatApplicationRequest getChatApplicationRequest) throws Exception { GetchatapplicationRequest request = GetchatapplicationRequest .builder() @@ -337,7 +328,7 @@ public GetchatapplicationResponse retrieveApplication( .getChatApplicationRequest(getChatApplicationRequest) .build(); RequestOperation operation - = new GetchatapplicationOperation(sdkConfiguration); + = new Getchatapplication.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -375,9 +366,7 @@ public UploadchatfilesResponse uploadFiles(UploadChatFilesRequest uploadChatFile * @return The response from the API call * @throws Exception if the API call fails */ - public UploadchatfilesResponse uploadFiles( - Optional timezoneOffset, - UploadChatFilesRequest uploadChatFilesRequest) throws Exception { + public UploadchatfilesResponse uploadFiles(Optional timezoneOffset, UploadChatFilesRequest uploadChatFilesRequest) throws Exception { UploadchatfilesRequest request = UploadchatfilesRequest .builder() @@ -385,7 +374,7 @@ public UploadchatfilesResponse uploadFiles( .uploadChatFilesRequest(uploadChatFilesRequest) .build(); RequestOperation operation - = new UploadchatfilesOperation(sdkConfiguration); + = new Uploadchatfiles.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -423,9 +412,7 @@ public GetchatfilesResponse retrieveFiles(GetChatFilesRequest getChatFilesReques * @return The response from the API call * @throws Exception if the API call fails */ - public GetchatfilesResponse retrieveFiles( - Optional timezoneOffset, - GetChatFilesRequest getChatFilesRequest) throws Exception { + public GetchatfilesResponse retrieveFiles(Optional timezoneOffset, GetChatFilesRequest getChatFilesRequest) throws Exception { GetchatfilesRequest request = GetchatfilesRequest .builder() @@ -433,7 +420,7 @@ public GetchatfilesResponse retrieveFiles( .getChatFilesRequest(getChatFilesRequest) .build(); RequestOperation operation - = new GetchatfilesOperation(sdkConfiguration); + = new Getchatfiles.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -471,9 +458,7 @@ public DeletechatfilesResponse deleteFiles(DeleteChatFilesRequest deleteChatFile * @return The response from the API call * @throws Exception if the API call fails */ - public DeletechatfilesResponse deleteFiles( - Optional timezoneOffset, - DeleteChatFilesRequest deleteChatFilesRequest) throws Exception { + public DeletechatfilesResponse deleteFiles(Optional timezoneOffset, DeleteChatFilesRequest deleteChatFilesRequest) throws Exception { DeletechatfilesRequest request = DeletechatfilesRequest .builder() @@ -481,7 +466,7 @@ public DeletechatfilesResponse deleteFiles( .deleteChatFilesRequest(deleteChatFilesRequest) .build(); RequestOperation operation - = new DeletechatfilesOperation(sdkConfiguration); + = new Deletechatfiles.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -519,9 +504,7 @@ public ChatStreamResponse createStream(ChatRequest chatRequest) throws Exception * @return The response from the API call * @throws Exception if the API call fails */ - public ChatStreamResponse createStream( - Optional timezoneOffset, - ChatRequest chatRequest) throws Exception { + public ChatStreamResponse createStream(Optional timezoneOffset, ChatRequest chatRequest) throws Exception { ChatStreamRequest request = ChatStreamRequest .builder() @@ -529,7 +512,7 @@ public ChatStreamResponse createStream( .chatRequest(chatRequest) .build(); RequestOperation operation - = new ChatStreamOperation(sdkConfiguration); + = new ChatStream.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Client.java b/src/main/java/com/glean/api_client/glean_api_client/Client.java index fb350ae8..d455600b 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Client.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Client.java @@ -5,23 +5,23 @@ public class Client { private final SDKConfiguration sdkConfiguration; -private final Activity activity; -private final Announcements announcements; -private final Answers answers; -private final ClientAuthentication authentication; -private final Chat chat; -private final Agents agents; -private final Collections collections; -private final ClientDocuments documents; -private final Insights insights; -private final Messages messages; -private final Pins pins; -private final Search search; -private final Entities entities; -private final ClientShortcuts shortcuts; -private final Verification verification; -private final Tools tools; -private final Governance governance; + private final Activity activity; + private final Announcements announcements; + private final Answers answers; + private final ClientAuthentication authentication; + private final Chat chat; + private final Agents agents; + private final Collections collections; + private final ClientDocuments documents; + private final Insights insights; + private final Messages messages; + private final Pins pins; + private final Search search; + private final Entities entities; + private final ClientShortcuts shortcuts; + private final Verification verification; + private final Tools tools; + private final Governance governance; Client(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; @@ -43,55 +43,73 @@ public class Client { this.tools = new Tools(this.sdkConfiguration); this.governance = new Governance(this.sdkConfiguration); } -public final Activity activity() { + + public final Activity activity() { return activity; } -public final Announcements announcements() { + + public final Announcements announcements() { return announcements; } -public final Answers answers() { + + public final Answers answers() { return answers; } -public final ClientAuthentication authentication() { + + public final ClientAuthentication authentication() { return authentication; } -public final Chat chat() { + + public final Chat chat() { return chat; } -public final Agents agents() { + + public final Agents agents() { return agents; } -public final Collections collections() { + + public final Collections collections() { return collections; } -public final ClientDocuments documents() { + + public final ClientDocuments documents() { return documents; } -public final Insights insights() { + + public final Insights insights() { return insights; } -public final Messages messages() { + + public final Messages messages() { return messages; } -public final Pins pins() { + + public final Pins pins() { return pins; } -public final Search search() { + + public final Search search() { return search; } -public final Entities entities() { + + public final Entities entities() { return entities; } -public final ClientShortcuts shortcuts() { + + public final ClientShortcuts shortcuts() { return shortcuts; } -public final Verification verification() { + + public final Verification verification() { return verification; } -public final Tools tools() { + + public final Tools tools() { return tools; } -public final Governance governance() { + + public final Governance governance() { return governance; } + } diff --git a/src/main/java/com/glean/api_client/glean_api_client/ClientAuthentication.java b/src/main/java/com/glean/api_client/glean_api_client/ClientAuthentication.java index e0460d6e..c10cea4e 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/ClientAuthentication.java +++ b/src/main/java/com/glean/api_client/glean_api_client/ClientAuthentication.java @@ -7,10 +7,8 @@ import com.glean.api_client.glean_api_client.models.operations.CreateauthtokenRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.CreateauthtokenResponse; -import com.glean.api_client.glean_api_client.operations.CreateauthtokenOperation; +import com.glean.api_client.glean_api_client.operations.Createauthtoken; import java.lang.Exception; -import java.util.List; -import java.util.Optional; public class ClientAuthentication { @@ -19,6 +17,7 @@ public class ClientAuthentication { ClientAuthentication(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Create authentication token * @@ -48,7 +47,7 @@ public CreateauthtokenRequestBuilder createToken() { */ public CreateauthtokenResponse createTokenDirect() throws Exception { RequestlessOperation operation - = new CreateauthtokenOperation(sdkConfiguration); + = new Createauthtoken.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest()); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/ClientDocuments.java b/src/main/java/com/glean/api_client/glean_api_client/ClientDocuments.java index 6027eeab..28015bfa 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/ClientDocuments.java +++ b/src/main/java/com/glean/api_client/glean_api_client/ClientDocuments.java @@ -17,12 +17,11 @@ import com.glean.api_client.glean_api_client.models.operations.GetdocumentsbyfacetsResponse; import com.glean.api_client.glean_api_client.models.operations.SummarizeRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.SummarizeResponse; -import com.glean.api_client.glean_api_client.operations.GetdocpermissionsOperation; -import com.glean.api_client.glean_api_client.operations.GetdocumentsOperation; -import com.glean.api_client.glean_api_client.operations.GetdocumentsbyfacetsOperation; -import com.glean.api_client.glean_api_client.operations.SummarizeOperation; +import com.glean.api_client.glean_api_client.operations.Getdocpermissions; +import com.glean.api_client.glean_api_client.operations.Getdocuments; +import com.glean.api_client.glean_api_client.operations.Getdocumentsbyfacets; +import com.glean.api_client.glean_api_client.operations.Summarize; import java.lang.Exception; -import java.util.List; import java.util.Optional; @@ -32,6 +31,7 @@ public class ClientDocuments { ClientDocuments(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Read document permissions * @@ -54,7 +54,7 @@ public GetdocpermissionsRequestBuilder retrievePermissions() { */ public GetdocpermissionsResponse retrievePermissions(GetDocPermissionsRequest request) throws Exception { RequestOperation operation - = new GetdocpermissionsOperation(sdkConfiguration); + = new Getdocpermissions.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -92,7 +92,7 @@ public GetdocumentsResponse retrieveDirect() throws Exception { */ public GetdocumentsResponse retrieve(Optional request) throws Exception { RequestOperation, GetdocumentsResponse> operation - = new GetdocumentsOperation(sdkConfiguration); + = new Getdocuments.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -130,7 +130,7 @@ public GetdocumentsbyfacetsResponse retrieveByFacetsDirect() throws Exception { */ public GetdocumentsbyfacetsResponse retrieveByFacets(Optional request) throws Exception { RequestOperation, GetdocumentsbyfacetsResponse> operation - = new GetdocumentsbyfacetsOperation(sdkConfiguration); + = new Getdocumentsbyfacets.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -156,7 +156,7 @@ public SummarizeRequestBuilder summarize() { */ public SummarizeResponse summarize(SummarizeRequest request) throws Exception { RequestOperation operation - = new SummarizeOperation(sdkConfiguration); + = new Summarize.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/ClientShortcuts.java b/src/main/java/com/glean/api_client/glean_api_client/ClientShortcuts.java index 9ad51239..58e1ff02 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/ClientShortcuts.java +++ b/src/main/java/com/glean/api_client/glean_api_client/ClientShortcuts.java @@ -20,14 +20,12 @@ import com.glean.api_client.glean_api_client.models.operations.ListshortcutsResponse; import com.glean.api_client.glean_api_client.models.operations.UpdateshortcutRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.UpdateshortcutResponse; -import com.glean.api_client.glean_api_client.operations.CreateshortcutOperation; -import com.glean.api_client.glean_api_client.operations.DeleteshortcutOperation; -import com.glean.api_client.glean_api_client.operations.GetshortcutOperation; -import com.glean.api_client.glean_api_client.operations.ListshortcutsOperation; -import com.glean.api_client.glean_api_client.operations.UpdateshortcutOperation; +import com.glean.api_client.glean_api_client.operations.Createshortcut; +import com.glean.api_client.glean_api_client.operations.Deleteshortcut; +import com.glean.api_client.glean_api_client.operations.Getshortcut; +import com.glean.api_client.glean_api_client.operations.Listshortcuts; +import com.glean.api_client.glean_api_client.operations.Updateshortcut; import java.lang.Exception; -import java.util.List; -import java.util.Optional; public class ClientShortcuts { @@ -36,6 +34,7 @@ public class ClientShortcuts { ClientShortcuts(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Create shortcut * @@ -58,7 +57,7 @@ public CreateshortcutRequestBuilder create() { */ public CreateshortcutResponse create(CreateShortcutRequest request) throws Exception { RequestOperation operation - = new CreateshortcutOperation(sdkConfiguration); + = new Createshortcut.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -84,7 +83,7 @@ public DeleteshortcutRequestBuilder delete() { */ public DeleteshortcutResponse delete(DeleteShortcutRequest request) throws Exception { RequestOperation operation - = new DeleteshortcutOperation(sdkConfiguration); + = new Deleteshortcut.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -110,7 +109,7 @@ public GetshortcutRequestBuilder retrieve() { */ public GetshortcutResponse retrieve(GetShortcutRequestUnion request) throws Exception { RequestOperation operation - = new GetshortcutOperation(sdkConfiguration); + = new Getshortcut.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -136,7 +135,7 @@ public ListshortcutsRequestBuilder list() { */ public ListshortcutsResponse list(ListShortcutsPaginatedRequest request) throws Exception { RequestOperation operation - = new ListshortcutsOperation(sdkConfiguration); + = new Listshortcuts.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -162,7 +161,7 @@ public UpdateshortcutRequestBuilder update() { */ public UpdateshortcutResponse update(UpdateShortcutRequest request) throws Exception { RequestOperation operation - = new UpdateshortcutOperation(sdkConfiguration); + = new Updateshortcut.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Collections.java b/src/main/java/com/glean/api_client/glean_api_client/Collections.java index 4de07a8b..47bfe75a 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Collections.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Collections.java @@ -29,17 +29,15 @@ import com.glean.api_client.glean_api_client.models.operations.GetcollectionResponse; import com.glean.api_client.glean_api_client.models.operations.ListcollectionsRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.ListcollectionsResponse; -import com.glean.api_client.glean_api_client.operations.AddcollectionitemsOperation; -import com.glean.api_client.glean_api_client.operations.CreatecollectionOperation; -import com.glean.api_client.glean_api_client.operations.DeletecollectionOperation; -import com.glean.api_client.glean_api_client.operations.DeletecollectionitemOperation; -import com.glean.api_client.glean_api_client.operations.EditcollectionOperation; -import com.glean.api_client.glean_api_client.operations.EditcollectionitemOperation; -import com.glean.api_client.glean_api_client.operations.GetcollectionOperation; -import com.glean.api_client.glean_api_client.operations.ListcollectionsOperation; +import com.glean.api_client.glean_api_client.operations.Addcollectionitems; +import com.glean.api_client.glean_api_client.operations.Createcollection; +import com.glean.api_client.glean_api_client.operations.Deletecollection; +import com.glean.api_client.glean_api_client.operations.Deletecollectionitem; +import com.glean.api_client.glean_api_client.operations.Editcollection; +import com.glean.api_client.glean_api_client.operations.Editcollectionitem; +import com.glean.api_client.glean_api_client.operations.Getcollection; +import com.glean.api_client.glean_api_client.operations.Listcollections; import java.lang.Exception; -import java.util.List; -import java.util.Optional; public class Collections { @@ -48,6 +46,7 @@ public class Collections { Collections(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Add Collection item * @@ -70,7 +69,7 @@ public AddcollectionitemsRequestBuilder addItems() { */ public AddcollectionitemsResponse addItems(AddCollectionItemsRequest request) throws Exception { RequestOperation operation - = new AddcollectionitemsOperation(sdkConfiguration); + = new Addcollectionitems.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -96,7 +95,7 @@ public CreatecollectionRequestBuilder create() { */ public CreatecollectionResponse create(CreateCollectionRequest request) throws Exception { RequestOperation operation - = new CreatecollectionOperation(sdkConfiguration); + = new Createcollection.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -122,7 +121,7 @@ public DeletecollectionRequestBuilder delete() { */ public DeletecollectionResponse delete(DeleteCollectionRequest request) throws Exception { RequestOperation operation - = new DeletecollectionOperation(sdkConfiguration); + = new Deletecollection.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -148,7 +147,7 @@ public DeletecollectionitemRequestBuilder deleteItem() { */ public DeletecollectionitemResponse deleteItem(DeleteCollectionItemRequest request) throws Exception { RequestOperation operation - = new DeletecollectionitemOperation(sdkConfiguration); + = new Deletecollectionitem.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -174,7 +173,7 @@ public EditcollectionRequestBuilder update() { */ public EditcollectionResponse update(EditCollectionRequest request) throws Exception { RequestOperation operation - = new EditcollectionOperation(sdkConfiguration); + = new Editcollection.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -200,7 +199,7 @@ public EditcollectionitemRequestBuilder updateItem() { */ public EditcollectionitemResponse updateItem(EditCollectionItemRequest request) throws Exception { RequestOperation operation - = new EditcollectionitemOperation(sdkConfiguration); + = new Editcollectionitem.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -226,7 +225,7 @@ public GetcollectionRequestBuilder retrieve() { */ public GetcollectionResponse retrieve(GetCollectionRequest request) throws Exception { RequestOperation operation - = new GetcollectionOperation(sdkConfiguration); + = new Getcollection.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -252,7 +251,7 @@ public ListcollectionsRequestBuilder list() { */ public ListcollectionsResponse list(ListCollectionsRequest request) throws Exception { RequestOperation operation - = new ListcollectionsOperation(sdkConfiguration); + = new Listcollections.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Data.java b/src/main/java/com/glean/api_client/glean_api_client/Data.java index 26d1f16f..5876a234 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Data.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Data.java @@ -5,18 +5,21 @@ public class Data { private final SDKConfiguration sdkConfiguration; -private final Policies policies; -private final Reports reports; + private final Policies policies; + private final Reports reports; Data(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; this.policies = new Policies(this.sdkConfiguration); this.reports = new Reports(this.sdkConfiguration); } -public final Policies policies() { + + public final Policies policies() { return policies; } -public final Reports reports() { + + public final Reports reports() { return reports; } + } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Datasource.java b/src/main/java/com/glean/api_client/glean_api_client/Datasource.java index 613ede2e..1d883f12 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Datasource.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Datasource.java @@ -8,11 +8,9 @@ import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceStatusRequest; import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceStatusRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceStatusResponse; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DebugDatasourceStatusOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DebugDatasourceStatus; import java.lang.Exception; import java.lang.String; -import java.util.List; -import java.util.Optional; public class Datasource { @@ -21,12 +19,13 @@ public class Datasource { Datasource(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Beta: Get datasource status * *

Gather information about the datasource's overall status. Currently in beta, might undergo breaking changes without prior notice. * - *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. + *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. * * @return The call builder */ @@ -39,7 +38,7 @@ public PostApiIndexV1DebugDatasourceStatusRequestBuilder status() { * *

Gather information about the datasource's overall status. Currently in beta, might undergo breaking changes without prior notice. * - *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. + *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. * * @param datasource The datasource to get debug status for. * @return The response from the API call @@ -52,7 +51,7 @@ public PostApiIndexV1DebugDatasourceStatusResponse status(String datasource) thr .datasource(datasource) .build(); RequestOperation operation - = new PostApiIndexV1DebugDatasourceStatusOperation(sdkConfiguration); + = new PostApiIndexV1DebugDatasourceStatus.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Datasources.java b/src/main/java/com/glean/api_client/glean_api_client/Datasources.java index da93fc3f..fe7c42c9 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Datasources.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Datasources.java @@ -11,11 +11,9 @@ import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1AdddatasourceResponse; import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1GetdatasourceconfigRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1GetdatasourceconfigResponse; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1AdddatasourceOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1GetdatasourceconfigOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Adddatasource; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Getdatasourceconfig; import java.lang.Exception; -import java.util.List; -import java.util.Optional; public class Datasources { @@ -24,6 +22,7 @@ public class Datasources { Datasources(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Add or update datasource * @@ -46,7 +45,7 @@ public PostApiIndexV1AdddatasourceRequestBuilder add() { */ public PostApiIndexV1AdddatasourceResponse add(CustomDatasourceConfig request) throws Exception { RequestOperation operation - = new PostApiIndexV1AdddatasourceOperation(sdkConfiguration); + = new PostApiIndexV1Adddatasource.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -72,7 +71,7 @@ public PostApiIndexV1GetdatasourceconfigRequestBuilder retrieveConfig() { */ public PostApiIndexV1GetdatasourceconfigResponse retrieveConfig(GetDatasourceConfigRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1GetdatasourceconfigOperation(sdkConfiguration); + = new PostApiIndexV1Getdatasourceconfig.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Entities.java b/src/main/java/com/glean/api_client/glean_api_client/Entities.java index 4f1ff3ad..18d961eb 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Entities.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Entities.java @@ -11,11 +11,9 @@ import com.glean.api_client.glean_api_client.models.operations.ListentitiesResponse; import com.glean.api_client.glean_api_client.models.operations.PeopleRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.PeopleResponse; -import com.glean.api_client.glean_api_client.operations.ListentitiesOperation; -import com.glean.api_client.glean_api_client.operations.PeopleOperation; +import com.glean.api_client.glean_api_client.operations.Listentities; +import com.glean.api_client.glean_api_client.operations.People; import java.lang.Exception; -import java.util.List; -import java.util.Optional; public class Entities { @@ -24,6 +22,7 @@ public class Entities { Entities(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * List entities * @@ -46,7 +45,7 @@ public ListentitiesRequestBuilder list() { */ public ListentitiesResponse list(ListEntitiesRequest request) throws Exception { RequestOperation operation - = new ListentitiesOperation(sdkConfiguration); + = new Listentities.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -72,7 +71,7 @@ public PeopleRequestBuilder readPeople() { */ public PeopleResponse readPeople(PeopleRequest request) throws Exception { RequestOperation operation - = new PeopleOperation(sdkConfiguration); + = new People.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Governance.java b/src/main/java/com/glean/api_client/glean_api_client/Governance.java index 4d3f0707..6200f4dc 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Governance.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Governance.java @@ -5,18 +5,21 @@ public class Governance { private final SDKConfiguration sdkConfiguration; -private final Data data; -private final GovernanceDocuments documents; + private final Data data; + private final GovernanceDocuments documents; Governance(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; this.data = new Data(this.sdkConfiguration); this.documents = new GovernanceDocuments(this.sdkConfiguration); } -public final Data data() { + + public final Data data() { return data; } -public final GovernanceDocuments documents() { + + public final GovernanceDocuments documents() { return documents; } + } diff --git a/src/main/java/com/glean/api_client/glean_api_client/GovernanceDocuments.java b/src/main/java/com/glean/api_client/glean_api_client/GovernanceDocuments.java index fc8ca9f9..f114eef9 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/GovernanceDocuments.java +++ b/src/main/java/com/glean/api_client/glean_api_client/GovernanceDocuments.java @@ -5,13 +5,15 @@ public class GovernanceDocuments { private final SDKConfiguration sdkConfiguration; -private final Visibilityoverrides visibilityoverrides; + private final Visibilityoverrides visibilityoverrides; GovernanceDocuments(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; this.visibilityoverrides = new Visibilityoverrides(this.sdkConfiguration); } -public final Visibilityoverrides visibilityoverrides() { + + public final Visibilityoverrides visibilityoverrides() { return visibilityoverrides; } + } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Indexing.java b/src/main/java/com/glean/api_client/glean_api_client/Indexing.java index 61199883..3eaeba65 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Indexing.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Indexing.java @@ -5,13 +5,13 @@ public class Indexing { private final SDKConfiguration sdkConfiguration; -private final IndexingDocuments documents; -private final Permissions permissions; -private final Datasource datasource; -private final People people; -private final Datasources datasources; -private final IndexingAuthentication authentication; -private final IndexingShortcuts shortcuts; + private final IndexingDocuments documents; + private final Permissions permissions; + private final Datasource datasource; + private final People people; + private final Datasources datasources; + private final IndexingAuthentication authentication; + private final IndexingShortcuts shortcuts; Indexing(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; @@ -23,25 +23,33 @@ public class Indexing { this.authentication = new IndexingAuthentication(this.sdkConfiguration); this.shortcuts = new IndexingShortcuts(this.sdkConfiguration); } -public final IndexingDocuments documents() { + + public final IndexingDocuments documents() { return documents; } -public final Permissions permissions() { + + public final Permissions permissions() { return permissions; } -public final Datasource datasource() { + + public final Datasource datasource() { return datasource; } -public final People people() { + + public final People people() { return people; } -public final Datasources datasources() { + + public final Datasources datasources() { return datasources; } -public final IndexingAuthentication authentication() { + + public final IndexingAuthentication authentication() { return authentication; } -public final IndexingShortcuts shortcuts() { + + public final IndexingShortcuts shortcuts() { return shortcuts; } + } diff --git a/src/main/java/com/glean/api_client/glean_api_client/IndexingAuthentication.java b/src/main/java/com/glean/api_client/glean_api_client/IndexingAuthentication.java index f25333bb..93338c46 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/IndexingAuthentication.java +++ b/src/main/java/com/glean/api_client/glean_api_client/IndexingAuthentication.java @@ -7,10 +7,8 @@ import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1RotatetokenRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1RotatetokenResponse; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1RotatetokenOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Rotatetoken; import java.lang.Exception; -import java.util.List; -import java.util.Optional; public class IndexingAuthentication { @@ -19,10 +17,11 @@ public class IndexingAuthentication { IndexingAuthentication(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Rotate token * - *

Rotates the secret value inside the Indexing API token and returns the new raw secret. All other properties of the token are unchanged. In order to rotate the secret value, include the token as the bearer token in the `/rotatetoken` request. Please refer to [Token rotation](https://developers.glean.com/docs/indexing_api_token_rotation/) documentation for more information. + *

Rotates the secret value inside the Indexing API token and returns the new raw secret. All other properties of the token are unchanged. In order to rotate the secret value, include the token as the bearer token in the `/rotatetoken` request. Please refer to [Token rotation](https://developers.glean.com/indexing/authentication/token-rotation) documentation for more information. * * @return The call builder */ @@ -33,14 +32,14 @@ public PostApiIndexV1RotatetokenRequestBuilder rotateToken() { /** * Rotate token * - *

Rotates the secret value inside the Indexing API token and returns the new raw secret. All other properties of the token are unchanged. In order to rotate the secret value, include the token as the bearer token in the `/rotatetoken` request. Please refer to [Token rotation](https://developers.glean.com/docs/indexing_api_token_rotation/) documentation for more information. + *

Rotates the secret value inside the Indexing API token and returns the new raw secret. All other properties of the token are unchanged. In order to rotate the secret value, include the token as the bearer token in the `/rotatetoken` request. Please refer to [Token rotation](https://developers.glean.com/indexing/authentication/token-rotation) documentation for more information. * * @return The response from the API call * @throws Exception if the API call fails */ public PostApiIndexV1RotatetokenResponse rotateTokenDirect() throws Exception { RequestlessOperation operation - = new PostApiIndexV1RotatetokenOperation(sdkConfiguration); + = new PostApiIndexV1Rotatetoken.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest()); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/IndexingDocuments.java b/src/main/java/com/glean/api_client/glean_api_client/IndexingDocuments.java index de20aed6..129a2946 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/IndexingDocuments.java +++ b/src/main/java/com/glean/api_client/glean_api_client/IndexingDocuments.java @@ -37,20 +37,19 @@ import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexdocumentsResponse; import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1ProcessalldocumentsRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1ProcessalldocumentsResponse; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1BulkindexdocumentsOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1CheckdocumentaccessOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DebugDatasourceDocumentOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DebugDatasourceDocumentsOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DeletedocumentOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1GetdocumentcountOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1GetdocumentstatusOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1IndexdocumentOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1IndexdocumentsOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1ProcessalldocumentsOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Bulkindexdocuments; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Checkdocumentaccess; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DebugDatasourceDocument; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DebugDatasourceDocuments; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Deletedocument; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Getdocumentcount; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Getdocumentstatus; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Indexdocument; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Indexdocuments; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Processalldocuments; import java.lang.Deprecated; import java.lang.Exception; import java.lang.String; -import java.util.List; import java.util.Optional; @@ -60,6 +59,7 @@ public class IndexingDocuments { IndexingDocuments(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Index document * @@ -82,14 +82,14 @@ public PostApiIndexV1IndexdocumentRequestBuilder addOrUpdate() { */ public PostApiIndexV1IndexdocumentResponse addOrUpdate(IndexDocumentRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1IndexdocumentOperation(sdkConfiguration); + = new PostApiIndexV1Indexdocument.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Index documents * - *

Adds or updates multiple documents in the index. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#choosing-indexdocuments-vs-bulkindexdocuments) documentation for an explanation of when to use this endpoint. + *

Adds or updates multiple documents in the index. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-indexing/choosing-indexdocuments-vs-bulkindexdocuments) documentation for an explanation of when to use this endpoint. * * @return The call builder */ @@ -100,7 +100,7 @@ public PostApiIndexV1IndexdocumentsRequestBuilder index() { /** * Index documents * - *

Adds or updates multiple documents in the index. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#choosing-indexdocuments-vs-bulkindexdocuments) documentation for an explanation of when to use this endpoint. + *

Adds or updates multiple documents in the index. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-indexing/choosing-indexdocuments-vs-bulkindexdocuments) documentation for an explanation of when to use this endpoint. * * @param request The request object containing all the parameters for the API call. * @return The response from the API call @@ -108,14 +108,14 @@ public PostApiIndexV1IndexdocumentsRequestBuilder index() { */ public PostApiIndexV1IndexdocumentsResponse index(IndexDocumentsRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1IndexdocumentsOperation(sdkConfiguration); + = new PostApiIndexV1Indexdocuments.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Bulk index documents * - *

Replaces the documents in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + *

Replaces the documents in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. * * @return The call builder */ @@ -126,7 +126,7 @@ public PostApiIndexV1BulkindexdocumentsRequestBuilder bulkIndex() { /** * Bulk index documents * - *

Replaces the documents in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + *

Replaces the documents in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. * * @param request The request object containing all the parameters for the API call. * @return The response from the API call @@ -134,7 +134,7 @@ public PostApiIndexV1BulkindexdocumentsRequestBuilder bulkIndex() { */ public PostApiIndexV1BulkindexdocumentsResponse bulkIndex(BulkIndexDocumentsRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1BulkindexdocumentsOperation(sdkConfiguration); + = new PostApiIndexV1Bulkindexdocuments.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -202,7 +202,7 @@ public PostApiIndexV1ProcessalldocumentsResponse processAllDirect() throws Excep */ public PostApiIndexV1ProcessalldocumentsResponse processAll(Optional request) throws Exception { RequestOperation, PostApiIndexV1ProcessalldocumentsResponse> operation - = new PostApiIndexV1ProcessalldocumentsOperation(sdkConfiguration); + = new PostApiIndexV1Processalldocuments.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -228,7 +228,7 @@ public PostApiIndexV1DeletedocumentRequestBuilder delete() { */ public PostApiIndexV1DeletedocumentResponse delete(DeleteDocumentRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1DeletedocumentOperation(sdkConfiguration); + = new PostApiIndexV1Deletedocument.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -237,7 +237,7 @@ public PostApiIndexV1DeletedocumentResponse delete(DeleteDocumentRequest request * *

Gives various information that would help in debugging related to a particular document. Currently in beta, might undergo breaking changes without prior notice. * - *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. + *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. * * @return The call builder */ @@ -250,16 +250,14 @@ public PostApiIndexV1DebugDatasourceDocumentRequestBuilder debug() { * *

Gives various information that would help in debugging related to a particular document. Currently in beta, might undergo breaking changes without prior notice. * - *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. + *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. * * @param datasource The datasource to which the document belongs * @param debugDocumentRequest Describes the request body of the /debug/{datasource}/document API call. * @return The response from the API call * @throws Exception if the API call fails */ - public PostApiIndexV1DebugDatasourceDocumentResponse debug( - String datasource, - DebugDocumentRequest debugDocumentRequest) throws Exception { + public PostApiIndexV1DebugDatasourceDocumentResponse debug(String datasource, DebugDocumentRequest debugDocumentRequest) throws Exception { PostApiIndexV1DebugDatasourceDocumentRequest request = PostApiIndexV1DebugDatasourceDocumentRequest .builder() @@ -267,7 +265,7 @@ public PostApiIndexV1DebugDatasourceDocumentResponse debug( .debugDocumentRequest(debugDocumentRequest) .build(); RequestOperation operation - = new PostApiIndexV1DebugDatasourceDocumentOperation(sdkConfiguration); + = new PostApiIndexV1DebugDatasourceDocument.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -276,7 +274,7 @@ public PostApiIndexV1DebugDatasourceDocumentResponse debug( * *

Gives various information that would help in debugging related to a batch of documents. Currently in beta, might undergo breaking changes without prior notice. * - *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. + *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. * * @return The call builder */ @@ -289,16 +287,14 @@ public PostApiIndexV1DebugDatasourceDocumentsRequestBuilder debugMany() { * *

Gives various information that would help in debugging related to a batch of documents. Currently in beta, might undergo breaking changes without prior notice. * - *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. + *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. * * @param datasource The datasource to which the document belongs * @param debugDocumentsRequest Describes the request body of the /debug/{datasource}/documents API call. * @return The response from the API call * @throws Exception if the API call fails */ - public PostApiIndexV1DebugDatasourceDocumentsResponse debugMany( - String datasource, - DebugDocumentsRequest debugDocumentsRequest) throws Exception { + public PostApiIndexV1DebugDatasourceDocumentsResponse debugMany(String datasource, DebugDocumentsRequest debugDocumentsRequest) throws Exception { PostApiIndexV1DebugDatasourceDocumentsRequest request = PostApiIndexV1DebugDatasourceDocumentsRequest .builder() @@ -306,7 +302,7 @@ public PostApiIndexV1DebugDatasourceDocumentsResponse debugMany( .debugDocumentsRequest(debugDocumentsRequest) .build(); RequestOperation operation - = new PostApiIndexV1DebugDatasourceDocumentsOperation(sdkConfiguration); + = new PostApiIndexV1DebugDatasourceDocuments.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -315,7 +311,7 @@ public PostApiIndexV1DebugDatasourceDocumentsResponse debugMany( * *

Check if a given user has access to access a document in a custom datasource * - *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. + *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. * * @return The call builder */ @@ -328,7 +324,7 @@ public PostApiIndexV1CheckdocumentaccessRequestBuilder checkAccess() { * *

Check if a given user has access to access a document in a custom datasource * - *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. + *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. * * @param request The request object containing all the parameters for the API call. * @return The response from the API call @@ -336,7 +332,7 @@ public PostApiIndexV1CheckdocumentaccessRequestBuilder checkAccess() { */ public PostApiIndexV1CheckdocumentaccessResponse checkAccess(CheckDocumentAccessRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1CheckdocumentaccessOperation(sdkConfiguration); + = new PostApiIndexV1Checkdocumentaccess.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -345,7 +341,7 @@ public PostApiIndexV1CheckdocumentaccessResponse checkAccess(CheckDocumentAccess * *

Intended for debugging/validation. Fetches the current upload and indexing status of documents. * - *

Tip: Use [/debug/{datasource}/document](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/#debug-datasource-document) for richer information. + *

Tip: Use [/debug/{datasource}/document](https://developers.glean.com/indexing/debugging/datasource-document) for richer information. * * @return The call builder * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. @@ -360,7 +356,7 @@ public PostApiIndexV1GetdocumentstatusRequestBuilder status() { * *

Intended for debugging/validation. Fetches the current upload and indexing status of documents. * - *

Tip: Use [/debug/{datasource}/document](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/#debug-datasource-document) for richer information. + *

Tip: Use [/debug/{datasource}/document](https://developers.glean.com/indexing/debugging/datasource-document) for richer information. * * @param request The request object containing all the parameters for the API call. * @return The response from the API call @@ -370,7 +366,7 @@ public PostApiIndexV1GetdocumentstatusRequestBuilder status() { @Deprecated public PostApiIndexV1GetdocumentstatusResponse status(GetDocumentStatusRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1GetdocumentstatusOperation(sdkConfiguration); + = new PostApiIndexV1Getdocumentstatus.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -379,7 +375,7 @@ public PostApiIndexV1GetdocumentstatusResponse status(GetDocumentStatusRequest r * *

Fetches document count for the specified custom datasource. * - *

Tip: Use [/debug/{datasource}/status](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/#debug-datasource-status) for richer information. + *

Tip: Use [/debug/{datasource}/status](https://developers.glean.com/indexing/debugging/datasource-status) for richer information. * * @return The call builder * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. @@ -394,7 +390,7 @@ public PostApiIndexV1GetdocumentcountRequestBuilder count() { * *

Fetches document count for the specified custom datasource. * - *

Tip: Use [/debug/{datasource}/status](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/#debug-datasource-status) for richer information. + *

Tip: Use [/debug/{datasource}/status](https://developers.glean.com/indexing/debugging/datasource-status) for richer information. * * @param request The request object containing all the parameters for the API call. * @return The response from the API call @@ -404,7 +400,7 @@ public PostApiIndexV1GetdocumentcountRequestBuilder count() { @Deprecated public PostApiIndexV1GetdocumentcountResponse count(GetDocumentCountRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1GetdocumentcountOperation(sdkConfiguration); + = new PostApiIndexV1Getdocumentcount.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/IndexingShortcuts.java b/src/main/java/com/glean/api_client/glean_api_client/IndexingShortcuts.java index 25f88664..edc0df1e 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/IndexingShortcuts.java +++ b/src/main/java/com/glean/api_client/glean_api_client/IndexingShortcuts.java @@ -11,11 +11,9 @@ import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BulkindexshortcutsResponse; import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1UploadshortcutsRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1UploadshortcutsResponse; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1BulkindexshortcutsOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1UploadshortcutsOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Bulkindexshortcuts; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Uploadshortcuts; import java.lang.Exception; -import java.util.List; -import java.util.Optional; public class IndexingShortcuts { @@ -24,6 +22,7 @@ public class IndexingShortcuts { IndexingShortcuts(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Bulk index external shortcuts * @@ -46,7 +45,7 @@ public PostApiIndexV1BulkindexshortcutsRequestBuilder bulkIndex() { */ public PostApiIndexV1BulkindexshortcutsResponse bulkIndex(BulkIndexShortcutsRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1BulkindexshortcutsOperation(sdkConfiguration); + = new PostApiIndexV1Bulkindexshortcuts.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -72,7 +71,7 @@ public PostApiIndexV1UploadshortcutsRequestBuilder upload() { */ public PostApiIndexV1UploadshortcutsResponse upload(UploadShortcutsRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1UploadshortcutsOperation(sdkConfiguration); + = new PostApiIndexV1Uploadshortcuts.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Insights.java b/src/main/java/com/glean/api_client/glean_api_client/Insights.java index cf6b0a0e..0c07bf6f 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Insights.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Insights.java @@ -8,10 +8,7 @@ import com.glean.api_client.glean_api_client.models.components.InsightsRequest; import com.glean.api_client.glean_api_client.models.operations.InsightsRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.InsightsResponse; -import com.glean.api_client.glean_api_client.operations.InsightsOperation; import java.lang.Exception; -import java.util.List; -import java.util.Optional; public class Insights { @@ -20,6 +17,7 @@ public class Insights { Insights(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Read insights * @@ -42,7 +40,7 @@ public InsightsRequestBuilder retrieve() { */ public InsightsResponse retrieve(InsightsRequest request) throws Exception { RequestOperation operation - = new InsightsOperation(sdkConfiguration); + = new com.glean.api_client.glean_api_client.operations.Insights.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Messages.java b/src/main/java/com/glean/api_client/glean_api_client/Messages.java index fea3f5f0..b7702569 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Messages.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Messages.java @@ -8,10 +8,7 @@ import com.glean.api_client.glean_api_client.models.components.MessagesRequest; import com.glean.api_client.glean_api_client.models.operations.MessagesRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.MessagesResponse; -import com.glean.api_client.glean_api_client.operations.MessagesOperation; import java.lang.Exception; -import java.util.List; -import java.util.Optional; public class Messages { @@ -20,6 +17,7 @@ public class Messages { Messages(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Read messages * @@ -42,7 +40,7 @@ public MessagesRequestBuilder retrieve() { */ public MessagesResponse retrieve(MessagesRequest request) throws Exception { RequestOperation operation - = new MessagesOperation(sdkConfiguration); + = new com.glean.api_client.glean_api_client.operations.Messages.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/People.java b/src/main/java/com/glean/api_client/glean_api_client/People.java index 2262f6f1..ae325e4b 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/People.java +++ b/src/main/java/com/glean/api_client/glean_api_client/People.java @@ -33,20 +33,18 @@ import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexteamResponse; import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1ProcessallemployeesandteamsRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1ProcessallemployeesandteamsResponse; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1BulkindexemployeesOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1BulkindexteamsOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DebugDatasourceUserOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DeleteemployeeOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DeleteteamOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1GetusercountOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1IndexemployeeOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1IndexteamOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1ProcessallemployeesandteamsOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Bulkindexemployees; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Bulkindexteams; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DebugDatasourceUser; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Deleteemployee; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Deleteteam; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Getusercount; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Indexemployee; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Indexteam; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Processallemployeesandteams; import java.lang.Deprecated; import java.lang.Exception; import java.lang.String; -import java.util.List; -import java.util.Optional; public class People { @@ -55,12 +53,13 @@ public class People { People(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Beta: Get user information * *

Gives various information that would help in debugging related to a particular user. Currently in beta, might undergo breaking changes without prior notice. * - *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. + *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. * * @return The call builder */ @@ -73,16 +72,14 @@ public PostApiIndexV1DebugDatasourceUserRequestBuilder debug() { * *

Gives various information that would help in debugging related to a particular user. Currently in beta, might undergo breaking changes without prior notice. * - *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/) for more information. + *

Tip: Refer to the [Troubleshooting tutorial](https://developers.glean.com/indexing/debugging/datasource-config) for more information. * * @param datasource The datasource to which the user belongs * @param debugUserRequest Describes the request body of the /debug/{datasource}/user API call * @return The response from the API call * @throws Exception if the API call fails */ - public PostApiIndexV1DebugDatasourceUserResponse debug( - String datasource, - DebugUserRequest debugUserRequest) throws Exception { + public PostApiIndexV1DebugDatasourceUserResponse debug(String datasource, DebugUserRequest debugUserRequest) throws Exception { PostApiIndexV1DebugDatasourceUserRequest request = PostApiIndexV1DebugDatasourceUserRequest .builder() @@ -90,7 +87,7 @@ public PostApiIndexV1DebugDatasourceUserResponse debug( .debugUserRequest(debugUserRequest) .build(); RequestOperation operation - = new PostApiIndexV1DebugDatasourceUserOperation(sdkConfiguration); + = new PostApiIndexV1DebugDatasourceUser.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -99,7 +96,7 @@ public PostApiIndexV1DebugDatasourceUserResponse debug( * *

Fetches user count for the specified custom datasource. * - *

Tip: Use [/debug/{datasource}/status](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/#debug-datasource-status) for richer information. + *

Tip: Use [/debug/{datasource}/status](https://developers.glean.com/indexing/debugging/datasource-status) for richer information. * * @return The call builder * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. @@ -114,7 +111,7 @@ public PostApiIndexV1GetusercountRequestBuilder count() { * *

Fetches user count for the specified custom datasource. * - *

Tip: Use [/debug/{datasource}/status](https://developers.glean.com/docs/indexing_api/indexing_api_troubleshooting/#debug-datasource-status) for richer information. + *

Tip: Use [/debug/{datasource}/status](https://developers.glean.com/indexing/debugging/datasource-status) for richer information. * * @param request The request object containing all the parameters for the API call. * @return The response from the API call @@ -124,7 +121,7 @@ public PostApiIndexV1GetusercountRequestBuilder count() { @Deprecated public PostApiIndexV1GetusercountResponse count(GetUserCountRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1GetusercountOperation(sdkConfiguration); + = new PostApiIndexV1Getusercount.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -150,14 +147,14 @@ public PostApiIndexV1IndexemployeeRequestBuilder index() { */ public PostApiIndexV1IndexemployeeResponse index(IndexEmployeeRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1IndexemployeeOperation(sdkConfiguration); + = new PostApiIndexV1Indexemployee.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Bulk index employees * - *

Replaces all the currently indexed employees using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + *

Replaces all the currently indexed employees using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. * * @return The call builder */ @@ -168,7 +165,7 @@ public PostApiIndexV1BulkindexemployeesRequestBuilder bulkIndex() { /** * Bulk index employees * - *

Replaces all the currently indexed employees using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + *

Replaces all the currently indexed employees using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. * * @param request The request object containing all the parameters for the API call. * @return The response from the API call @@ -176,7 +173,7 @@ public PostApiIndexV1BulkindexemployeesRequestBuilder bulkIndex() { */ public PostApiIndexV1BulkindexemployeesResponse bulkIndex(BulkIndexEmployeesRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1BulkindexemployeesOperation(sdkConfiguration); + = new PostApiIndexV1Bulkindexemployees.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -201,7 +198,7 @@ public PostApiIndexV1ProcessallemployeesandteamsRequestBuilder processAllEmploye */ public PostApiIndexV1ProcessallemployeesandteamsResponse processAllEmployeesAndTeamsDirect() throws Exception { RequestlessOperation operation - = new PostApiIndexV1ProcessallemployeesandteamsOperation(sdkConfiguration); + = new PostApiIndexV1Processallemployeesandteams.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest()); } @@ -227,7 +224,7 @@ public PostApiIndexV1DeleteemployeeRequestBuilder delete() { */ public PostApiIndexV1DeleteemployeeResponse delete(DeleteEmployeeRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1DeleteemployeeOperation(sdkConfiguration); + = new PostApiIndexV1Deleteemployee.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -253,7 +250,7 @@ public PostApiIndexV1IndexteamRequestBuilder indexTeam() { */ public PostApiIndexV1IndexteamResponse indexTeam(IndexTeamRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1IndexteamOperation(sdkConfiguration); + = new PostApiIndexV1Indexteam.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -279,14 +276,14 @@ public PostApiIndexV1DeleteteamRequestBuilder deleteTeam() { */ public PostApiIndexV1DeleteteamResponse deleteTeam(DeleteTeamRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1DeleteteamOperation(sdkConfiguration); + = new PostApiIndexV1Deleteteam.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Bulk index teams * - *

Replaces all the currently indexed teams using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + *

Replaces all the currently indexed teams using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. * * @return The call builder */ @@ -297,7 +294,7 @@ public PostApiIndexV1BulkindexteamsRequestBuilder bulkIndexTeams() { /** * Bulk index teams * - *

Replaces all the currently indexed teams using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + *

Replaces all the currently indexed teams using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. * * @param request The request object containing all the parameters for the API call. * @return The response from the API call @@ -305,7 +302,7 @@ public PostApiIndexV1BulkindexteamsRequestBuilder bulkIndexTeams() { */ public PostApiIndexV1BulkindexteamsResponse bulkIndexTeams(BulkIndexTeamsRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1BulkindexteamsOperation(sdkConfiguration); + = new PostApiIndexV1Bulkindexteams.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Permissions.java b/src/main/java/com/glean/api_client/glean_api_client/Permissions.java index e993a39c..d96ef17f 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Permissions.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Permissions.java @@ -41,20 +41,19 @@ import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1ProcessallmembershipsResponse; import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1UpdatepermissionsRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1UpdatepermissionsResponse; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1BetausersOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1BulkindexgroupsOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1BulkindexmembershipsOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1BulkindexusersOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DeletegroupOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DeletemembershipOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DeleteuserOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1IndexgroupOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1IndexmembershipOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1IndexuserOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1ProcessallmembershipsOperation; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1UpdatepermissionsOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Betausers; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Bulkindexgroups; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Bulkindexmemberships; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Bulkindexusers; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Deletegroup; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Deletemembership; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Deleteuser; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Indexgroup; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Indexmembership; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Indexuser; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Processallmemberships; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Updatepermissions; import java.lang.Exception; -import java.util.List; import java.util.Optional; @@ -64,6 +63,7 @@ public class Permissions { Permissions(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Update document permissions * @@ -86,7 +86,7 @@ public PostApiIndexV1UpdatepermissionsRequestBuilder updatePermissions() { */ public PostApiIndexV1UpdatepermissionsResponse updatePermissions(UpdatePermissionsRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1UpdatepermissionsOperation(sdkConfiguration); + = new PostApiIndexV1Updatepermissions.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -112,14 +112,14 @@ public PostApiIndexV1IndexuserRequestBuilder indexUser() { */ public PostApiIndexV1IndexuserResponse indexUser(IndexUserRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1IndexuserOperation(sdkConfiguration); + = new PostApiIndexV1Indexuser.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Bulk index users * - *

Replaces the users in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + *

Replaces the users in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. * * @return The call builder */ @@ -130,7 +130,7 @@ public PostApiIndexV1BulkindexusersRequestBuilder bulkIndexUsers() { /** * Bulk index users * - *

Replaces the users in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + *

Replaces the users in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. * * @param request The request object containing all the parameters for the API call. * @return The response from the API call @@ -138,7 +138,7 @@ public PostApiIndexV1BulkindexusersRequestBuilder bulkIndexUsers() { */ public PostApiIndexV1BulkindexusersResponse bulkIndexUsers(BulkIndexUsersRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1BulkindexusersOperation(sdkConfiguration); + = new PostApiIndexV1Bulkindexusers.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -164,14 +164,14 @@ public PostApiIndexV1IndexgroupRequestBuilder indexGroup() { */ public PostApiIndexV1IndexgroupResponse indexGroup(IndexGroupRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1IndexgroupOperation(sdkConfiguration); + = new PostApiIndexV1Indexgroup.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Bulk index groups * - *

Replaces the groups in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + *

Replaces the groups in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. * * @return The call builder */ @@ -182,7 +182,7 @@ public PostApiIndexV1BulkindexgroupsRequestBuilder bulkIndexGroups() { /** * Bulk index groups * - *

Replaces the groups in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + *

Replaces the groups in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. * * @param request The request object containing all the parameters for the API call. * @return The response from the API call @@ -190,7 +190,7 @@ public PostApiIndexV1BulkindexgroupsRequestBuilder bulkIndexGroups() { */ public PostApiIndexV1BulkindexgroupsResponse bulkIndexGroups(BulkIndexGroupsRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1BulkindexgroupsOperation(sdkConfiguration); + = new PostApiIndexV1Bulkindexgroups.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -216,14 +216,14 @@ public PostApiIndexV1IndexmembershipRequestBuilder indexMembership() { */ public PostApiIndexV1IndexmembershipResponse indexMembership(IndexMembershipRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1IndexmembershipOperation(sdkConfiguration); + = new PostApiIndexV1Indexmembership.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Bulk index memberships for a group * - *

Replaces the memberships for a group in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + *

Replaces the memberships for a group in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. * * @return The call builder */ @@ -234,7 +234,7 @@ public PostApiIndexV1BulkindexmembershipsRequestBuilder bulkIndexMemberships() { /** * Bulk index memberships for a group * - *

Replaces the memberships for a group in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/docs/indexing_api_bulk_indexing/#bulk-upload-model) documentation for an explanation of how to use bulk endpoints. + *

Replaces the memberships for a group in a datasource using paginated batch API calls. Please refer to the [bulk indexing](https://developers.glean.com/indexing/documents/bulk-upload-model) documentation for an explanation of how to use bulk endpoints. * * @param request The request object containing all the parameters for the API call. * @return The response from the API call @@ -242,7 +242,7 @@ public PostApiIndexV1BulkindexmembershipsRequestBuilder bulkIndexMemberships() { */ public PostApiIndexV1BulkindexmembershipsResponse bulkIndexMemberships(BulkIndexMembershipsRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1BulkindexmembershipsOperation(sdkConfiguration); + = new PostApiIndexV1Bulkindexmemberships.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -280,7 +280,7 @@ public PostApiIndexV1ProcessallmembershipsResponse processMembershipsDirect() th */ public PostApiIndexV1ProcessallmembershipsResponse processMemberships(Optional request) throws Exception { RequestOperation, PostApiIndexV1ProcessallmembershipsResponse> operation - = new PostApiIndexV1ProcessallmembershipsOperation(sdkConfiguration); + = new PostApiIndexV1Processallmemberships.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -306,7 +306,7 @@ public PostApiIndexV1DeleteuserRequestBuilder deleteUser() { */ public PostApiIndexV1DeleteuserResponse deleteUser(DeleteUserRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1DeleteuserOperation(sdkConfiguration); + = new PostApiIndexV1Deleteuser.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -332,7 +332,7 @@ public PostApiIndexV1DeletegroupRequestBuilder deleteGroup() { */ public PostApiIndexV1DeletegroupResponse deleteGroup(DeleteGroupRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1DeletegroupOperation(sdkConfiguration); + = new PostApiIndexV1Deletegroup.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -358,7 +358,7 @@ public PostApiIndexV1DeletemembershipRequestBuilder deleteMembership() { */ public PostApiIndexV1DeletemembershipResponse deleteMembership(DeleteMembershipRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1DeletemembershipOperation(sdkConfiguration); + = new PostApiIndexV1Deletemembership.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -384,7 +384,7 @@ public PostApiIndexV1BetausersRequestBuilder authorizeBetaUsers() { */ public PostApiIndexV1BetausersResponse authorizeBetaUsers(GreenlistUsersRequest request) throws Exception { RequestOperation operation - = new PostApiIndexV1BetausersOperation(sdkConfiguration); + = new PostApiIndexV1Betausers.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Pins.java b/src/main/java/com/glean/api_client/glean_api_client/Pins.java index 8dba93f3..819d61f9 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Pins.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Pins.java @@ -20,14 +20,11 @@ import com.glean.api_client.glean_api_client.models.operations.PinResponse; import com.glean.api_client.glean_api_client.models.operations.UnpinRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.UnpinResponse; -import com.glean.api_client.glean_api_client.operations.EditpinOperation; -import com.glean.api_client.glean_api_client.operations.GetpinOperation; -import com.glean.api_client.glean_api_client.operations.ListpinsOperation; -import com.glean.api_client.glean_api_client.operations.PinOperation; -import com.glean.api_client.glean_api_client.operations.UnpinOperation; +import com.glean.api_client.glean_api_client.operations.Editpin; +import com.glean.api_client.glean_api_client.operations.Getpin; +import com.glean.api_client.glean_api_client.operations.Listpins; +import com.glean.api_client.glean_api_client.operations.Pin; import java.lang.Exception; -import java.util.List; -import java.util.Optional; public class Pins { @@ -36,6 +33,7 @@ public class Pins { Pins(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Update pin * @@ -58,7 +56,7 @@ public EditpinRequestBuilder update() { */ public EditpinResponse update(EditPinRequest request) throws Exception { RequestOperation operation - = new EditpinOperation(sdkConfiguration); + = new Editpin.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -84,7 +82,7 @@ public GetpinRequestBuilder retrieve() { */ public GetpinResponse retrieve(GetPinRequest request) throws Exception { RequestOperation operation - = new GetpinOperation(sdkConfiguration); + = new Getpin.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -110,7 +108,7 @@ public ListpinsRequestBuilder list() { */ public ListpinsResponse list(ListpinsRequest request) throws Exception { RequestOperation operation - = new ListpinsOperation(sdkConfiguration); + = new Listpins.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -136,7 +134,7 @@ public PinRequestBuilder create() { */ public PinResponse create(PinRequest request) throws Exception { RequestOperation operation - = new PinOperation(sdkConfiguration); + = new Pin.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -162,7 +160,7 @@ public UnpinRequestBuilder remove() { */ public UnpinResponse remove(Unpin request) throws Exception { RequestOperation operation - = new UnpinOperation(sdkConfiguration); + = new com.glean.api_client.glean_api_client.operations.Unpin.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Policies.java b/src/main/java/com/glean/api_client/glean_api_client/Policies.java index 96dd70e7..4645fbf1 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Policies.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Policies.java @@ -21,16 +21,15 @@ import com.glean.api_client.glean_api_client.models.operations.UpdatepolicyRequest; import com.glean.api_client.glean_api_client.models.operations.UpdatepolicyRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.UpdatepolicyResponse; -import com.glean.api_client.glean_api_client.operations.CreatepolicyOperation; -import com.glean.api_client.glean_api_client.operations.DownloadpolicycsvOperation; -import com.glean.api_client.glean_api_client.operations.GetpolicyOperation; -import com.glean.api_client.glean_api_client.operations.ListpoliciesOperation; -import com.glean.api_client.glean_api_client.operations.UpdatepolicyOperation; +import com.glean.api_client.glean_api_client.operations.Createpolicy; +import com.glean.api_client.glean_api_client.operations.Downloadpolicycsv; +import com.glean.api_client.glean_api_client.operations.Getpolicy; +import com.glean.api_client.glean_api_client.operations.Listpolicies; +import com.glean.api_client.glean_api_client.operations.Updatepolicy; import java.lang.Boolean; import java.lang.Exception; import java.lang.Long; import java.lang.String; -import java.util.List; import java.util.Optional; @@ -40,6 +39,7 @@ public class Policies { Policies(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Gets specified policy * @@ -74,9 +74,7 @@ public GetpolicyResponse retrieve(String id) throws Exception { * @return The response from the API call * @throws Exception if the API call fails */ - public GetpolicyResponse retrieve( - String id, - Optional version) throws Exception { + public GetpolicyResponse retrieve(String id, Optional version) throws Exception { GetpolicyRequest request = GetpolicyRequest .builder() @@ -84,7 +82,7 @@ public GetpolicyResponse retrieve( .version(version) .build(); RequestOperation operation - = new GetpolicyOperation(sdkConfiguration); + = new Getpolicy.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -109,9 +107,7 @@ public UpdatepolicyRequestBuilder update() { * @return The response from the API call * @throws Exception if the API call fails */ - public UpdatepolicyResponse update( - String id, - UpdateDlpReportRequest updateDlpReportRequest) throws Exception { + public UpdatepolicyResponse update(String id, UpdateDlpReportRequest updateDlpReportRequest) throws Exception { UpdatepolicyRequest request = UpdatepolicyRequest .builder() @@ -119,7 +115,7 @@ public UpdatepolicyResponse update( .updateDlpReportRequest(updateDlpReportRequest) .build(); RequestOperation operation - = new UpdatepolicyOperation(sdkConfiguration); + = new Updatepolicy.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -156,9 +152,7 @@ public ListpoliciesResponse listDirect() throws Exception { * @return The response from the API call * @throws Exception if the API call fails */ - public ListpoliciesResponse list( - Optional autoHide, - Optional frequency) throws Exception { + public ListpoliciesResponse list(Optional autoHide, Optional frequency) throws Exception { ListpoliciesRequest request = ListpoliciesRequest .builder() @@ -166,7 +160,7 @@ public ListpoliciesResponse list( .frequency(frequency) .build(); RequestOperation operation - = new ListpoliciesOperation(sdkConfiguration); + = new Listpolicies.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -192,7 +186,7 @@ public CreatepolicyRequestBuilder create() { */ public CreatepolicyResponse create(CreateDlpReportRequest request) throws Exception { RequestOperation operation - = new CreatepolicyOperation(sdkConfiguration); + = new Createpolicy.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -223,7 +217,7 @@ public DownloadpolicycsvResponse download(String id) throws Exception { .id(id) .build(); RequestOperation operation - = new DownloadpolicycsvOperation(sdkConfiguration); + = new Downloadpolicycsv.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Reports.java b/src/main/java/com/glean/api_client/glean_api_client/Reports.java index a42335fd..58e51f7c 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Reports.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Reports.java @@ -14,13 +14,11 @@ import com.glean.api_client.glean_api_client.models.operations.GetreportstatusRequest; import com.glean.api_client.glean_api_client.models.operations.GetreportstatusRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.GetreportstatusResponse; -import com.glean.api_client.glean_api_client.operations.CreatereportOperation; -import com.glean.api_client.glean_api_client.operations.DownloadreportcsvOperation; -import com.glean.api_client.glean_api_client.operations.GetreportstatusOperation; +import com.glean.api_client.glean_api_client.operations.Createreport; +import com.glean.api_client.glean_api_client.operations.Downloadreportcsv; +import com.glean.api_client.glean_api_client.operations.Getreportstatus; import java.lang.Exception; import java.lang.String; -import java.util.List; -import java.util.Optional; public class Reports { @@ -29,6 +27,7 @@ public class Reports { Reports(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Creates new one-time report * @@ -51,7 +50,7 @@ public CreatereportRequestBuilder create() { */ public CreatereportResponse create(UpdateDlpConfigRequest request) throws Exception { RequestOperation operation - = new CreatereportOperation(sdkConfiguration); + = new Createreport.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -82,7 +81,7 @@ public DownloadreportcsvResponse download(String id) throws Exception { .id(id) .build(); RequestOperation operation - = new DownloadreportcsvOperation(sdkConfiguration); + = new Downloadreportcsv.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -113,7 +112,7 @@ public GetreportstatusResponse status(String id) throws Exception { .id(id) .build(); RequestOperation operation - = new GetreportstatusOperation(sdkConfiguration); + = new Getreportstatus.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } 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 811bf09f..e9ea5c1b 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 @@ -21,8 +21,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.7.0"; - public static final String GEN_VERSION = "2.656.5"; + public static final String SDK_VERSION = "0.8.0"; + public static final String GEN_VERSION = "2.681.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", @@ -128,7 +128,7 @@ public Map getServerVariableDefaults() { public Optional retryConfig() { return retryConfig; } - + public void setRetryConfig(Optional retryConfig) { Utils.checkNotNull(retryConfig, "retryConfig"); this.retryConfig = retryConfig; diff --git a/src/main/java/com/glean/api_client/glean_api_client/Search.java b/src/main/java/com/glean/api_client/glean_api_client/Search.java index eab09550..ae8df5b6 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Search.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Search.java @@ -19,14 +19,11 @@ import com.glean.api_client.glean_api_client.models.operations.RecommendationsResponse; import com.glean.api_client.glean_api_client.models.operations.SearchRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.SearchResponse; -import com.glean.api_client.glean_api_client.operations.AdminsearchOperation; -import com.glean.api_client.glean_api_client.operations.AutocompleteOperation; -import com.glean.api_client.glean_api_client.operations.FeedOperation; -import com.glean.api_client.glean_api_client.operations.RecommendationsOperation; -import com.glean.api_client.glean_api_client.operations.SearchOperation; +import com.glean.api_client.glean_api_client.operations.Adminsearch; +import com.glean.api_client.glean_api_client.operations.Autocomplete; +import com.glean.api_client.glean_api_client.operations.Feed; +import com.glean.api_client.glean_api_client.operations.Recommendations; import java.lang.Exception; -import java.util.List; -import java.util.Optional; public class Search { @@ -35,6 +32,7 @@ public class Search { Search(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Search the index (admin) * @@ -57,7 +55,7 @@ public AdminsearchRequestBuilder queryAsAdmin() { */ public AdminsearchResponse queryAsAdmin(SearchRequest request) throws Exception { RequestOperation operation - = new AdminsearchOperation(sdkConfiguration); + = new Adminsearch.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -83,7 +81,7 @@ public AutocompleteRequestBuilder autocomplete() { */ public AutocompleteResponse autocomplete(AutocompleteRequest request) throws Exception { RequestOperation operation - = new AutocompleteOperation(sdkConfiguration); + = new Autocomplete.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -109,7 +107,7 @@ public FeedRequestBuilder retrieveFeed() { */ public FeedResponse retrieveFeed(FeedRequest request) throws Exception { RequestOperation operation - = new FeedOperation(sdkConfiguration); + = new Feed.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -135,7 +133,7 @@ public RecommendationsRequestBuilder recommendations() { */ public RecommendationsResponse recommendations(RecommendationsRequest request) throws Exception { RequestOperation operation - = new RecommendationsOperation(sdkConfiguration); + = new Recommendations.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -161,7 +159,7 @@ public SearchRequestBuilder query() { */ public SearchResponse query(SearchRequest request) throws Exception { RequestOperation operation - = new SearchOperation(sdkConfiguration); + = new com.glean.api_client.glean_api_client.operations.Search.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Tools.java b/src/main/java/com/glean/api_client/glean_api_client/Tools.java index f366953a..9d8604f6 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Tools.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Tools.java @@ -11,8 +11,8 @@ import com.glean.api_client.glean_api_client.models.operations.GetRestApiV1ToolsListResponse; import com.glean.api_client.glean_api_client.models.operations.PostRestApiV1ToolsCallRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.PostRestApiV1ToolsCallResponse; -import com.glean.api_client.glean_api_client.operations.GetRestApiV1ToolsListOperation; -import com.glean.api_client.glean_api_client.operations.PostRestApiV1ToolsCallOperation; +import com.glean.api_client.glean_api_client.operations.GetRestApiV1ToolsList; +import com.glean.api_client.glean_api_client.operations.PostRestApiV1ToolsCall; import java.lang.Exception; import java.lang.String; import java.util.List; @@ -25,6 +25,7 @@ public class Tools { Tools(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * List available tools * @@ -64,7 +65,7 @@ public GetRestApiV1ToolsListResponse list(Optional> toolN .toolNames(toolNames) .build(); RequestOperation operation - = new GetRestApiV1ToolsListOperation(sdkConfiguration); + = new GetRestApiV1ToolsList.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -90,7 +91,7 @@ public PostRestApiV1ToolsCallRequestBuilder run() { */ public PostRestApiV1ToolsCallResponse run(ToolsCallRequest request) throws Exception { RequestOperation operation - = new PostRestApiV1ToolsCallOperation(sdkConfiguration); + = new PostRestApiV1ToolsCall.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Verification.java b/src/main/java/com/glean/api_client/glean_api_client/Verification.java index 22d5f08a..82d536e5 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Verification.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Verification.java @@ -14,12 +14,11 @@ import com.glean.api_client.glean_api_client.models.operations.ListverificationsResponse; import com.glean.api_client.glean_api_client.models.operations.VerifyRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.VerifyResponse; -import com.glean.api_client.glean_api_client.operations.AddverificationreminderOperation; -import com.glean.api_client.glean_api_client.operations.ListverificationsOperation; -import com.glean.api_client.glean_api_client.operations.VerifyOperation; +import com.glean.api_client.glean_api_client.operations.Addverificationreminder; +import com.glean.api_client.glean_api_client.operations.Listverifications; +import com.glean.api_client.glean_api_client.operations.Verify; import java.lang.Exception; import java.lang.Long; -import java.util.List; import java.util.Optional; @@ -29,6 +28,7 @@ public class Verification { Verification(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Create verification * @@ -51,7 +51,7 @@ public AddverificationreminderRequestBuilder addReminder() { */ public AddverificationreminderResponse addReminder(ReminderRequest request) throws Exception { RequestOperation operation - = new AddverificationreminderOperation(sdkConfiguration); + = new Addverificationreminder.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -94,7 +94,7 @@ public ListverificationsResponse list(Optional count) throws Exception { .count(count) .build(); RequestOperation operation - = new ListverificationsOperation(sdkConfiguration); + = new Listverifications.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -120,7 +120,7 @@ public VerifyRequestBuilder verify() { */ public VerifyResponse verify(VerifyRequest request) throws Exception { RequestOperation operation - = new VerifyOperation(sdkConfiguration); + = new Verify.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/Visibilityoverrides.java b/src/main/java/com/glean/api_client/glean_api_client/Visibilityoverrides.java index bf7fa5ab..1b555aab 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/Visibilityoverrides.java +++ b/src/main/java/com/glean/api_client/glean_api_client/Visibilityoverrides.java @@ -11,8 +11,8 @@ import com.glean.api_client.glean_api_client.models.operations.GetdocvisibilityResponse; import com.glean.api_client.glean_api_client.models.operations.SetdocvisibilityRequestBuilder; import com.glean.api_client.glean_api_client.models.operations.SetdocvisibilityResponse; -import com.glean.api_client.glean_api_client.operations.GetdocvisibilityOperation; -import com.glean.api_client.glean_api_client.operations.SetdocvisibilityOperation; +import com.glean.api_client.glean_api_client.operations.Getdocvisibility; +import com.glean.api_client.glean_api_client.operations.Setdocvisibility; import java.lang.Exception; import java.lang.String; import java.util.List; @@ -25,6 +25,7 @@ public class Visibilityoverrides { Visibilityoverrides(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; } + /** * Fetches documents visibility * @@ -64,7 +65,7 @@ public GetdocvisibilityResponse list(Optional> docIds) th .docIds(docIds) .build(); RequestOperation operation - = new GetdocvisibilityOperation(sdkConfiguration); + = new Getdocvisibility.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } @@ -90,7 +91,7 @@ public SetdocvisibilityRequestBuilder create() { */ public SetdocvisibilityResponse create(UpdateDocumentVisibilityOverridesRequest request) throws Exception { RequestOperation operation - = new SetdocvisibilityOperation(sdkConfiguration); + = new Setdocvisibility.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/AuthConfigStatus.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/AuthConfigStatus.java index 0b5f9308..68149c23 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/components/AuthConfigStatus.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/AuthConfigStatus.java @@ -15,7 +15,8 @@ */ public enum AuthConfigStatus { AWAITING_AUTH("AWAITING_AUTH"), - AUTHORIZED("AUTHORIZED"); + AUTHORIZED("AUTHORIZED"), + AUTH_DISABLED("AUTH_DISABLED"); @JsonValue private final String value; diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/ChatMessage.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/ChatMessage.java index ac407ddb..b5bcf58c 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/components/ChatMessage.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/ChatMessage.java @@ -701,7 +701,7 @@ public ChatMessage build() { private static final LazySingletonValue> _SINGLETON_VALUE_Author = new LazySingletonValue<>( "author", - "\"USER\"", + "\"GLEAN_AI\"", new TypeReference>() {}); private static final LazySingletonValue> _SINGLETON_VALUE_MessageType = diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/ChatMessageFragment.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/ChatMessageFragment.java index f9f206af..75ea296a 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/components/ChatMessageFragment.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/ChatMessageFragment.java @@ -57,6 +57,13 @@ public class ChatMessageFragment { @JsonProperty("action") private Optional action; + /** + * Information about the source for a ChatMessage. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("citation") + private Optional citation; + @JsonCreator public ChatMessageFragment( @JsonProperty("structuredResults") Optional> structuredResults, @@ -64,24 +71,28 @@ public ChatMessageFragment( @JsonProperty("text") Optional text, @JsonProperty("querySuggestion") Optional querySuggestion, @JsonProperty("file") Optional file, - @JsonProperty("action") Optional action) { + @JsonProperty("action") Optional action, + @JsonProperty("citation") Optional citation) { Utils.checkNotNull(structuredResults, "structuredResults"); Utils.checkNotNull(trackingToken, "trackingToken"); Utils.checkNotNull(text, "text"); Utils.checkNotNull(querySuggestion, "querySuggestion"); Utils.checkNotNull(file, "file"); Utils.checkNotNull(action, "action"); + Utils.checkNotNull(citation, "citation"); this.structuredResults = structuredResults; this.trackingToken = trackingToken; this.text = text; this.querySuggestion = querySuggestion; this.file = file; this.action = action; + this.citation = citation; } public ChatMessageFragment() { this(Optional.empty(), Optional.empty(), Optional.empty(), - Optional.empty(), Optional.empty(), Optional.empty()); + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } /** @@ -127,6 +138,15 @@ public Optional action() { return (Optional) action; } + /** + * Information about the source for a ChatMessage. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional citation() { + return (Optional) citation; + } + public static Builder builder() { return new Builder(); } @@ -228,6 +248,25 @@ public ChatMessageFragment withAction(Optional action) { return this; } + /** + * Information about the source for a ChatMessage. + */ + public ChatMessageFragment withCitation(ChatMessageCitation citation) { + Utils.checkNotNull(citation, "citation"); + this.citation = Optional.ofNullable(citation); + return this; + } + + + /** + * Information about the source for a ChatMessage. + */ + public ChatMessageFragment withCitation(Optional citation) { + Utils.checkNotNull(citation, "citation"); + this.citation = citation; + return this; + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -243,14 +282,16 @@ public boolean equals(java.lang.Object o) { Utils.enhancedDeepEquals(this.text, other.text) && Utils.enhancedDeepEquals(this.querySuggestion, other.querySuggestion) && Utils.enhancedDeepEquals(this.file, other.file) && - Utils.enhancedDeepEquals(this.action, other.action); + Utils.enhancedDeepEquals(this.action, other.action) && + Utils.enhancedDeepEquals(this.citation, other.citation); } @Override public int hashCode() { return Utils.enhancedHash( structuredResults, trackingToken, text, - querySuggestion, file, action); + querySuggestion, file, action, + citation); } @Override @@ -261,7 +302,8 @@ public String toString() { "text", text, "querySuggestion", querySuggestion, "file", file, - "action", action); + "action", action, + "citation", citation); } @SuppressWarnings("UnusedReturnValue") @@ -279,6 +321,8 @@ public final static class Builder { private Optional action = Optional.empty(); + private Optional citation = Optional.empty(); + private Builder() { // force use of static builder() method } @@ -379,11 +423,31 @@ public Builder action(Optional action) { return this; } + + /** + * Information about the source for a ChatMessage. + */ + public Builder citation(ChatMessageCitation citation) { + Utils.checkNotNull(citation, "citation"); + this.citation = Optional.ofNullable(citation); + return this; + } + + /** + * Information about the source for a ChatMessage. + */ + public Builder citation(Optional citation) { + Utils.checkNotNull(citation, "citation"); + this.citation = citation; + return this; + } + public ChatMessageFragment build() { return new ChatMessageFragment( structuredResults, trackingToken, text, - querySuggestion, file, action); + querySuggestion, file, action, + citation); } } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/ChatRequest.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/ChatRequest.java index c43d5b08..c3fe4ece 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/components/ChatRequest.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/ChatRequest.java @@ -34,7 +34,7 @@ public class ChatRequest { private Optional chatId; /** - * A list of chat messages, from most recent to least recent. It can be assumed that the first chat message in the list is the user's most recent query. + * A list of chat messages, from most recent to least recent. At least one message must specify a USER author. */ @JsonProperty("messages") private List messages; @@ -151,7 +151,7 @@ public Optional chatId() { } /** - * A list of chat messages, from most recent to least recent. It can be assumed that the first chat message in the list is the user's most recent query. + * A list of chat messages, from most recent to least recent. At least one message must specify a USER author. */ @JsonIgnore public List messages() { @@ -261,7 +261,7 @@ public ChatRequest withChatId(Optional chatId) { } /** - * A list of chat messages, from most recent to least recent. It can be assumed that the first chat message in the list is the user's most recent query. + * A list of chat messages, from most recent to least recent. At least one message must specify a USER author. */ public ChatRequest withMessages(List messages) { Utils.checkNotNull(messages, "messages"); @@ -520,7 +520,7 @@ public Builder chatId(Optional chatId) { /** - * A list of chat messages, from most recent to least recent. It can be assumed that the first chat message in the list is the user's most recent query. + * A list of chat messages, from most recent to least recent. At least one message must specify a USER author. */ public Builder messages(List messages) { Utils.checkNotNull(messages, "messages"); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/DocumentDefinition.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/DocumentDefinition.java index 26948669..54eb0f25 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/components/DocumentDefinition.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/DocumentDefinition.java @@ -172,7 +172,7 @@ public class DocumentDefinition { private Optional> comments; /** - * Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/docs/facets_and_operators_for_custom_datasources/). + * Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/indexing/datasource/custom-properties/operators_and_facets). */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("customProperties") @@ -444,7 +444,7 @@ public Optional> comments() { } /** - * Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/docs/facets_and_operators_for_custom_datasources/). + * Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/indexing/datasource/custom-properties/operators_and_facets). */ @SuppressWarnings("unchecked") @JsonIgnore @@ -857,7 +857,7 @@ public DocumentDefinition withComments(Optional customProperties) { Utils.checkNotNull(customProperties, "customProperties"); @@ -867,7 +867,7 @@ public DocumentDefinition withCustomProperties(List customProper /** - * Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/docs/facets_and_operators_for_custom_datasources/). + * Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/indexing/datasource/custom-properties/operators_and_facets). */ public DocumentDefinition withCustomProperties(Optional> customProperties) { Utils.checkNotNull(customProperties, "customProperties"); @@ -1406,7 +1406,7 @@ public Builder comments(Optional> comments) { /** - * Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/docs/facets_and_operators_for_custom_datasources/). + * Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/indexing/datasource/custom-properties/operators_and_facets). */ public Builder customProperties(List customProperties) { Utils.checkNotNull(customProperties, "customProperties"); @@ -1415,7 +1415,7 @@ public Builder customProperties(List customProperties) { } /** - * Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/docs/facets_and_operators_for_custom_datasources/). + * Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/indexing/datasource/custom-properties/operators_and_facets). */ public Builder customProperties(Optional> customProperties) { Utils.checkNotNull(customProperties, "customProperties"); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/Event.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/Event.java index 5a772a0b..37a0ae55 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/components/Event.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/Event.java @@ -27,6 +27,7 @@ public enum Event { FOCUS_IN("FOCUS_IN"), LAST_TOKEN("LAST_TOKEN"), MANUAL_FEEDBACK("MANUAL_FEEDBACK"), + MANUAL_FEEDBACK_SIDE_BY_SIDE("MANUAL_FEEDBACK_SIDE_BY_SIDE"), MARK_AS_READ("MARK_AS_READ"), MESSAGE("MESSAGE"), MIDDLE_CLICK("MIDDLE_CLICK"), diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/Feedback.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/Feedback.java index a91a63f6..8a3ac273 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/components/Feedback.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/Feedback.java @@ -117,6 +117,11 @@ public class Feedback { private Optional manualFeedbackInfo; + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("manualFeedbackSideBySideInfo") + private Optional manualFeedbackSideBySideInfo; + + @JsonInclude(Include.NON_ABSENT) @JsonProperty("seenFeedbackInfo") private Optional seenFeedbackInfo; @@ -162,6 +167,7 @@ public Feedback( @JsonProperty("uiTree") Optional> uiTree, @JsonProperty("uiElement") Optional uiElement, @JsonProperty("manualFeedbackInfo") Optional manualFeedbackInfo, + @JsonProperty("manualFeedbackSideBySideInfo") Optional manualFeedbackSideBySideInfo, @JsonProperty("seenFeedbackInfo") Optional seenFeedbackInfo, @JsonProperty("userViewInfo") Optional userViewInfo, @JsonProperty("workflowFeedbackInfo") Optional workflowFeedbackInfo, @@ -182,6 +188,7 @@ public Feedback( Utils.checkNotNull(uiTree, "uiTree"); Utils.checkNotNull(uiElement, "uiElement"); Utils.checkNotNull(manualFeedbackInfo, "manualFeedbackInfo"); + Utils.checkNotNull(manualFeedbackSideBySideInfo, "manualFeedbackSideBySideInfo"); Utils.checkNotNull(seenFeedbackInfo, "seenFeedbackInfo"); Utils.checkNotNull(userViewInfo, "userViewInfo"); Utils.checkNotNull(workflowFeedbackInfo, "workflowFeedbackInfo"); @@ -202,6 +209,7 @@ public Feedback( this.uiTree = uiTree; this.uiElement = uiElement; this.manualFeedbackInfo = manualFeedbackInfo; + this.manualFeedbackSideBySideInfo = manualFeedbackSideBySideInfo; this.seenFeedbackInfo = seenFeedbackInfo; this.userViewInfo = userViewInfo; this.workflowFeedbackInfo = workflowFeedbackInfo; @@ -218,7 +226,7 @@ public Feedback( Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), - Optional.empty(), Optional.empty()); + Optional.empty(), Optional.empty(), Optional.empty()); } /** @@ -338,6 +346,12 @@ public Optional manualFeedbackInfo() { return (Optional) manualFeedbackInfo; } + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional manualFeedbackSideBySideInfo() { + return (Optional) manualFeedbackSideBySideInfo; + } + @SuppressWarnings("unchecked") @JsonIgnore public Optional seenFeedbackInfo() { @@ -624,6 +638,19 @@ public Feedback withManualFeedbackInfo(Optional ma return this; } + public Feedback withManualFeedbackSideBySideInfo(ManualFeedbackSideBySideInfo manualFeedbackSideBySideInfo) { + Utils.checkNotNull(manualFeedbackSideBySideInfo, "manualFeedbackSideBySideInfo"); + this.manualFeedbackSideBySideInfo = Optional.ofNullable(manualFeedbackSideBySideInfo); + return this; + } + + + public Feedback withManualFeedbackSideBySideInfo(Optional manualFeedbackSideBySideInfo) { + Utils.checkNotNull(manualFeedbackSideBySideInfo, "manualFeedbackSideBySideInfo"); + this.manualFeedbackSideBySideInfo = manualFeedbackSideBySideInfo; + return this; + } + public Feedback withSeenFeedbackInfo(SeenFeedbackInfo seenFeedbackInfo) { Utils.checkNotNull(seenFeedbackInfo, "seenFeedbackInfo"); this.seenFeedbackInfo = Optional.ofNullable(seenFeedbackInfo); @@ -726,6 +753,7 @@ public boolean equals(java.lang.Object o) { Utils.enhancedDeepEquals(this.uiTree, other.uiTree) && Utils.enhancedDeepEquals(this.uiElement, other.uiElement) && Utils.enhancedDeepEquals(this.manualFeedbackInfo, other.manualFeedbackInfo) && + Utils.enhancedDeepEquals(this.manualFeedbackSideBySideInfo, other.manualFeedbackSideBySideInfo) && Utils.enhancedDeepEquals(this.seenFeedbackInfo, other.seenFeedbackInfo) && Utils.enhancedDeepEquals(this.userViewInfo, other.userViewInfo) && Utils.enhancedDeepEquals(this.workflowFeedbackInfo, other.workflowFeedbackInfo) && @@ -741,8 +769,8 @@ public int hashCode() { sessionInfo, timestamp, user, pathname, channels, url, uiTree, uiElement, manualFeedbackInfo, - seenFeedbackInfo, userViewInfo, workflowFeedbackInfo, - applicationId, agentId); + manualFeedbackSideBySideInfo, seenFeedbackInfo, userViewInfo, + workflowFeedbackInfo, applicationId, agentId); } @Override @@ -763,6 +791,7 @@ public String toString() { "uiTree", uiTree, "uiElement", uiElement, "manualFeedbackInfo", manualFeedbackInfo, + "manualFeedbackSideBySideInfo", manualFeedbackSideBySideInfo, "seenFeedbackInfo", seenFeedbackInfo, "userViewInfo", userViewInfo, "workflowFeedbackInfo", workflowFeedbackInfo, @@ -803,6 +832,8 @@ public final static class Builder { private Optional manualFeedbackInfo = Optional.empty(); + private Optional manualFeedbackSideBySideInfo = Optional.empty(); + private Optional seenFeedbackInfo = Optional.empty(); private Optional userViewInfo = Optional.empty(); @@ -1067,6 +1098,19 @@ public Builder manualFeedbackInfo(Optional manualF } + public Builder manualFeedbackSideBySideInfo(ManualFeedbackSideBySideInfo manualFeedbackSideBySideInfo) { + Utils.checkNotNull(manualFeedbackSideBySideInfo, "manualFeedbackSideBySideInfo"); + this.manualFeedbackSideBySideInfo = Optional.ofNullable(manualFeedbackSideBySideInfo); + return this; + } + + public Builder manualFeedbackSideBySideInfo(Optional manualFeedbackSideBySideInfo) { + Utils.checkNotNull(manualFeedbackSideBySideInfo, "manualFeedbackSideBySideInfo"); + this.manualFeedbackSideBySideInfo = manualFeedbackSideBySideInfo; + return this; + } + + public Builder seenFeedbackInfo(SeenFeedbackInfo seenFeedbackInfo) { Utils.checkNotNull(seenFeedbackInfo, "seenFeedbackInfo"); this.seenFeedbackInfo = Optional.ofNullable(seenFeedbackInfo); @@ -1151,8 +1195,8 @@ public Feedback build() { sessionInfo, timestamp, user, pathname, channels, url, uiTree, uiElement, manualFeedbackInfo, - seenFeedbackInfo, userViewInfo, workflowFeedbackInfo, - applicationId, agentId); + manualFeedbackSideBySideInfo, seenFeedbackInfo, userViewInfo, + workflowFeedbackInfo, applicationId, agentId); } } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackInfo.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackInfo.java index 2a2195b7..8883161f 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackInfo.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackInfo.java @@ -118,7 +118,7 @@ public class ManualFeedbackInfo { */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("vote") - private Optional vote; + private Optional vote; /** * A rating associated with the user feedback. The value will be between one and the maximum given by ratingScale, inclusive. @@ -156,7 +156,7 @@ public ManualFeedbackInfo( @JsonProperty("previousMessages") Optional> previousMessages, @JsonProperty("chatTranscript") Optional> chatTranscript, @JsonProperty("numQueriesFromFirstRun") Optional numQueriesFromFirstRun, - @JsonProperty("vote") Optional vote, + @JsonProperty("vote") Optional vote, @JsonProperty("rating") Optional rating, @JsonProperty("ratingKey") Optional ratingKey, @JsonProperty("ratingScale") Optional ratingScale) { @@ -323,8 +323,8 @@ public Optional numQueriesFromFirstRun() { */ @SuppressWarnings("unchecked") @JsonIgnore - public Optional vote() { - return (Optional) vote; + public Optional vote() { + return (Optional) vote; } /** @@ -612,7 +612,7 @@ public ManualFeedbackInfo withNumQueriesFromFirstRun(Optional numQueriesFr /** * The vote associated with the Feedback.event.MANUAL_FEEDBACK event. */ - public ManualFeedbackInfo withVote(Vote vote) { + public ManualFeedbackInfo withVote(ManualFeedbackInfoVote vote) { Utils.checkNotNull(vote, "vote"); this.vote = Optional.ofNullable(vote); return this; @@ -622,7 +622,7 @@ public ManualFeedbackInfo withVote(Vote vote) { /** * The vote associated with the Feedback.event.MANUAL_FEEDBACK event. */ - public ManualFeedbackInfo withVote(Optional vote) { + public ManualFeedbackInfo withVote(Optional vote) { Utils.checkNotNull(vote, "vote"); this.vote = vote; return this; @@ -777,7 +777,7 @@ public final static class Builder { private Optional numQueriesFromFirstRun = Optional.empty(); - private Optional vote = Optional.empty(); + private Optional vote = Optional.empty(); private Optional rating = Optional.empty(); @@ -1046,7 +1046,7 @@ public Builder numQueriesFromFirstRun(Optional numQueriesFromFirstRun) { /** * The vote associated with the Feedback.event.MANUAL_FEEDBACK event. */ - public Builder vote(Vote vote) { + public Builder vote(ManualFeedbackInfoVote vote) { Utils.checkNotNull(vote, "vote"); this.vote = Optional.ofNullable(vote); return this; @@ -1055,7 +1055,7 @@ public Builder vote(Vote vote) { /** * The vote associated with the Feedback.event.MANUAL_FEEDBACK event. */ - public Builder vote(Optional vote) { + public Builder vote(Optional vote) { Utils.checkNotNull(vote, "vote"); this.vote = vote; return this; diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/Vote.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackInfoVote.java similarity index 73% rename from src/main/java/com/glean/api_client/glean_api_client/models/components/Vote.java rename to src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackInfoVote.java index 5b1ce597..eff04606 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/components/Vote.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackInfoVote.java @@ -9,18 +9,18 @@ import java.util.Optional; /** - * Vote + * ManualFeedbackInfoVote * *

The vote associated with the Feedback.event.MANUAL_FEEDBACK event. */ -public enum Vote { +public enum ManualFeedbackInfoVote { UPVOTE("UPVOTE"), DOWNVOTE("DOWNVOTE"); @JsonValue private final String value; - Vote(String value) { + ManualFeedbackInfoVote(String value) { this.value = value; } @@ -28,8 +28,8 @@ public String value() { return value; } - public static Optional fromValue(String value) { - for (Vote o: Vote.values()) { + public static Optional fromValue(String value) { + for (ManualFeedbackInfoVote o: ManualFeedbackInfoVote.values()) { if (Objects.deepEquals(o.value, value)) { return Optional.of(o); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackSideBySideInfo.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackSideBySideInfo.java new file mode 100644 index 00000000..9faf7f72 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackSideBySideInfo.java @@ -0,0 +1,559 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +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.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.List; +import java.util.Optional; + + +public class ManualFeedbackSideBySideInfo { + /** + * The email address of the user who submitted the side-by-side feedback. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("email") + private Optional email; + + /** + * The source associated with the side-by-side feedback event. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("source") + private Optional source; + + /** + * The query or prompt that was evaluated across multiple implementations. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("query") + private Optional query; + + /** + * Array of implementations that were compared side-by-side. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("implementations") + private Optional> implementations; + + /** + * Unique identifier for this evaluation session to group related feedback events. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("evaluationSessionId") + private Optional evaluationSessionId; + + /** + * The ID of the implementation this specific feedback event is for. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("implementationId") + private Optional implementationId; + + /** + * The vote for this specific implementation. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("vote") + private Optional vote; + + /** + * Specific feedback comments for this implementation. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("comments") + private Optional comments; + + @JsonCreator + public ManualFeedbackSideBySideInfo( + @JsonProperty("email") Optional email, + @JsonProperty("source") Optional source, + @JsonProperty("query") Optional query, + @JsonProperty("implementations") Optional> implementations, + @JsonProperty("evaluationSessionId") Optional evaluationSessionId, + @JsonProperty("implementationId") Optional implementationId, + @JsonProperty("vote") Optional vote, + @JsonProperty("comments") Optional comments) { + Utils.checkNotNull(email, "email"); + Utils.checkNotNull(source, "source"); + Utils.checkNotNull(query, "query"); + Utils.checkNotNull(implementations, "implementations"); + Utils.checkNotNull(evaluationSessionId, "evaluationSessionId"); + Utils.checkNotNull(implementationId, "implementationId"); + Utils.checkNotNull(vote, "vote"); + Utils.checkNotNull(comments, "comments"); + this.email = email; + this.source = source; + this.query = query; + this.implementations = implementations; + this.evaluationSessionId = evaluationSessionId; + this.implementationId = implementationId; + this.vote = vote; + this.comments = comments; + } + + public ManualFeedbackSideBySideInfo() { + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty()); + } + + /** + * The email address of the user who submitted the side-by-side feedback. + */ + @JsonIgnore + public Optional email() { + return email; + } + + /** + * The source associated with the side-by-side feedback event. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional source() { + return (Optional) source; + } + + /** + * The query or prompt that was evaluated across multiple implementations. + */ + @JsonIgnore + public Optional query() { + return query; + } + + /** + * Array of implementations that were compared side-by-side. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> implementations() { + return (Optional>) implementations; + } + + /** + * Unique identifier for this evaluation session to group related feedback events. + */ + @JsonIgnore + public Optional evaluationSessionId() { + return evaluationSessionId; + } + + /** + * The ID of the implementation this specific feedback event is for. + */ + @JsonIgnore + public Optional implementationId() { + return implementationId; + } + + /** + * The vote for this specific implementation. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional vote() { + return (Optional) vote; + } + + /** + * Specific feedback comments for this implementation. + */ + @JsonIgnore + public Optional comments() { + return comments; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * The email address of the user who submitted the side-by-side feedback. + */ + public ManualFeedbackSideBySideInfo withEmail(String email) { + Utils.checkNotNull(email, "email"); + this.email = Optional.ofNullable(email); + return this; + } + + + /** + * The email address of the user who submitted the side-by-side feedback. + */ + public ManualFeedbackSideBySideInfo withEmail(Optional email) { + Utils.checkNotNull(email, "email"); + this.email = email; + return this; + } + + /** + * The source associated with the side-by-side feedback event. + */ + public ManualFeedbackSideBySideInfo withSource(ManualFeedbackSideBySideInfoSource source) { + Utils.checkNotNull(source, "source"); + this.source = Optional.ofNullable(source); + return this; + } + + + /** + * The source associated with the side-by-side feedback event. + */ + public ManualFeedbackSideBySideInfo withSource(Optional source) { + Utils.checkNotNull(source, "source"); + this.source = source; + return this; + } + + /** + * The query or prompt that was evaluated across multiple implementations. + */ + public ManualFeedbackSideBySideInfo withQuery(String query) { + Utils.checkNotNull(query, "query"); + this.query = Optional.ofNullable(query); + return this; + } + + + /** + * The query or prompt that was evaluated across multiple implementations. + */ + public ManualFeedbackSideBySideInfo withQuery(Optional query) { + Utils.checkNotNull(query, "query"); + this.query = query; + return this; + } + + /** + * Array of implementations that were compared side-by-side. + */ + public ManualFeedbackSideBySideInfo withImplementations(List implementations) { + Utils.checkNotNull(implementations, "implementations"); + this.implementations = Optional.ofNullable(implementations); + return this; + } + + + /** + * Array of implementations that were compared side-by-side. + */ + public ManualFeedbackSideBySideInfo withImplementations(Optional> implementations) { + Utils.checkNotNull(implementations, "implementations"); + this.implementations = implementations; + return this; + } + + /** + * Unique identifier for this evaluation session to group related feedback events. + */ + public ManualFeedbackSideBySideInfo withEvaluationSessionId(String evaluationSessionId) { + Utils.checkNotNull(evaluationSessionId, "evaluationSessionId"); + this.evaluationSessionId = Optional.ofNullable(evaluationSessionId); + return this; + } + + + /** + * Unique identifier for this evaluation session to group related feedback events. + */ + public ManualFeedbackSideBySideInfo withEvaluationSessionId(Optional evaluationSessionId) { + Utils.checkNotNull(evaluationSessionId, "evaluationSessionId"); + this.evaluationSessionId = evaluationSessionId; + return this; + } + + /** + * The ID of the implementation this specific feedback event is for. + */ + public ManualFeedbackSideBySideInfo withImplementationId(String implementationId) { + Utils.checkNotNull(implementationId, "implementationId"); + this.implementationId = Optional.ofNullable(implementationId); + return this; + } + + + /** + * The ID of the implementation this specific feedback event is for. + */ + public ManualFeedbackSideBySideInfo withImplementationId(Optional implementationId) { + Utils.checkNotNull(implementationId, "implementationId"); + this.implementationId = implementationId; + return this; + } + + /** + * The vote for this specific implementation. + */ + public ManualFeedbackSideBySideInfo withVote(ManualFeedbackSideBySideInfoVote vote) { + Utils.checkNotNull(vote, "vote"); + this.vote = Optional.ofNullable(vote); + return this; + } + + + /** + * The vote for this specific implementation. + */ + public ManualFeedbackSideBySideInfo withVote(Optional vote) { + Utils.checkNotNull(vote, "vote"); + this.vote = vote; + return this; + } + + /** + * Specific feedback comments for this implementation. + */ + public ManualFeedbackSideBySideInfo withComments(String comments) { + Utils.checkNotNull(comments, "comments"); + this.comments = Optional.ofNullable(comments); + return this; + } + + + /** + * Specific feedback comments for this implementation. + */ + public ManualFeedbackSideBySideInfo withComments(Optional comments) { + Utils.checkNotNull(comments, "comments"); + this.comments = comments; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ManualFeedbackSideBySideInfo other = (ManualFeedbackSideBySideInfo) o; + return + Utils.enhancedDeepEquals(this.email, other.email) && + Utils.enhancedDeepEquals(this.source, other.source) && + Utils.enhancedDeepEquals(this.query, other.query) && + Utils.enhancedDeepEquals(this.implementations, other.implementations) && + Utils.enhancedDeepEquals(this.evaluationSessionId, other.evaluationSessionId) && + Utils.enhancedDeepEquals(this.implementationId, other.implementationId) && + Utils.enhancedDeepEquals(this.vote, other.vote) && + Utils.enhancedDeepEquals(this.comments, other.comments); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + email, source, query, + implementations, evaluationSessionId, implementationId, + vote, comments); + } + + @Override + public String toString() { + return Utils.toString(ManualFeedbackSideBySideInfo.class, + "email", email, + "source", source, + "query", query, + "implementations", implementations, + "evaluationSessionId", evaluationSessionId, + "implementationId", implementationId, + "vote", vote, + "comments", comments); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private Optional email = Optional.empty(); + + private Optional source = Optional.empty(); + + private Optional query = Optional.empty(); + + private Optional> implementations = Optional.empty(); + + private Optional evaluationSessionId = Optional.empty(); + + private Optional implementationId = Optional.empty(); + + private Optional vote = Optional.empty(); + + private Optional comments = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * The email address of the user who submitted the side-by-side feedback. + */ + public Builder email(String email) { + Utils.checkNotNull(email, "email"); + this.email = Optional.ofNullable(email); + return this; + } + + /** + * The email address of the user who submitted the side-by-side feedback. + */ + public Builder email(Optional email) { + Utils.checkNotNull(email, "email"); + this.email = email; + return this; + } + + + /** + * The source associated with the side-by-side feedback event. + */ + public Builder source(ManualFeedbackSideBySideInfoSource source) { + Utils.checkNotNull(source, "source"); + this.source = Optional.ofNullable(source); + return this; + } + + /** + * The source associated with the side-by-side feedback event. + */ + public Builder source(Optional source) { + Utils.checkNotNull(source, "source"); + this.source = source; + return this; + } + + + /** + * The query or prompt that was evaluated across multiple implementations. + */ + public Builder query(String query) { + Utils.checkNotNull(query, "query"); + this.query = Optional.ofNullable(query); + return this; + } + + /** + * The query or prompt that was evaluated across multiple implementations. + */ + public Builder query(Optional query) { + Utils.checkNotNull(query, "query"); + this.query = query; + return this; + } + + + /** + * Array of implementations that were compared side-by-side. + */ + public Builder implementations(List implementations) { + Utils.checkNotNull(implementations, "implementations"); + this.implementations = Optional.ofNullable(implementations); + return this; + } + + /** + * Array of implementations that were compared side-by-side. + */ + public Builder implementations(Optional> implementations) { + Utils.checkNotNull(implementations, "implementations"); + this.implementations = implementations; + return this; + } + + + /** + * Unique identifier for this evaluation session to group related feedback events. + */ + public Builder evaluationSessionId(String evaluationSessionId) { + Utils.checkNotNull(evaluationSessionId, "evaluationSessionId"); + this.evaluationSessionId = Optional.ofNullable(evaluationSessionId); + return this; + } + + /** + * Unique identifier for this evaluation session to group related feedback events. + */ + public Builder evaluationSessionId(Optional evaluationSessionId) { + Utils.checkNotNull(evaluationSessionId, "evaluationSessionId"); + this.evaluationSessionId = evaluationSessionId; + return this; + } + + + /** + * The ID of the implementation this specific feedback event is for. + */ + public Builder implementationId(String implementationId) { + Utils.checkNotNull(implementationId, "implementationId"); + this.implementationId = Optional.ofNullable(implementationId); + return this; + } + + /** + * The ID of the implementation this specific feedback event is for. + */ + public Builder implementationId(Optional implementationId) { + Utils.checkNotNull(implementationId, "implementationId"); + this.implementationId = implementationId; + return this; + } + + + /** + * The vote for this specific implementation. + */ + public Builder vote(ManualFeedbackSideBySideInfoVote vote) { + Utils.checkNotNull(vote, "vote"); + this.vote = Optional.ofNullable(vote); + return this; + } + + /** + * The vote for this specific implementation. + */ + public Builder vote(Optional vote) { + Utils.checkNotNull(vote, "vote"); + this.vote = vote; + return this; + } + + + /** + * Specific feedback comments for this implementation. + */ + public Builder comments(String comments) { + Utils.checkNotNull(comments, "comments"); + this.comments = Optional.ofNullable(comments); + return this; + } + + /** + * Specific feedback comments for this implementation. + */ + public Builder comments(Optional comments) { + Utils.checkNotNull(comments, "comments"); + this.comments = comments; + return this; + } + + public ManualFeedbackSideBySideInfo build() { + + return new ManualFeedbackSideBySideInfo( + email, source, query, + implementations, evaluationSessionId, implementationId, + vote, comments); + } + + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackSideBySideInfoSource.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackSideBySideInfoSource.java new file mode 100644 index 00000000..0a064740 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackSideBySideInfoSource.java @@ -0,0 +1,41 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.models.components; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; + +/** + * ManualFeedbackSideBySideInfoSource + * + *

The source associated with the side-by-side feedback event. + */ +public enum ManualFeedbackSideBySideInfoSource { + LIVE_EVAL("LIVE_EVAL"), + CHAT("CHAT"), + SEARCH("SEARCH"); + + @JsonValue + private final String value; + + ManualFeedbackSideBySideInfoSource(String value) { + this.value = value; + } + + public String value() { + return value; + } + + public static Optional fromValue(String value) { + for (ManualFeedbackSideBySideInfoSource o: ManualFeedbackSideBySideInfoSource.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } +} + diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackSideBySideInfoVote.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackSideBySideInfoVote.java new file mode 100644 index 00000000..a2188b6b --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/ManualFeedbackSideBySideInfoVote.java @@ -0,0 +1,41 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.models.components; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; + +/** + * ManualFeedbackSideBySideInfoVote + * + *

The vote for this specific implementation. + */ +public enum ManualFeedbackSideBySideInfoVote { + UPVOTE("UPVOTE"), + DOWNVOTE("DOWNVOTE"), + NEUTRAL("NEUTRAL"); + + @JsonValue + private final String value; + + ManualFeedbackSideBySideInfoVote(String value) { + this.value = value; + } + + public String value() { + return value; + } + + public static Optional fromValue(String value) { + for (ManualFeedbackSideBySideInfoVote o: ManualFeedbackSideBySideInfoVote.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } +} + diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/ResponseMetadata.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/ResponseMetadata.java new file mode 100644 index 00000000..18321cec --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/ResponseMetadata.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +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.Long; +import java.lang.Override; +import java.lang.String; +import java.util.Optional; + +/** + * ResponseMetadata + * + *

Metadata about the response (e.g., latency, token count). + */ +public class ResponseMetadata { + /** + * Time taken to generate the response in milliseconds. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("latencyMs") + private Optional latencyMs; + + /** + * Number of tokens in the response. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("tokenCount") + private Optional tokenCount; + + /** + * The specific model version used. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("modelUsed") + private Optional modelUsed; + + @JsonCreator + public ResponseMetadata( + @JsonProperty("latencyMs") Optional latencyMs, + @JsonProperty("tokenCount") Optional tokenCount, + @JsonProperty("modelUsed") Optional modelUsed) { + Utils.checkNotNull(latencyMs, "latencyMs"); + Utils.checkNotNull(tokenCount, "tokenCount"); + Utils.checkNotNull(modelUsed, "modelUsed"); + this.latencyMs = latencyMs; + this.tokenCount = tokenCount; + this.modelUsed = modelUsed; + } + + public ResponseMetadata() { + this(Optional.empty(), Optional.empty(), Optional.empty()); + } + + /** + * Time taken to generate the response in milliseconds. + */ + @JsonIgnore + public Optional latencyMs() { + return latencyMs; + } + + /** + * Number of tokens in the response. + */ + @JsonIgnore + public Optional tokenCount() { + return tokenCount; + } + + /** + * The specific model version used. + */ + @JsonIgnore + public Optional modelUsed() { + return modelUsed; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * Time taken to generate the response in milliseconds. + */ + public ResponseMetadata withLatencyMs(long latencyMs) { + Utils.checkNotNull(latencyMs, "latencyMs"); + this.latencyMs = Optional.ofNullable(latencyMs); + return this; + } + + + /** + * Time taken to generate the response in milliseconds. + */ + public ResponseMetadata withLatencyMs(Optional latencyMs) { + Utils.checkNotNull(latencyMs, "latencyMs"); + this.latencyMs = latencyMs; + return this; + } + + /** + * Number of tokens in the response. + */ + public ResponseMetadata withTokenCount(long tokenCount) { + Utils.checkNotNull(tokenCount, "tokenCount"); + this.tokenCount = Optional.ofNullable(tokenCount); + return this; + } + + + /** + * Number of tokens in the response. + */ + public ResponseMetadata withTokenCount(Optional tokenCount) { + Utils.checkNotNull(tokenCount, "tokenCount"); + this.tokenCount = tokenCount; + return this; + } + + /** + * The specific model version used. + */ + public ResponseMetadata withModelUsed(String modelUsed) { + Utils.checkNotNull(modelUsed, "modelUsed"); + this.modelUsed = Optional.ofNullable(modelUsed); + return this; + } + + + /** + * The specific model version used. + */ + public ResponseMetadata withModelUsed(Optional modelUsed) { + Utils.checkNotNull(modelUsed, "modelUsed"); + this.modelUsed = modelUsed; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResponseMetadata other = (ResponseMetadata) o; + return + Utils.enhancedDeepEquals(this.latencyMs, other.latencyMs) && + Utils.enhancedDeepEquals(this.tokenCount, other.tokenCount) && + Utils.enhancedDeepEquals(this.modelUsed, other.modelUsed); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + latencyMs, tokenCount, modelUsed); + } + + @Override + public String toString() { + return Utils.toString(ResponseMetadata.class, + "latencyMs", latencyMs, + "tokenCount", tokenCount, + "modelUsed", modelUsed); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private Optional latencyMs = Optional.empty(); + + private Optional tokenCount = Optional.empty(); + + private Optional modelUsed = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * Time taken to generate the response in milliseconds. + */ + public Builder latencyMs(long latencyMs) { + Utils.checkNotNull(latencyMs, "latencyMs"); + this.latencyMs = Optional.ofNullable(latencyMs); + return this; + } + + /** + * Time taken to generate the response in milliseconds. + */ + public Builder latencyMs(Optional latencyMs) { + Utils.checkNotNull(latencyMs, "latencyMs"); + this.latencyMs = latencyMs; + return this; + } + + + /** + * Number of tokens in the response. + */ + public Builder tokenCount(long tokenCount) { + Utils.checkNotNull(tokenCount, "tokenCount"); + this.tokenCount = Optional.ofNullable(tokenCount); + return this; + } + + /** + * Number of tokens in the response. + */ + public Builder tokenCount(Optional tokenCount) { + Utils.checkNotNull(tokenCount, "tokenCount"); + this.tokenCount = tokenCount; + return this; + } + + + /** + * The specific model version used. + */ + public Builder modelUsed(String modelUsed) { + Utils.checkNotNull(modelUsed, "modelUsed"); + this.modelUsed = Optional.ofNullable(modelUsed); + return this; + } + + /** + * The specific model version used. + */ + public Builder modelUsed(Optional modelUsed) { + Utils.checkNotNull(modelUsed, "modelUsed"); + this.modelUsed = modelUsed; + return this; + } + + public ResponseMetadata build() { + + return new ResponseMetadata( + latencyMs, tokenCount, modelUsed); + } + + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/SearchRequest.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/SearchRequest.java index f3fbbc50..b11a5cbe 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/components/SearchRequest.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/SearchRequest.java @@ -95,13 +95,6 @@ public class SearchRequest { @JsonProperty("timeoutMillis") private Optional timeoutMillis; - /** - * People associated with the search request. Hints to the server to fetch additional information for these people. Note that in this request, an email may be used as a person's obfuscatedId value. - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("people") - private Optional> people; - /** * Whether or not to disable spellcheck. */ @@ -123,7 +116,6 @@ public SearchRequest( @JsonProperty("inputDetails") Optional inputDetails, @JsonProperty("requestOptions") Optional requestOptions, @JsonProperty("timeoutMillis") Optional timeoutMillis, - @JsonProperty("people") Optional> people, @JsonProperty("disableSpellcheck") Optional disableSpellcheck) { Utils.checkNotNull(timestamp, "timestamp"); Utils.checkNotNull(trackingToken, "trackingToken"); @@ -137,7 +129,6 @@ public SearchRequest( Utils.checkNotNull(inputDetails, "inputDetails"); Utils.checkNotNull(requestOptions, "requestOptions"); Utils.checkNotNull(timeoutMillis, "timeoutMillis"); - Utils.checkNotNull(people, "people"); Utils.checkNotNull(disableSpellcheck, "disableSpellcheck"); this.timestamp = timestamp; this.trackingToken = trackingToken; @@ -151,7 +142,6 @@ public SearchRequest( this.inputDetails = inputDetails; this.requestOptions = requestOptions; this.timeoutMillis = timeoutMillis; - this.people = people; this.disableSpellcheck = disableSpellcheck; } @@ -161,7 +151,7 @@ public SearchRequest( Optional.empty(), Optional.empty(), Optional.empty(), query, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), - Optional.empty(), Optional.empty()); + Optional.empty()); } /** @@ -253,15 +243,6 @@ public Optional timeoutMillis() { return timeoutMillis; } - /** - * People associated with the search request. Hints to the server to fetch additional information for these people. Note that in this request, an email may be used as a person's obfuscatedId value. - */ - @SuppressWarnings("unchecked") - @JsonIgnore - public Optional> people() { - return (Optional>) people; - } - /** * Whether or not to disable spellcheck. */ @@ -469,25 +450,6 @@ public SearchRequest withTimeoutMillis(Optional timeoutMillis) { return this; } - /** - * People associated with the search request. Hints to the server to fetch additional information for these people. Note that in this request, an email may be used as a person's obfuscatedId value. - */ - public SearchRequest withPeople(List people) { - Utils.checkNotNull(people, "people"); - this.people = Optional.ofNullable(people); - return this; - } - - - /** - * People associated with the search request. Hints to the server to fetch additional information for these people. Note that in this request, an email may be used as a person's obfuscatedId value. - */ - public SearchRequest withPeople(Optional> people) { - Utils.checkNotNull(people, "people"); - this.people = people; - return this; - } - /** * Whether or not to disable spellcheck. */ @@ -529,7 +491,6 @@ public boolean equals(java.lang.Object o) { Utils.enhancedDeepEquals(this.inputDetails, other.inputDetails) && Utils.enhancedDeepEquals(this.requestOptions, other.requestOptions) && Utils.enhancedDeepEquals(this.timeoutMillis, other.timeoutMillis) && - Utils.enhancedDeepEquals(this.people, other.people) && Utils.enhancedDeepEquals(this.disableSpellcheck, other.disableSpellcheck); } @@ -540,7 +501,7 @@ public int hashCode() { sourceDocument, pageSize, maxSnippetSize, query, cursor, resultTabIds, inputDetails, requestOptions, timeoutMillis, - people, disableSpellcheck); + disableSpellcheck); } @Override @@ -558,7 +519,6 @@ public String toString() { "inputDetails", inputDetails, "requestOptions", requestOptions, "timeoutMillis", timeoutMillis, - "people", people, "disableSpellcheck", disableSpellcheck); } @@ -589,8 +549,6 @@ public final static class Builder { private Optional timeoutMillis = Optional.empty(); - private Optional> people = Optional.empty(); - private Optional disableSpellcheck = Optional.empty(); private Builder() { @@ -793,25 +751,6 @@ public Builder timeoutMillis(Optional timeoutMillis) { } - /** - * People associated with the search request. Hints to the server to fetch additional information for these people. Note that in this request, an email may be used as a person's obfuscatedId value. - */ - public Builder people(List people) { - Utils.checkNotNull(people, "people"); - this.people = Optional.ofNullable(people); - return this; - } - - /** - * People associated with the search request. Hints to the server to fetch additional information for these people. Note that in this request, an email may be used as a person's obfuscatedId value. - */ - public Builder people(Optional> people) { - Utils.checkNotNull(people, "people"); - this.people = people; - return this; - } - - /** * Whether or not to disable spellcheck. */ @@ -837,7 +776,7 @@ public SearchRequest build() { sourceDocument, pageSize, maxSnippetSize, query, cursor, resultTabIds, inputDetails, requestOptions, timeoutMillis, - people, disableSpellcheck); + disableSpellcheck); } } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/SearchResponseMetadata.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/SearchResponseMetadata.java index cbdd739e..c09c1f09 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/components/SearchResponseMetadata.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/SearchResponseMetadata.java @@ -32,6 +32,13 @@ public class SearchResponseMetadata { @JsonProperty("searchedQuery") private Optional searchedQuery; + /** + * The query used to perform search and return results, with negated terms and facets removed. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("searchedQueryWithoutNegation") + private Optional searchedQueryWithoutNegation; + /** * The bolded ranges within the searched query. */ @@ -100,6 +107,7 @@ public class SearchResponseMetadata { public SearchResponseMetadata( @JsonProperty("rewrittenQuery") Optional rewrittenQuery, @JsonProperty("searchedQuery") Optional searchedQuery, + @JsonProperty("searchedQueryWithoutNegation") Optional searchedQueryWithoutNegation, @JsonProperty("searchedQueryRanges") Optional> searchedQueryRanges, @JsonProperty("originalQuery") Optional originalQuery, @JsonProperty("querySuggestion") Optional querySuggestion, @@ -112,6 +120,7 @@ public SearchResponseMetadata( @JsonProperty("isNoQuotesSuggestion") Optional isNoQuotesSuggestion) { Utils.checkNotNull(rewrittenQuery, "rewrittenQuery"); Utils.checkNotNull(searchedQuery, "searchedQuery"); + Utils.checkNotNull(searchedQueryWithoutNegation, "searchedQueryWithoutNegation"); Utils.checkNotNull(searchedQueryRanges, "searchedQueryRanges"); Utils.checkNotNull(originalQuery, "originalQuery"); Utils.checkNotNull(querySuggestion, "querySuggestion"); @@ -124,6 +133,7 @@ public SearchResponseMetadata( Utils.checkNotNull(isNoQuotesSuggestion, "isNoQuotesSuggestion"); this.rewrittenQuery = rewrittenQuery; this.searchedQuery = searchedQuery; + this.searchedQueryWithoutNegation = searchedQueryWithoutNegation; this.searchedQueryRanges = searchedQueryRanges; this.originalQuery = originalQuery; this.querySuggestion = querySuggestion; @@ -140,7 +150,8 @@ public SearchResponseMetadata() { this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), - Optional.empty(), Optional.empty(), Optional.empty()); + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } /** @@ -159,6 +170,14 @@ public Optional searchedQuery() { return searchedQuery; } + /** + * The query used to perform search and return results, with negated terms and facets removed. + */ + @JsonIgnore + public Optional searchedQueryWithoutNegation() { + return searchedQueryWithoutNegation; + } + /** * The bolded ranges within the searched query. */ @@ -278,6 +297,25 @@ public SearchResponseMetadata withSearchedQuery(Optional searchedQuery) return this; } + /** + * The query used to perform search and return results, with negated terms and facets removed. + */ + public SearchResponseMetadata withSearchedQueryWithoutNegation(String searchedQueryWithoutNegation) { + Utils.checkNotNull(searchedQueryWithoutNegation, "searchedQueryWithoutNegation"); + this.searchedQueryWithoutNegation = Optional.ofNullable(searchedQueryWithoutNegation); + return this; + } + + + /** + * The query used to perform search and return results, with negated terms and facets removed. + */ + public SearchResponseMetadata withSearchedQueryWithoutNegation(Optional searchedQueryWithoutNegation) { + Utils.checkNotNull(searchedQueryWithoutNegation, "searchedQueryWithoutNegation"); + this.searchedQueryWithoutNegation = searchedQueryWithoutNegation; + return this; + } + /** * The bolded ranges within the searched query. */ @@ -462,6 +500,7 @@ public boolean equals(java.lang.Object o) { return Utils.enhancedDeepEquals(this.rewrittenQuery, other.rewrittenQuery) && Utils.enhancedDeepEquals(this.searchedQuery, other.searchedQuery) && + Utils.enhancedDeepEquals(this.searchedQueryWithoutNegation, other.searchedQueryWithoutNegation) && Utils.enhancedDeepEquals(this.searchedQueryRanges, other.searchedQueryRanges) && Utils.enhancedDeepEquals(this.originalQuery, other.originalQuery) && Utils.enhancedDeepEquals(this.querySuggestion, other.querySuggestion) && @@ -477,10 +516,11 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { return Utils.enhancedHash( - rewrittenQuery, searchedQuery, searchedQueryRanges, - originalQuery, querySuggestion, additionalQuerySuggestions, - negatedTerms, modifiedQueryWasUsed, originalQueryHadNoResults, - searchWarning, triggeredExpertDetection, isNoQuotesSuggestion); + rewrittenQuery, searchedQuery, searchedQueryWithoutNegation, + searchedQueryRanges, originalQuery, querySuggestion, + additionalQuerySuggestions, negatedTerms, modifiedQueryWasUsed, + originalQueryHadNoResults, searchWarning, triggeredExpertDetection, + isNoQuotesSuggestion); } @Override @@ -488,6 +528,7 @@ public String toString() { return Utils.toString(SearchResponseMetadata.class, "rewrittenQuery", rewrittenQuery, "searchedQuery", searchedQuery, + "searchedQueryWithoutNegation", searchedQueryWithoutNegation, "searchedQueryRanges", searchedQueryRanges, "originalQuery", originalQuery, "querySuggestion", querySuggestion, @@ -507,6 +548,8 @@ public final static class Builder { private Optional searchedQuery = Optional.empty(); + private Optional searchedQueryWithoutNegation = Optional.empty(); + private Optional> searchedQueryRanges = Optional.empty(); private Optional originalQuery = Optional.empty(); @@ -570,6 +613,25 @@ public Builder searchedQuery(Optional searchedQuery) { } + /** + * The query used to perform search and return results, with negated terms and facets removed. + */ + public Builder searchedQueryWithoutNegation(String searchedQueryWithoutNegation) { + Utils.checkNotNull(searchedQueryWithoutNegation, "searchedQueryWithoutNegation"); + this.searchedQueryWithoutNegation = Optional.ofNullable(searchedQueryWithoutNegation); + return this; + } + + /** + * The query used to perform search and return results, with negated terms and facets removed. + */ + public Builder searchedQueryWithoutNegation(Optional searchedQueryWithoutNegation) { + Utils.checkNotNull(searchedQueryWithoutNegation, "searchedQueryWithoutNegation"); + this.searchedQueryWithoutNegation = searchedQueryWithoutNegation; + return this; + } + + /** * The bolded ranges within the searched query. */ @@ -744,10 +806,11 @@ public Builder isNoQuotesSuggestion(Optional isNoQuotesSuggestion) { public SearchResponseMetadata build() { return new SearchResponseMetadata( - rewrittenQuery, searchedQuery, searchedQueryRanges, - originalQuery, querySuggestion, additionalQuerySuggestions, - negatedTerms, modifiedQueryWasUsed, originalQueryHadNoResults, - searchWarning, triggeredExpertDetection, isNoQuotesSuggestion); + rewrittenQuery, searchedQuery, searchedQueryWithoutNegation, + searchedQueryRanges, originalQuery, querySuggestion, + additionalQuerySuggestions, negatedTerms, modifiedQueryWasUsed, + originalQueryHadNoResults, searchWarning, triggeredExpertDetection, + isNoQuotesSuggestion); } } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/SideBySideImplementation.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/SideBySideImplementation.java new file mode 100644 index 00000000..a08594a6 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/SideBySideImplementation.java @@ -0,0 +1,375 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +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.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Map; +import java.util.Optional; + + +public class SideBySideImplementation { + /** + * Unique identifier for this implementation variant. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("implementationId") + private Optional implementationId; + + /** + * Human-readable name for this implementation (e.g., "Variant A", "GPT-4", "Claude"). + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("implementationName") + private Optional implementationName; + + /** + * The search/chat parameters used for this implementation. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("searchParams") + private Optional> searchParams; + + /** + * The full response generated by this implementation. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("response") + private Optional response; + + /** + * Metadata about the response (e.g., latency, token count). + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("responseMetadata") + private Optional responseMetadata; + + @JsonCreator + public SideBySideImplementation( + @JsonProperty("implementationId") Optional implementationId, + @JsonProperty("implementationName") Optional implementationName, + @JsonProperty("searchParams") Optional> searchParams, + @JsonProperty("response") Optional response, + @JsonProperty("responseMetadata") Optional responseMetadata) { + Utils.checkNotNull(implementationId, "implementationId"); + Utils.checkNotNull(implementationName, "implementationName"); + Utils.checkNotNull(searchParams, "searchParams"); + Utils.checkNotNull(response, "response"); + Utils.checkNotNull(responseMetadata, "responseMetadata"); + this.implementationId = implementationId; + this.implementationName = implementationName; + this.searchParams = searchParams; + this.response = response; + this.responseMetadata = responseMetadata; + } + + public SideBySideImplementation() { + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty()); + } + + /** + * Unique identifier for this implementation variant. + */ + @JsonIgnore + public Optional implementationId() { + return implementationId; + } + + /** + * Human-readable name for this implementation (e.g., "Variant A", "GPT-4", "Claude"). + */ + @JsonIgnore + public Optional implementationName() { + return implementationName; + } + + /** + * The search/chat parameters used for this implementation. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> searchParams() { + return (Optional>) searchParams; + } + + /** + * The full response generated by this implementation. + */ + @JsonIgnore + public Optional response() { + return response; + } + + /** + * Metadata about the response (e.g., latency, token count). + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional responseMetadata() { + return (Optional) responseMetadata; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * Unique identifier for this implementation variant. + */ + public SideBySideImplementation withImplementationId(String implementationId) { + Utils.checkNotNull(implementationId, "implementationId"); + this.implementationId = Optional.ofNullable(implementationId); + return this; + } + + + /** + * Unique identifier for this implementation variant. + */ + public SideBySideImplementation withImplementationId(Optional implementationId) { + Utils.checkNotNull(implementationId, "implementationId"); + this.implementationId = implementationId; + return this; + } + + /** + * Human-readable name for this implementation (e.g., "Variant A", "GPT-4", "Claude"). + */ + public SideBySideImplementation withImplementationName(String implementationName) { + Utils.checkNotNull(implementationName, "implementationName"); + this.implementationName = Optional.ofNullable(implementationName); + return this; + } + + + /** + * Human-readable name for this implementation (e.g., "Variant A", "GPT-4", "Claude"). + */ + public SideBySideImplementation withImplementationName(Optional implementationName) { + Utils.checkNotNull(implementationName, "implementationName"); + this.implementationName = implementationName; + return this; + } + + /** + * The search/chat parameters used for this implementation. + */ + public SideBySideImplementation withSearchParams(Map searchParams) { + Utils.checkNotNull(searchParams, "searchParams"); + this.searchParams = Optional.ofNullable(searchParams); + return this; + } + + + /** + * The search/chat parameters used for this implementation. + */ + public SideBySideImplementation withSearchParams(Optional> searchParams) { + Utils.checkNotNull(searchParams, "searchParams"); + this.searchParams = searchParams; + return this; + } + + /** + * The full response generated by this implementation. + */ + public SideBySideImplementation withResponse(String response) { + Utils.checkNotNull(response, "response"); + this.response = Optional.ofNullable(response); + return this; + } + + + /** + * The full response generated by this implementation. + */ + public SideBySideImplementation withResponse(Optional response) { + Utils.checkNotNull(response, "response"); + this.response = response; + return this; + } + + /** + * Metadata about the response (e.g., latency, token count). + */ + public SideBySideImplementation withResponseMetadata(ResponseMetadata responseMetadata) { + Utils.checkNotNull(responseMetadata, "responseMetadata"); + this.responseMetadata = Optional.ofNullable(responseMetadata); + return this; + } + + + /** + * Metadata about the response (e.g., latency, token count). + */ + public SideBySideImplementation withResponseMetadata(Optional responseMetadata) { + Utils.checkNotNull(responseMetadata, "responseMetadata"); + this.responseMetadata = responseMetadata; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SideBySideImplementation other = (SideBySideImplementation) o; + return + Utils.enhancedDeepEquals(this.implementationId, other.implementationId) && + Utils.enhancedDeepEquals(this.implementationName, other.implementationName) && + Utils.enhancedDeepEquals(this.searchParams, other.searchParams) && + Utils.enhancedDeepEquals(this.response, other.response) && + Utils.enhancedDeepEquals(this.responseMetadata, other.responseMetadata); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + implementationId, implementationName, searchParams, + response, responseMetadata); + } + + @Override + public String toString() { + return Utils.toString(SideBySideImplementation.class, + "implementationId", implementationId, + "implementationName", implementationName, + "searchParams", searchParams, + "response", response, + "responseMetadata", responseMetadata); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private Optional implementationId = Optional.empty(); + + private Optional implementationName = Optional.empty(); + + private Optional> searchParams = Optional.empty(); + + private Optional response = Optional.empty(); + + private Optional responseMetadata = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * Unique identifier for this implementation variant. + */ + public Builder implementationId(String implementationId) { + Utils.checkNotNull(implementationId, "implementationId"); + this.implementationId = Optional.ofNullable(implementationId); + return this; + } + + /** + * Unique identifier for this implementation variant. + */ + public Builder implementationId(Optional implementationId) { + Utils.checkNotNull(implementationId, "implementationId"); + this.implementationId = implementationId; + return this; + } + + + /** + * Human-readable name for this implementation (e.g., "Variant A", "GPT-4", "Claude"). + */ + public Builder implementationName(String implementationName) { + Utils.checkNotNull(implementationName, "implementationName"); + this.implementationName = Optional.ofNullable(implementationName); + return this; + } + + /** + * Human-readable name for this implementation (e.g., "Variant A", "GPT-4", "Claude"). + */ + public Builder implementationName(Optional implementationName) { + Utils.checkNotNull(implementationName, "implementationName"); + this.implementationName = implementationName; + return this; + } + + + /** + * The search/chat parameters used for this implementation. + */ + public Builder searchParams(Map searchParams) { + Utils.checkNotNull(searchParams, "searchParams"); + this.searchParams = Optional.ofNullable(searchParams); + return this; + } + + /** + * The search/chat parameters used for this implementation. + */ + public Builder searchParams(Optional> searchParams) { + Utils.checkNotNull(searchParams, "searchParams"); + this.searchParams = searchParams; + return this; + } + + + /** + * The full response generated by this implementation. + */ + public Builder response(String response) { + Utils.checkNotNull(response, "response"); + this.response = Optional.ofNullable(response); + return this; + } + + /** + * The full response generated by this implementation. + */ + public Builder response(Optional response) { + Utils.checkNotNull(response, "response"); + this.response = response; + return this; + } + + + /** + * Metadata about the response (e.g., latency, token count). + */ + public Builder responseMetadata(ResponseMetadata responseMetadata) { + Utils.checkNotNull(responseMetadata, "responseMetadata"); + this.responseMetadata = Optional.ofNullable(responseMetadata); + return this; + } + + /** + * Metadata about the response (e.g., latency, token count). + */ + public Builder responseMetadata(Optional responseMetadata) { + Utils.checkNotNull(responseMetadata, "responseMetadata"); + this.responseMetadata = responseMetadata; + return this; + } + + public SideBySideImplementation build() { + + return new SideBySideImplementation( + implementationId, implementationName, searchParams, + response, responseMetadata); + } + + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/components/StructuredResult.java b/src/main/java/com/glean/api_client/glean_api_client/models/components/StructuredResult.java index 06bfd7fd..f1fa7892 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/components/StructuredResult.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/components/StructuredResult.java @@ -52,6 +52,11 @@ public class StructuredResult { private Optional answer; + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("generatedQna") + private Optional generatedQna; + + @JsonInclude(Include.NON_ABSENT) @JsonProperty("extractedQnA") private Optional extractedQnA; @@ -146,6 +151,7 @@ public StructuredResult( @JsonProperty("team") Optional team, @JsonProperty("customEntity") Optional customEntity, @JsonProperty("answer") Optional answer, + @JsonProperty("generatedQna") Optional generatedQna, @JsonProperty("extractedQnA") Optional extractedQnA, @JsonProperty("meeting") Optional meeting, @JsonProperty("app") Optional app, @@ -167,6 +173,7 @@ public StructuredResult( Utils.checkNotNull(team, "team"); Utils.checkNotNull(customEntity, "customEntity"); Utils.checkNotNull(answer, "answer"); + Utils.checkNotNull(generatedQna, "generatedQna"); Utils.checkNotNull(extractedQnA, "extractedQnA"); Utils.checkNotNull(meeting, "meeting"); Utils.checkNotNull(app, "app"); @@ -188,6 +195,7 @@ public StructuredResult( this.team = team; this.customEntity = customEntity; this.answer = answer; + this.generatedQna = generatedQna; this.extractedQnA = extractedQnA; this.meeting = meeting; this.app = app; @@ -212,7 +220,8 @@ public StructuredResult() { Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), - Optional.empty(), Optional.empty(), Optional.empty()); + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } @SuppressWarnings("unchecked") @@ -251,6 +260,12 @@ public Optional answer() { return (Optional) answer; } + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional generatedQna() { + return (Optional) generatedQna; + } + @SuppressWarnings("unchecked") @JsonIgnore public Optional extractedQnA() { @@ -441,6 +456,19 @@ public StructuredResult withAnswer(Optional answer) { return this; } + public StructuredResult withGeneratedQna(GeneratedQna generatedQna) { + Utils.checkNotNull(generatedQna, "generatedQna"); + this.generatedQna = Optional.ofNullable(generatedQna); + return this; + } + + + public StructuredResult withGeneratedQna(Optional generatedQna) { + Utils.checkNotNull(generatedQna, "generatedQna"); + this.generatedQna = generatedQna; + return this; + } + public StructuredResult withExtractedQnA(ExtractedQnA extractedQnA) { Utils.checkNotNull(extractedQnA, "extractedQnA"); this.extractedQnA = Optional.ofNullable(extractedQnA); @@ -688,6 +716,7 @@ public boolean equals(java.lang.Object o) { Utils.enhancedDeepEquals(this.team, other.team) && Utils.enhancedDeepEquals(this.customEntity, other.customEntity) && Utils.enhancedDeepEquals(this.answer, other.answer) && + Utils.enhancedDeepEquals(this.generatedQna, other.generatedQna) && Utils.enhancedDeepEquals(this.extractedQnA, other.extractedQnA) && Utils.enhancedDeepEquals(this.meeting, other.meeting) && Utils.enhancedDeepEquals(this.app, other.app) && @@ -710,11 +739,12 @@ public int hashCode() { return Utils.enhancedHash( document, person, customer, team, customEntity, answer, - extractedQnA, meeting, app, - collection, answerBoard, code, - shortcut, querySuggestions, relatedDocuments, - relatedQuestion, disambiguation, snippets, - trackingToken, prominence, source); + generatedQna, extractedQnA, meeting, + app, collection, answerBoard, + code, shortcut, querySuggestions, + relatedDocuments, relatedQuestion, disambiguation, + snippets, trackingToken, prominence, + source); } @Override @@ -726,6 +756,7 @@ public String toString() { "team", team, "customEntity", customEntity, "answer", answer, + "generatedQna", generatedQna, "extractedQnA", extractedQnA, "meeting", meeting, "app", app, @@ -758,6 +789,8 @@ public final static class Builder { private Optional answer = Optional.empty(); + private Optional generatedQna = Optional.empty(); + private Optional extractedQnA = Optional.empty(); private Optional meeting = Optional.empty(); @@ -871,6 +904,19 @@ public Builder answer(Optional answer) { } + public Builder generatedQna(GeneratedQna generatedQna) { + Utils.checkNotNull(generatedQna, "generatedQna"); + this.generatedQna = Optional.ofNullable(generatedQna); + return this; + } + + public Builder generatedQna(Optional generatedQna) { + Utils.checkNotNull(generatedQna, "generatedQna"); + this.generatedQna = generatedQna; + return this; + } + + public Builder extractedQnA(ExtractedQnA extractedQnA) { Utils.checkNotNull(extractedQnA, "extractedQnA"); this.extractedQnA = Optional.ofNullable(extractedQnA); @@ -1106,11 +1152,12 @@ public StructuredResult build() { return new StructuredResult( document, person, customer, team, customEntity, answer, - extractedQnA, meeting, app, - collection, answerBoard, code, - shortcut, querySuggestions, relatedDocuments, - relatedQuestion, disambiguation, snippets, - trackingToken, prominence, source); + generatedQna, extractedQnA, meeting, + app, collection, answerBoard, + code, shortcut, querySuggestions, + relatedDocuments, relatedQuestion, disambiguation, + snippets, trackingToken, prominence, + source); } } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/errors/APIException.java b/src/main/java/com/glean/api_client/glean_api_client/models/errors/APIException.java index 371e62d8..9021dee9 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/errors/APIException.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/errors/APIException.java @@ -62,10 +62,12 @@ public int hashCode() { @Override public String toString() { return Utils.toString(APIException.class, - "rawResponse", rawResponse, + "requestMethod", rawResponse.request().method(), + "requestUri", rawResponse.request().uri(), "code", code, + "responseHeaders", rawResponse.headers().map(), "message", message, - "body", body); + "body", bodyAsString()); } public HttpResponse rawResponse() { diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ActivityRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ActivityRequestBuilder.java index a60f9817..b1091f92 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ActivityRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ActivityRequestBuilder.java @@ -7,7 +7,6 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.Activity; -import com.glean.api_client.glean_api_client.operations.ActivityOperation; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +28,7 @@ public ActivityRequestBuilder request(Activity request) { public ActivityResponse call() throws Exception { RequestOperation operation - = new ActivityOperation(sdkConfiguration); + = new com.glean.api_client.glean_api_client.operations.Activity.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/AddcollectionitemsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/AddcollectionitemsRequestBuilder.java index 786e289e..d11239b3 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/AddcollectionitemsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/AddcollectionitemsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.AddCollectionItemsRequest; -import com.glean.api_client.glean_api_client.operations.AddcollectionitemsOperation; +import com.glean.api_client.glean_api_client.operations.Addcollectionitems; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public AddcollectionitemsRequestBuilder request(AddCollectionItemsRequest reques public AddcollectionitemsResponse call() throws Exception { RequestOperation operation - = new AddcollectionitemsOperation(sdkConfiguration); + = new Addcollectionitems.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/AddverificationreminderRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/AddverificationreminderRequestBuilder.java index 5fe91c2d..03422a34 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/AddverificationreminderRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/AddverificationreminderRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.ReminderRequest; -import com.glean.api_client.glean_api_client.operations.AddverificationreminderOperation; +import com.glean.api_client.glean_api_client.operations.Addverificationreminder; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public AddverificationreminderRequestBuilder request(ReminderRequest request) { public AddverificationreminderResponse call() throws Exception { RequestOperation operation - = new AddverificationreminderOperation(sdkConfiguration); + = new Addverificationreminder.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/AdminsearchRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/AdminsearchRequestBuilder.java index 8054cb0b..d0498668 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/AdminsearchRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/AdminsearchRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.SearchRequest; -import com.glean.api_client.glean_api_client.operations.AdminsearchOperation; +import com.glean.api_client.glean_api_client.operations.Adminsearch; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public AdminsearchRequestBuilder request(SearchRequest request) { public AdminsearchResponse call() throws Exception { RequestOperation operation - = new AdminsearchOperation(sdkConfiguration); + = new Adminsearch.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/AutocompleteRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/AutocompleteRequestBuilder.java index f2892291..53727cce 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/AutocompleteRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/AutocompleteRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.AutocompleteRequest; -import com.glean.api_client.glean_api_client.operations.AutocompleteOperation; +import com.glean.api_client.glean_api_client.operations.Autocomplete; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public AutocompleteRequestBuilder request(AutocompleteRequest request) { public AutocompleteResponse call() throws Exception { RequestOperation operation - = new AutocompleteOperation(sdkConfiguration); + = new Autocomplete.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ChatRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ChatRequestBuilder.java index c8d271a1..3ec72b05 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ChatRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ChatRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.ChatRequest; -import com.glean.api_client.glean_api_client.operations.ChatOperation; +import com.glean.api_client.glean_api_client.operations.Chat; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.Long; @@ -53,7 +53,7 @@ private com.glean.api_client.glean_api_client.models.operations.ChatRequest buil public ChatResponse call() throws Exception { RequestOperation operation - = new ChatOperation(sdkConfiguration); + = new Chat.Sync(sdkConfiguration); com.glean.api_client.glean_api_client.models.operations.ChatRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ChatStreamRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ChatStreamRequestBuilder.java index 27e7d084..5439dca9 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ChatStreamRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ChatStreamRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.ChatRequest; -import com.glean.api_client.glean_api_client.operations.ChatStreamOperation; +import com.glean.api_client.glean_api_client.operations.ChatStream; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.Long; @@ -53,7 +53,7 @@ private ChatStreamRequest buildRequest() { public ChatStreamResponse call() throws Exception { RequestOperation operation - = new ChatStreamOperation(sdkConfiguration); + = new ChatStream.Sync(sdkConfiguration); ChatStreamRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAndStreamRunRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAndStreamRunRequestBuilder.java index a9275378..95ebce8a 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAndStreamRunRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAndStreamRunRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.AgentRunCreate; -import com.glean.api_client.glean_api_client.operations.CreateAndStreamRunOperation; +import com.glean.api_client.glean_api_client.operations.CreateAndStreamRun; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public CreateAndStreamRunRequestBuilder request(AgentRunCreate request) { public CreateAndStreamRunResponse call() throws Exception { RequestOperation operation - = new CreateAndStreamRunOperation(sdkConfiguration); + = new CreateAndStreamRun.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAndWaitRunRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAndWaitRunRequestBuilder.java index 57081937..6e4c0026 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAndWaitRunRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateAndWaitRunRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.AgentRunCreate; -import com.glean.api_client.glean_api_client.operations.CreateAndWaitRunOperation; +import com.glean.api_client.glean_api_client.operations.CreateAndWaitRun; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public CreateAndWaitRunRequestBuilder request(AgentRunCreate request) { public CreateAndWaitRunResponse call() throws Exception { RequestOperation operation - = new CreateAndWaitRunOperation(sdkConfiguration); + = new CreateAndWaitRun.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateannouncementRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateannouncementRequestBuilder.java index 705ac301..c9d08229 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateannouncementRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateannouncementRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.CreateAnnouncementRequest; -import com.glean.api_client.glean_api_client.operations.CreateannouncementOperation; +import com.glean.api_client.glean_api_client.operations.Createannouncement; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public CreateannouncementRequestBuilder request(CreateAnnouncementRequest reques public CreateannouncementResponse call() throws Exception { RequestOperation operation - = new CreateannouncementOperation(sdkConfiguration); + = new Createannouncement.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateanswerRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateanswerRequestBuilder.java index 750ab2c5..fcd41cf9 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateanswerRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateanswerRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.CreateAnswerRequest; -import com.glean.api_client.glean_api_client.operations.CreateanswerOperation; +import com.glean.api_client.glean_api_client.operations.Createanswer; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public CreateanswerRequestBuilder request(CreateAnswerRequest request) { public CreateanswerResponse call() throws Exception { RequestOperation operation - = new CreateanswerOperation(sdkConfiguration); + = new Createanswer.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateauthtokenRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateauthtokenRequestBuilder.java index 63da26e2..db588122 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateauthtokenRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateauthtokenRequestBuilder.java @@ -6,7 +6,7 @@ import static com.glean.api_client.glean_api_client.operations.Operations.RequestlessOperation; import com.glean.api_client.glean_api_client.SDKConfiguration; -import com.glean.api_client.glean_api_client.operations.CreateauthtokenOperation; +import com.glean.api_client.glean_api_client.operations.Createauthtoken; import java.lang.Exception; public class CreateauthtokenRequestBuilder { @@ -20,7 +20,7 @@ public CreateauthtokenRequestBuilder(SDKConfiguration sdkConfiguration) { public CreateauthtokenResponse call() throws Exception { RequestlessOperation operation - = new CreateauthtokenOperation(sdkConfiguration); + = new Createauthtoken.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest()); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreatecollectionRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreatecollectionRequestBuilder.java index cc851a53..d0b3d925 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreatecollectionRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreatecollectionRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.CreateCollectionRequest; -import com.glean.api_client.glean_api_client.operations.CreatecollectionOperation; +import com.glean.api_client.glean_api_client.operations.Createcollection; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public CreatecollectionRequestBuilder request(CreateCollectionRequest request) { public CreatecollectionResponse call() throws Exception { RequestOperation operation - = new CreatecollectionOperation(sdkConfiguration); + = new Createcollection.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreatepolicyRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreatepolicyRequestBuilder.java index 567b9856..4ed967cd 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreatepolicyRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreatepolicyRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.CreateDlpReportRequest; -import com.glean.api_client.glean_api_client.operations.CreatepolicyOperation; +import com.glean.api_client.glean_api_client.operations.Createpolicy; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public CreatepolicyRequestBuilder request(CreateDlpReportRequest request) { public CreatepolicyResponse call() throws Exception { RequestOperation operation - = new CreatepolicyOperation(sdkConfiguration); + = new Createpolicy.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreatereportRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreatereportRequestBuilder.java index eeb17b4b..3aeadea2 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreatereportRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreatereportRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.UpdateDlpConfigRequest; -import com.glean.api_client.glean_api_client.operations.CreatereportOperation; +import com.glean.api_client.glean_api_client.operations.Createreport; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public CreatereportRequestBuilder request(UpdateDlpConfigRequest request) { public CreatereportResponse call() throws Exception { RequestOperation operation - = new CreatereportOperation(sdkConfiguration); + = new Createreport.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateshortcutRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateshortcutRequestBuilder.java index ead8749b..95faa0f4 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateshortcutRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/CreateshortcutRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.CreateShortcutRequest; -import com.glean.api_client.glean_api_client.operations.CreateshortcutOperation; +import com.glean.api_client.glean_api_client.operations.Createshortcut; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public CreateshortcutRequestBuilder request(CreateShortcutRequest request) { public CreateshortcutResponse call() throws Exception { RequestOperation operation - = new CreateshortcutOperation(sdkConfiguration); + = new Createshortcut.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeleteallchatsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeleteallchatsRequestBuilder.java index 81bac662..17597d58 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeleteallchatsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeleteallchatsRequestBuilder.java @@ -6,7 +6,7 @@ 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.operations.DeleteallchatsOperation; +import com.glean.api_client.glean_api_client.operations.Deleteallchats; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.Long; @@ -44,7 +44,7 @@ private DeleteallchatsRequest buildRequest() { public DeleteallchatsResponse call() throws Exception { RequestOperation operation - = new DeleteallchatsOperation(sdkConfiguration); + = new Deleteallchats.Sync(sdkConfiguration); DeleteallchatsRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeleteannouncementRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeleteannouncementRequestBuilder.java index f694e3db..fb7ad38c 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeleteannouncementRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeleteannouncementRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.DeleteAnnouncementRequest; -import com.glean.api_client.glean_api_client.operations.DeleteannouncementOperation; +import com.glean.api_client.glean_api_client.operations.Deleteannouncement; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public DeleteannouncementRequestBuilder request(DeleteAnnouncementRequest reques public DeleteannouncementResponse call() throws Exception { RequestOperation operation - = new DeleteannouncementOperation(sdkConfiguration); + = new Deleteannouncement.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeleteanswerRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeleteanswerRequestBuilder.java index 5c51679a..d27bfb8f 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeleteanswerRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeleteanswerRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.DeleteAnswerRequest; -import com.glean.api_client.glean_api_client.operations.DeleteanswerOperation; +import com.glean.api_client.glean_api_client.operations.Deleteanswer; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public DeleteanswerRequestBuilder request(DeleteAnswerRequest request) { public DeleteanswerResponse call() throws Exception { RequestOperation operation - = new DeleteanswerOperation(sdkConfiguration); + = new Deleteanswer.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeletechatfilesRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeletechatfilesRequestBuilder.java index 81a3c9d6..15f1bc24 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeletechatfilesRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeletechatfilesRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.DeleteChatFilesRequest; -import com.glean.api_client.glean_api_client.operations.DeletechatfilesOperation; +import com.glean.api_client.glean_api_client.operations.Deletechatfiles; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.Long; @@ -53,7 +53,7 @@ private DeletechatfilesRequest buildRequest() { public DeletechatfilesResponse call() throws Exception { RequestOperation operation - = new DeletechatfilesOperation(sdkConfiguration); + = new Deletechatfiles.Sync(sdkConfiguration); DeletechatfilesRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeletechatsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeletechatsRequestBuilder.java index de01aeea..976c89bd 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeletechatsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeletechatsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.DeleteChatsRequest; -import com.glean.api_client.glean_api_client.operations.DeletechatsOperation; +import com.glean.api_client.glean_api_client.operations.Deletechats; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.Long; @@ -53,7 +53,7 @@ private DeletechatsRequest buildRequest() { public DeletechatsResponse call() throws Exception { RequestOperation operation - = new DeletechatsOperation(sdkConfiguration); + = new Deletechats.Sync(sdkConfiguration); DeletechatsRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeletecollectionRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeletecollectionRequestBuilder.java index e2d918af..4f2f8109 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeletecollectionRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeletecollectionRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.DeleteCollectionRequest; -import com.glean.api_client.glean_api_client.operations.DeletecollectionOperation; +import com.glean.api_client.glean_api_client.operations.Deletecollection; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public DeletecollectionRequestBuilder request(DeleteCollectionRequest request) { public DeletecollectionResponse call() throws Exception { RequestOperation operation - = new DeletecollectionOperation(sdkConfiguration); + = new Deletecollection.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeletecollectionitemRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeletecollectionitemRequestBuilder.java index 60a35073..009be5d0 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeletecollectionitemRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeletecollectionitemRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.DeleteCollectionItemRequest; -import com.glean.api_client.glean_api_client.operations.DeletecollectionitemOperation; +import com.glean.api_client.glean_api_client.operations.Deletecollectionitem; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public DeletecollectionitemRequestBuilder request(DeleteCollectionItemRequest re public DeletecollectionitemResponse call() throws Exception { RequestOperation operation - = new DeletecollectionitemOperation(sdkConfiguration); + = new Deletecollectionitem.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeleteshortcutRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeleteshortcutRequestBuilder.java index 463f3207..d9950f66 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeleteshortcutRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DeleteshortcutRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.DeleteShortcutRequest; -import com.glean.api_client.glean_api_client.operations.DeleteshortcutOperation; +import com.glean.api_client.glean_api_client.operations.Deleteshortcut; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public DeleteshortcutRequestBuilder request(DeleteShortcutRequest request) { public DeleteshortcutResponse call() throws Exception { RequestOperation operation - = new DeleteshortcutOperation(sdkConfiguration); + = new Deleteshortcut.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DownloadpolicycsvRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DownloadpolicycsvRequestBuilder.java index 85508a2a..ec774d80 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DownloadpolicycsvRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DownloadpolicycsvRequestBuilder.java @@ -6,7 +6,7 @@ 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.operations.DownloadpolicycsvOperation; +import com.glean.api_client.glean_api_client.operations.Downloadpolicycsv; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.String; @@ -37,7 +37,7 @@ private DownloadpolicycsvRequest buildRequest() { public DownloadpolicycsvResponse call() throws Exception { RequestOperation operation - = new DownloadpolicycsvOperation(sdkConfiguration); + = new Downloadpolicycsv.Sync(sdkConfiguration); DownloadpolicycsvRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DownloadreportcsvRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DownloadreportcsvRequestBuilder.java index 9ca690c8..84b0333e 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/DownloadreportcsvRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/DownloadreportcsvRequestBuilder.java @@ -6,7 +6,7 @@ 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.operations.DownloadreportcsvOperation; +import com.glean.api_client.glean_api_client.operations.Downloadreportcsv; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.String; @@ -37,7 +37,7 @@ private DownloadreportcsvRequest buildRequest() { public DownloadreportcsvResponse call() throws Exception { RequestOperation operation - = new DownloadreportcsvOperation(sdkConfiguration); + = new Downloadreportcsv.Sync(sdkConfiguration); DownloadreportcsvRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/EditanswerRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/EditanswerRequestBuilder.java index 5c8622ce..33217038 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/EditanswerRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/EditanswerRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.EditAnswerRequest; -import com.glean.api_client.glean_api_client.operations.EditanswerOperation; +import com.glean.api_client.glean_api_client.operations.Editanswer; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public EditanswerRequestBuilder request(EditAnswerRequest request) { public EditanswerResponse call() throws Exception { RequestOperation operation - = new EditanswerOperation(sdkConfiguration); + = new Editanswer.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/EditcollectionRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/EditcollectionRequestBuilder.java index 65c84996..31ad42e1 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/EditcollectionRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/EditcollectionRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.EditCollectionRequest; -import com.glean.api_client.glean_api_client.operations.EditcollectionOperation; +import com.glean.api_client.glean_api_client.operations.Editcollection; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public EditcollectionRequestBuilder request(EditCollectionRequest request) { public EditcollectionResponse call() throws Exception { RequestOperation operation - = new EditcollectionOperation(sdkConfiguration); + = new Editcollection.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/EditcollectionitemRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/EditcollectionitemRequestBuilder.java index dee9eb38..acb929a0 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/EditcollectionitemRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/EditcollectionitemRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.EditCollectionItemRequest; -import com.glean.api_client.glean_api_client.operations.EditcollectionitemOperation; +import com.glean.api_client.glean_api_client.operations.Editcollectionitem; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public EditcollectionitemRequestBuilder request(EditCollectionItemRequest reques public EditcollectionitemResponse call() throws Exception { RequestOperation operation - = new EditcollectionitemOperation(sdkConfiguration); + = new Editcollectionitem.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/EditpinRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/EditpinRequestBuilder.java index 8b1416fb..ee1f6246 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/EditpinRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/EditpinRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.EditPinRequest; -import com.glean.api_client.glean_api_client.operations.EditpinOperation; +import com.glean.api_client.glean_api_client.operations.Editpin; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public EditpinRequestBuilder request(EditPinRequest request) { public EditpinResponse call() throws Exception { RequestOperation operation - = new EditpinOperation(sdkConfiguration); + = new Editpin.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/FeedRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/FeedRequestBuilder.java index a9184b74..5b3c0fcf 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/FeedRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/FeedRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.FeedRequest; -import com.glean.api_client.glean_api_client.operations.FeedOperation; +import com.glean.api_client.glean_api_client.operations.Feed; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public FeedRequestBuilder request(FeedRequest request) { public FeedResponse call() throws Exception { RequestOperation operation - = new FeedOperation(sdkConfiguration); + = new Feed.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/FeedbackRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/FeedbackRequestBuilder.java index 48af5c7c..6703a153 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/FeedbackRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/FeedbackRequestBuilder.java @@ -7,7 +7,6 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.Feedback; -import com.glean.api_client.glean_api_client.operations.FeedbackOperation; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.String; @@ -59,7 +58,7 @@ private FeedbackRequest buildRequest() { public FeedbackResponse call() throws Exception { RequestOperation operation - = new FeedbackOperation(sdkConfiguration); + = new com.glean.api_client.glean_api_client.operations.Feedback.Sync(sdkConfiguration); FeedbackRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetAgentRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetAgentRequestBuilder.java index 44305f4d..23f13f14 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetAgentRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetAgentRequestBuilder.java @@ -6,7 +6,7 @@ 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.operations.GetAgentOperation; +import com.glean.api_client.glean_api_client.operations.GetAgent; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.Long; @@ -53,7 +53,7 @@ private GetAgentRequest buildRequest() { public GetAgentResponse call() throws Exception { RequestOperation operation - = new GetAgentOperation(sdkConfiguration); + = new GetAgent.Sync(sdkConfiguration); GetAgentRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetAgentSchemasRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetAgentSchemasRequestBuilder.java index 82afbcd0..c216e4fb 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetAgentSchemasRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetAgentSchemasRequestBuilder.java @@ -6,7 +6,7 @@ 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.operations.GetAgentSchemasOperation; +import com.glean.api_client.glean_api_client.operations.GetAgentSchemas; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.Long; @@ -53,7 +53,7 @@ private GetAgentSchemasRequest buildRequest() { public GetAgentSchemasResponse call() throws Exception { RequestOperation operation - = new GetAgentSchemasOperation(sdkConfiguration); + = new GetAgentSchemas.Sync(sdkConfiguration); GetAgentSchemasRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetRestApiV1ToolsListRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetRestApiV1ToolsListRequestBuilder.java index 00e8252b..e9add60c 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetRestApiV1ToolsListRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetRestApiV1ToolsListRequestBuilder.java @@ -6,7 +6,7 @@ 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.operations.GetRestApiV1ToolsListOperation; +import com.glean.api_client.glean_api_client.operations.GetRestApiV1ToolsList; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.String; @@ -45,7 +45,7 @@ private GetRestApiV1ToolsListRequest buildRequest() { public GetRestApiV1ToolsListResponse call() throws Exception { RequestOperation operation - = new GetRestApiV1ToolsListOperation(sdkConfiguration); + = new GetRestApiV1ToolsList.Sync(sdkConfiguration); GetRestApiV1ToolsListRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetanswerRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetanswerRequestBuilder.java index 326f702d..7ca3691c 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetanswerRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetanswerRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.GetAnswerRequest; -import com.glean.api_client.glean_api_client.operations.GetanswerOperation; +import com.glean.api_client.glean_api_client.operations.Getanswer; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public GetanswerRequestBuilder request(GetAnswerRequest request) { public GetanswerResponse call() throws Exception { RequestOperation operation - = new GetanswerOperation(sdkConfiguration); + = new Getanswer.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetchatRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetchatRequestBuilder.java index e4f29a62..3ecaa63d 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetchatRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetchatRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.GetChatRequest; -import com.glean.api_client.glean_api_client.operations.GetchatOperation; +import com.glean.api_client.glean_api_client.operations.Getchat; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.Long; @@ -53,7 +53,7 @@ private GetchatRequest buildRequest() { public GetchatResponse call() throws Exception { RequestOperation operation - = new GetchatOperation(sdkConfiguration); + = new Getchat.Sync(sdkConfiguration); GetchatRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetchatapplicationRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetchatapplicationRequestBuilder.java index de0b470f..84f36783 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetchatapplicationRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetchatapplicationRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.GetChatApplicationRequest; -import com.glean.api_client.glean_api_client.operations.GetchatapplicationOperation; +import com.glean.api_client.glean_api_client.operations.Getchatapplication; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.Long; @@ -53,7 +53,7 @@ private GetchatapplicationRequest buildRequest() { public GetchatapplicationResponse call() throws Exception { RequestOperation operation - = new GetchatapplicationOperation(sdkConfiguration); + = new Getchatapplication.Sync(sdkConfiguration); GetchatapplicationRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetchatfilesRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetchatfilesRequestBuilder.java index 356a6692..6762f447 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetchatfilesRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetchatfilesRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.GetChatFilesRequest; -import com.glean.api_client.glean_api_client.operations.GetchatfilesOperation; +import com.glean.api_client.glean_api_client.operations.Getchatfiles; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.Long; @@ -53,7 +53,7 @@ private GetchatfilesRequest buildRequest() { public GetchatfilesResponse call() throws Exception { RequestOperation operation - = new GetchatfilesOperation(sdkConfiguration); + = new Getchatfiles.Sync(sdkConfiguration); GetchatfilesRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetcollectionRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetcollectionRequestBuilder.java index cbaeeb85..69813859 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetcollectionRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetcollectionRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.GetCollectionRequest; -import com.glean.api_client.glean_api_client.operations.GetcollectionOperation; +import com.glean.api_client.glean_api_client.operations.Getcollection; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public GetcollectionRequestBuilder request(GetCollectionRequest request) { public GetcollectionResponse call() throws Exception { RequestOperation operation - = new GetcollectionOperation(sdkConfiguration); + = new Getcollection.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetdocpermissionsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetdocpermissionsRequestBuilder.java index b9189060..ea92a3d7 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetdocpermissionsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetdocpermissionsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.GetDocPermissionsRequest; -import com.glean.api_client.glean_api_client.operations.GetdocpermissionsOperation; +import com.glean.api_client.glean_api_client.operations.Getdocpermissions; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public GetdocpermissionsRequestBuilder request(GetDocPermissionsRequest request) public GetdocpermissionsResponse call() throws Exception { RequestOperation operation - = new GetdocpermissionsOperation(sdkConfiguration); + = new Getdocpermissions.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetdocumentsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetdocumentsRequestBuilder.java index b5886f5b..dd73c98e 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetdocumentsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetdocumentsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.GetDocumentsRequest; -import com.glean.api_client.glean_api_client.operations.GetdocumentsOperation; +import com.glean.api_client.glean_api_client.operations.Getdocuments; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.util.Optional; @@ -36,7 +36,7 @@ public GetdocumentsRequestBuilder request(Optional, GetdocumentsResponse> operation - = new GetdocumentsOperation(sdkConfiguration); + = new Getdocuments.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetdocumentsbyfacetsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetdocumentsbyfacetsRequestBuilder.java index e297bbff..3ea43821 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetdocumentsbyfacetsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetdocumentsbyfacetsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.GetDocumentsByFacetsRequest; -import com.glean.api_client.glean_api_client.operations.GetdocumentsbyfacetsOperation; +import com.glean.api_client.glean_api_client.operations.Getdocumentsbyfacets; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.util.Optional; @@ -36,7 +36,7 @@ public GetdocumentsbyfacetsRequestBuilder request(Optional, GetdocumentsbyfacetsResponse> operation - = new GetdocumentsbyfacetsOperation(sdkConfiguration); + = new Getdocumentsbyfacets.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetdocvisibilityRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetdocvisibilityRequestBuilder.java index 3d989fa2..dbf38912 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetdocvisibilityRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetdocvisibilityRequestBuilder.java @@ -6,7 +6,7 @@ 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.operations.GetdocvisibilityOperation; +import com.glean.api_client.glean_api_client.operations.Getdocvisibility; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.String; @@ -45,7 +45,7 @@ private GetdocvisibilityRequest buildRequest() { public GetdocvisibilityResponse call() throws Exception { RequestOperation operation - = new GetdocvisibilityOperation(sdkConfiguration); + = new Getdocvisibility.Sync(sdkConfiguration); GetdocvisibilityRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetpinRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetpinRequestBuilder.java index 2dc19eaf..0c61b0e3 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetpinRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetpinRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.GetPinRequest; -import com.glean.api_client.glean_api_client.operations.GetpinOperation; +import com.glean.api_client.glean_api_client.operations.Getpin; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public GetpinRequestBuilder request(GetPinRequest request) { public GetpinResponse call() throws Exception { RequestOperation operation - = new GetpinOperation(sdkConfiguration); + = new Getpin.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetpolicyRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetpolicyRequestBuilder.java index 4ec70036..94092eea 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetpolicyRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetpolicyRequestBuilder.java @@ -6,7 +6,7 @@ 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.operations.GetpolicyOperation; +import com.glean.api_client.glean_api_client.operations.Getpolicy; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.Long; @@ -53,7 +53,7 @@ private GetpolicyRequest buildRequest() { public GetpolicyResponse call() throws Exception { RequestOperation operation - = new GetpolicyOperation(sdkConfiguration); + = new Getpolicy.Sync(sdkConfiguration); GetpolicyRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetreportstatusRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetreportstatusRequestBuilder.java index 0a006677..6c1ead83 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetreportstatusRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetreportstatusRequestBuilder.java @@ -6,7 +6,7 @@ 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.operations.GetreportstatusOperation; +import com.glean.api_client.glean_api_client.operations.Getreportstatus; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.String; @@ -37,7 +37,7 @@ private GetreportstatusRequest buildRequest() { public GetreportstatusResponse call() throws Exception { RequestOperation operation - = new GetreportstatusOperation(sdkConfiguration); + = new Getreportstatus.Sync(sdkConfiguration); GetreportstatusRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetshortcutRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetshortcutRequestBuilder.java index 917cdd1a..79b5ee6b 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetshortcutRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/GetshortcutRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.GetShortcutRequestUnion; -import com.glean.api_client.glean_api_client.operations.GetshortcutOperation; +import com.glean.api_client.glean_api_client.operations.Getshortcut; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public GetshortcutRequestBuilder request(GetShortcutRequestUnion request) { public GetshortcutResponse call() throws Exception { RequestOperation operation - = new GetshortcutOperation(sdkConfiguration); + = new Getshortcut.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/InsightsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/InsightsRequestBuilder.java index 7e2e5d32..f261bdae 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/InsightsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/InsightsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.InsightsRequest; -import com.glean.api_client.glean_api_client.operations.InsightsOperation; +import com.glean.api_client.glean_api_client.operations.Insights; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public InsightsRequestBuilder request(InsightsRequest request) { public InsightsResponse call() throws Exception { RequestOperation operation - = new InsightsOperation(sdkConfiguration); + = new Insights.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListanswersRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListanswersRequestBuilder.java index c68322f6..3f19a669 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListanswersRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListanswersRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.ListAnswersRequest; -import com.glean.api_client.glean_api_client.operations.ListanswersOperation; +import com.glean.api_client.glean_api_client.operations.Listanswers; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public ListanswersRequestBuilder request(ListAnswersRequest request) { public ListanswersResponse call() throws Exception { RequestOperation operation - = new ListanswersOperation(sdkConfiguration); + = new Listanswers.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListchatsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListchatsRequestBuilder.java index 9f423306..1cfa9db1 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListchatsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListchatsRequestBuilder.java @@ -6,7 +6,7 @@ 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.operations.ListchatsOperation; +import com.glean.api_client.glean_api_client.operations.Listchats; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.Long; @@ -44,7 +44,7 @@ private ListchatsRequest buildRequest() { public ListchatsResponse call() throws Exception { RequestOperation operation - = new ListchatsOperation(sdkConfiguration); + = new Listchats.Sync(sdkConfiguration); ListchatsRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListcollectionsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListcollectionsRequestBuilder.java index eb998788..4fd93d27 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListcollectionsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListcollectionsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.ListCollectionsRequest; -import com.glean.api_client.glean_api_client.operations.ListcollectionsOperation; +import com.glean.api_client.glean_api_client.operations.Listcollections; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public ListcollectionsRequestBuilder request(ListCollectionsRequest request) { public ListcollectionsResponse call() throws Exception { RequestOperation operation - = new ListcollectionsOperation(sdkConfiguration); + = new Listcollections.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListentitiesRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListentitiesRequestBuilder.java index a1878f13..764720f3 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListentitiesRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListentitiesRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.ListEntitiesRequest; -import com.glean.api_client.glean_api_client.operations.ListentitiesOperation; +import com.glean.api_client.glean_api_client.operations.Listentities; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public ListentitiesRequestBuilder request(ListEntitiesRequest request) { public ListentitiesResponse call() throws Exception { RequestOperation operation - = new ListentitiesOperation(sdkConfiguration); + = new Listentities.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListpinsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListpinsRequestBuilder.java index bfd46ae5..03f84f1b 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListpinsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListpinsRequestBuilder.java @@ -6,7 +6,7 @@ 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.operations.ListpinsOperation; +import com.glean.api_client.glean_api_client.operations.Listpins; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -28,7 +28,7 @@ public ListpinsRequestBuilder request(ListpinsRequest request) { public ListpinsResponse call() throws Exception { RequestOperation operation - = new ListpinsOperation(sdkConfiguration); + = new Listpins.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListpoliciesRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListpoliciesRequestBuilder.java index 4c1505a9..4de5d63b 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListpoliciesRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListpoliciesRequestBuilder.java @@ -6,7 +6,7 @@ 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.operations.ListpoliciesOperation; +import com.glean.api_client.glean_api_client.operations.Listpolicies; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Boolean; import java.lang.Exception; @@ -59,7 +59,7 @@ private ListpoliciesRequest buildRequest() { public ListpoliciesResponse call() throws Exception { RequestOperation operation - = new ListpoliciesOperation(sdkConfiguration); + = new Listpolicies.Sync(sdkConfiguration); ListpoliciesRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListshortcutsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListshortcutsRequestBuilder.java index f8a9fe92..81c73de3 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListshortcutsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListshortcutsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.ListShortcutsPaginatedRequest; -import com.glean.api_client.glean_api_client.operations.ListshortcutsOperation; +import com.glean.api_client.glean_api_client.operations.Listshortcuts; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public ListshortcutsRequestBuilder request(ListShortcutsPaginatedRequest request public ListshortcutsResponse call() throws Exception { RequestOperation operation - = new ListshortcutsOperation(sdkConfiguration); + = new Listshortcuts.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListverificationsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListverificationsRequestBuilder.java index 03d1b972..cd88a2db 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListverificationsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/ListverificationsRequestBuilder.java @@ -6,7 +6,7 @@ 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.operations.ListverificationsOperation; +import com.glean.api_client.glean_api_client.operations.Listverifications; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.Long; @@ -44,7 +44,7 @@ private ListverificationsRequest buildRequest() { public ListverificationsResponse call() throws Exception { RequestOperation operation - = new ListverificationsOperation(sdkConfiguration); + = new Listverifications.Sync(sdkConfiguration); ListverificationsRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/MessagesRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/MessagesRequestBuilder.java index 44f75047..986cf3fa 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/MessagesRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/MessagesRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.MessagesRequest; -import com.glean.api_client.glean_api_client.operations.MessagesOperation; +import com.glean.api_client.glean_api_client.operations.Messages; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public MessagesRequestBuilder request(MessagesRequest request) { public MessagesResponse call() throws Exception { RequestOperation operation - = new MessagesOperation(sdkConfiguration); + = new Messages.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PeopleRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PeopleRequestBuilder.java index 75edf2fb..0b05e76b 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PeopleRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PeopleRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.PeopleRequest; -import com.glean.api_client.glean_api_client.operations.PeopleOperation; +import com.glean.api_client.glean_api_client.operations.People; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PeopleRequestBuilder request(PeopleRequest request) { public PeopleResponse call() throws Exception { RequestOperation operation - = new PeopleOperation(sdkConfiguration); + = new People.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PinRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PinRequestBuilder.java index 585c43ce..a438bb68 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PinRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PinRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.PinRequest; -import com.glean.api_client.glean_api_client.operations.PinOperation; +import com.glean.api_client.glean_api_client.operations.Pin; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PinRequestBuilder request(PinRequest request) { public PinResponse call() throws Exception { RequestOperation operation - = new PinOperation(sdkConfiguration); + = new Pin.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1AdddatasourceRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1AdddatasourceRequestBuilder.java index 8be861a4..8a3be893 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1AdddatasourceRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1AdddatasourceRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.CustomDatasourceConfig; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1AdddatasourceOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Adddatasource; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1AdddatasourceRequestBuilder request(CustomDatasourceConfig public PostApiIndexV1AdddatasourceResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1AdddatasourceOperation(sdkConfiguration); + = new PostApiIndexV1Adddatasource.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BetausersRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BetausersRequestBuilder.java index 08bfbc8d..21b445fe 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BetausersRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BetausersRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.GreenlistUsersRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1BetausersOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Betausers; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1BetausersRequestBuilder request(GreenlistUsersRequest reque public PostApiIndexV1BetausersResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1BetausersOperation(sdkConfiguration); + = new PostApiIndexV1Betausers.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexdocumentsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexdocumentsRequestBuilder.java index 8942cb6e..d019cecb 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexdocumentsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexdocumentsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.BulkIndexDocumentsRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1BulkindexdocumentsOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Bulkindexdocuments; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1BulkindexdocumentsRequestBuilder request(BulkIndexDocuments public PostApiIndexV1BulkindexdocumentsResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1BulkindexdocumentsOperation(sdkConfiguration); + = new PostApiIndexV1Bulkindexdocuments.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexemployeesRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexemployeesRequestBuilder.java index aec65c67..950c5cb2 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexemployeesRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexemployeesRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.BulkIndexEmployeesRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1BulkindexemployeesOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Bulkindexemployees; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1BulkindexemployeesRequestBuilder request(BulkIndexEmployees public PostApiIndexV1BulkindexemployeesResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1BulkindexemployeesOperation(sdkConfiguration); + = new PostApiIndexV1Bulkindexemployees.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexgroupsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexgroupsRequestBuilder.java index 5126a273..04bd9c87 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexgroupsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexgroupsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.BulkIndexGroupsRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1BulkindexgroupsOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Bulkindexgroups; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1BulkindexgroupsRequestBuilder request(BulkIndexGroupsReques public PostApiIndexV1BulkindexgroupsResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1BulkindexgroupsOperation(sdkConfiguration); + = new PostApiIndexV1Bulkindexgroups.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexmembershipsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexmembershipsRequestBuilder.java index 80a2d79e..b6621c49 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexmembershipsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexmembershipsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.BulkIndexMembershipsRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1BulkindexmembershipsOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Bulkindexmemberships; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1BulkindexmembershipsRequestBuilder request(BulkIndexMembers public PostApiIndexV1BulkindexmembershipsResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1BulkindexmembershipsOperation(sdkConfiguration); + = new PostApiIndexV1Bulkindexmemberships.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexshortcutsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexshortcutsRequestBuilder.java index 98f2c142..88accd62 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexshortcutsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexshortcutsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.BulkIndexShortcutsRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1BulkindexshortcutsOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Bulkindexshortcuts; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1BulkindexshortcutsRequestBuilder request(BulkIndexShortcuts public PostApiIndexV1BulkindexshortcutsResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1BulkindexshortcutsOperation(sdkConfiguration); + = new PostApiIndexV1Bulkindexshortcuts.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexteamsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexteamsRequestBuilder.java index 045b2121..10022c5b 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexteamsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexteamsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.BulkIndexTeamsRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1BulkindexteamsOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Bulkindexteams; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1BulkindexteamsRequestBuilder request(BulkIndexTeamsRequest public PostApiIndexV1BulkindexteamsResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1BulkindexteamsOperation(sdkConfiguration); + = new PostApiIndexV1Bulkindexteams.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexusersRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexusersRequestBuilder.java index a5eaea6b..911c6437 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexusersRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1BulkindexusersRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.BulkIndexUsersRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1BulkindexusersOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Bulkindexusers; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1BulkindexusersRequestBuilder request(BulkIndexUsersRequest public PostApiIndexV1BulkindexusersResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1BulkindexusersOperation(sdkConfiguration); + = new PostApiIndexV1Bulkindexusers.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1CheckdocumentaccessRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1CheckdocumentaccessRequestBuilder.java index 86ed20bc..30bcd98e 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1CheckdocumentaccessRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1CheckdocumentaccessRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.CheckDocumentAccessRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1CheckdocumentaccessOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Checkdocumentaccess; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1CheckdocumentaccessRequestBuilder request(CheckDocumentAcce public PostApiIndexV1CheckdocumentaccessResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1CheckdocumentaccessOperation(sdkConfiguration); + = new PostApiIndexV1Checkdocumentaccess.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DebugDatasourceDocumentRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DebugDatasourceDocumentRequestBuilder.java index b65bbf67..64ae6d7d 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DebugDatasourceDocumentRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DebugDatasourceDocumentRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.DebugDocumentRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DebugDatasourceDocumentOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DebugDatasourceDocument; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.String; @@ -46,7 +46,7 @@ private PostApiIndexV1DebugDatasourceDocumentRequest buildRequest() { public PostApiIndexV1DebugDatasourceDocumentResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1DebugDatasourceDocumentOperation(sdkConfiguration); + = new PostApiIndexV1DebugDatasourceDocument.Sync(sdkConfiguration); PostApiIndexV1DebugDatasourceDocumentRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DebugDatasourceDocumentsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DebugDatasourceDocumentsRequestBuilder.java index c8f84757..776e1122 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DebugDatasourceDocumentsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DebugDatasourceDocumentsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.DebugDocumentsRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DebugDatasourceDocumentsOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DebugDatasourceDocuments; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.String; @@ -46,7 +46,7 @@ private PostApiIndexV1DebugDatasourceDocumentsRequest buildRequest() { public PostApiIndexV1DebugDatasourceDocumentsResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1DebugDatasourceDocumentsOperation(sdkConfiguration); + = new PostApiIndexV1DebugDatasourceDocuments.Sync(sdkConfiguration); PostApiIndexV1DebugDatasourceDocumentsRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DebugDatasourceStatusRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DebugDatasourceStatusRequestBuilder.java index 0c4d98b7..289993a9 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DebugDatasourceStatusRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DebugDatasourceStatusRequestBuilder.java @@ -6,7 +6,7 @@ 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.operations.PostApiIndexV1DebugDatasourceStatusOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DebugDatasourceStatus; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.String; @@ -37,7 +37,7 @@ private PostApiIndexV1DebugDatasourceStatusRequest buildRequest() { public PostApiIndexV1DebugDatasourceStatusResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1DebugDatasourceStatusOperation(sdkConfiguration); + = new PostApiIndexV1DebugDatasourceStatus.Sync(sdkConfiguration); PostApiIndexV1DebugDatasourceStatusRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DebugDatasourceUserRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DebugDatasourceUserRequestBuilder.java index 83941a55..1d0d5565 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DebugDatasourceUserRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DebugDatasourceUserRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.DebugUserRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DebugDatasourceUserOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DebugDatasourceUser; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.String; @@ -46,7 +46,7 @@ private PostApiIndexV1DebugDatasourceUserRequest buildRequest() { public PostApiIndexV1DebugDatasourceUserResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1DebugDatasourceUserOperation(sdkConfiguration); + = new PostApiIndexV1DebugDatasourceUser.Sync(sdkConfiguration); PostApiIndexV1DebugDatasourceUserRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeletedocumentRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeletedocumentRequestBuilder.java index a359261b..aece5cbf 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeletedocumentRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeletedocumentRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.DeleteDocumentRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DeletedocumentOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Deletedocument; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1DeletedocumentRequestBuilder request(DeleteDocumentRequest public PostApiIndexV1DeletedocumentResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1DeletedocumentOperation(sdkConfiguration); + = new PostApiIndexV1Deletedocument.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeleteemployeeRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeleteemployeeRequestBuilder.java index 863d0190..0ec304b5 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeleteemployeeRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeleteemployeeRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.DeleteEmployeeRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DeleteemployeeOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Deleteemployee; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1DeleteemployeeRequestBuilder request(DeleteEmployeeRequest public PostApiIndexV1DeleteemployeeResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1DeleteemployeeOperation(sdkConfiguration); + = new PostApiIndexV1Deleteemployee.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeletegroupRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeletegroupRequestBuilder.java index b2e6575b..ee17bbfd 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeletegroupRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeletegroupRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.DeleteGroupRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DeletegroupOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Deletegroup; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1DeletegroupRequestBuilder request(DeleteGroupRequest reques public PostApiIndexV1DeletegroupResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1DeletegroupOperation(sdkConfiguration); + = new PostApiIndexV1Deletegroup.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeletemembershipRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeletemembershipRequestBuilder.java index d47311a7..eaba1199 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeletemembershipRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeletemembershipRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.DeleteMembershipRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DeletemembershipOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Deletemembership; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1DeletemembershipRequestBuilder request(DeleteMembershipRequ public PostApiIndexV1DeletemembershipResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1DeletemembershipOperation(sdkConfiguration); + = new PostApiIndexV1Deletemembership.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeleteteamRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeleteteamRequestBuilder.java index 0351db0c..226633d2 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeleteteamRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeleteteamRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.DeleteTeamRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DeleteteamOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Deleteteam; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1DeleteteamRequestBuilder request(DeleteTeamRequest request) public PostApiIndexV1DeleteteamResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1DeleteteamOperation(sdkConfiguration); + = new PostApiIndexV1Deleteteam.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeleteuserRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeleteuserRequestBuilder.java index 5e720585..323c9c11 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeleteuserRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1DeleteuserRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.DeleteUserRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1DeleteuserOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Deleteuser; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1DeleteuserRequestBuilder request(DeleteUserRequest request) public PostApiIndexV1DeleteuserResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1DeleteuserOperation(sdkConfiguration); + = new PostApiIndexV1Deleteuser.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1GetdatasourceconfigRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1GetdatasourceconfigRequestBuilder.java index 6e12ff98..07116108 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1GetdatasourceconfigRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1GetdatasourceconfigRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.GetDatasourceConfigRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1GetdatasourceconfigOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Getdatasourceconfig; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1GetdatasourceconfigRequestBuilder request(GetDatasourceConf public PostApiIndexV1GetdatasourceconfigResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1GetdatasourceconfigOperation(sdkConfiguration); + = new PostApiIndexV1Getdatasourceconfig.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1GetdocumentcountRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1GetdocumentcountRequestBuilder.java index 785be290..82dcd8ab 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1GetdocumentcountRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1GetdocumentcountRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.GetDocumentCountRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1GetdocumentcountOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Getdocumentcount; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1GetdocumentcountRequestBuilder request(GetDocumentCountRequ public PostApiIndexV1GetdocumentcountResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1GetdocumentcountOperation(sdkConfiguration); + = new PostApiIndexV1Getdocumentcount.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1GetdocumentstatusRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1GetdocumentstatusRequestBuilder.java index 7ef793f3..a498edf1 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1GetdocumentstatusRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1GetdocumentstatusRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.GetDocumentStatusRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1GetdocumentstatusOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Getdocumentstatus; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1GetdocumentstatusRequestBuilder request(GetDocumentStatusRe public PostApiIndexV1GetdocumentstatusResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1GetdocumentstatusOperation(sdkConfiguration); + = new PostApiIndexV1Getdocumentstatus.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1GetusercountRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1GetusercountRequestBuilder.java index b1e10795..6c351f4b 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1GetusercountRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1GetusercountRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.GetUserCountRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1GetusercountOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Getusercount; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1GetusercountRequestBuilder request(GetUserCountRequest requ public PostApiIndexV1GetusercountResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1GetusercountOperation(sdkConfiguration); + = new PostApiIndexV1Getusercount.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexdocumentRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexdocumentRequestBuilder.java index 23f93a78..74d94d2e 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexdocumentRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexdocumentRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.IndexDocumentRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1IndexdocumentOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Indexdocument; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1IndexdocumentRequestBuilder request(IndexDocumentRequest re public PostApiIndexV1IndexdocumentResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1IndexdocumentOperation(sdkConfiguration); + = new PostApiIndexV1Indexdocument.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexdocumentsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexdocumentsRequestBuilder.java index 5359c742..317430df 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexdocumentsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexdocumentsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.IndexDocumentsRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1IndexdocumentsOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Indexdocuments; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1IndexdocumentsRequestBuilder request(IndexDocumentsRequest public PostApiIndexV1IndexdocumentsResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1IndexdocumentsOperation(sdkConfiguration); + = new PostApiIndexV1Indexdocuments.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexemployeeRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexemployeeRequestBuilder.java index c4b93e2d..50244089 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexemployeeRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexemployeeRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.IndexEmployeeRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1IndexemployeeOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Indexemployee; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1IndexemployeeRequestBuilder request(IndexEmployeeRequest re public PostApiIndexV1IndexemployeeResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1IndexemployeeOperation(sdkConfiguration); + = new PostApiIndexV1Indexemployee.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexgroupRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexgroupRequestBuilder.java index f920b7de..3e6d8193 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexgroupRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexgroupRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.IndexGroupRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1IndexgroupOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Indexgroup; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1IndexgroupRequestBuilder request(IndexGroupRequest request) public PostApiIndexV1IndexgroupResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1IndexgroupOperation(sdkConfiguration); + = new PostApiIndexV1Indexgroup.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexmembershipRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexmembershipRequestBuilder.java index 37cbeb0f..af279426 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexmembershipRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexmembershipRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.IndexMembershipRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1IndexmembershipOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Indexmembership; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1IndexmembershipRequestBuilder request(IndexMembershipReques public PostApiIndexV1IndexmembershipResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1IndexmembershipOperation(sdkConfiguration); + = new PostApiIndexV1Indexmembership.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexteamRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexteamRequestBuilder.java index 736f671a..59f2fd4f 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexteamRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexteamRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.IndexTeamRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1IndexteamOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Indexteam; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1IndexteamRequestBuilder request(IndexTeamRequest request) { public PostApiIndexV1IndexteamResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1IndexteamOperation(sdkConfiguration); + = new PostApiIndexV1Indexteam.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexuserRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexuserRequestBuilder.java index 1cc614e0..9171e573 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexuserRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1IndexuserRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.IndexUserRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1IndexuserOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Indexuser; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1IndexuserRequestBuilder request(IndexUserRequest request) { public PostApiIndexV1IndexuserResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1IndexuserOperation(sdkConfiguration); + = new PostApiIndexV1Indexuser.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1ProcessalldocumentsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1ProcessalldocumentsRequestBuilder.java index 381ddbd3..d0e81a6b 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1ProcessalldocumentsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1ProcessalldocumentsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.ProcessAllDocumentsRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1ProcessalldocumentsOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Processalldocuments; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.util.Optional; @@ -36,7 +36,7 @@ public PostApiIndexV1ProcessalldocumentsRequestBuilder request(Optional, PostApiIndexV1ProcessalldocumentsResponse> operation - = new PostApiIndexV1ProcessalldocumentsOperation(sdkConfiguration); + = new PostApiIndexV1Processalldocuments.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1ProcessallemployeesandteamsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1ProcessallemployeesandteamsRequestBuilder.java index 1f601215..1d531701 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1ProcessallemployeesandteamsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1ProcessallemployeesandteamsRequestBuilder.java @@ -6,7 +6,7 @@ import static com.glean.api_client.glean_api_client.operations.Operations.RequestlessOperation; import com.glean.api_client.glean_api_client.SDKConfiguration; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1ProcessallemployeesandteamsOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Processallemployeesandteams; import java.lang.Exception; public class PostApiIndexV1ProcessallemployeesandteamsRequestBuilder { @@ -20,7 +20,7 @@ public PostApiIndexV1ProcessallemployeesandteamsRequestBuilder(SDKConfiguration public PostApiIndexV1ProcessallemployeesandteamsResponse call() throws Exception { RequestlessOperation operation - = new PostApiIndexV1ProcessallemployeesandteamsOperation(sdkConfiguration); + = new PostApiIndexV1Processallemployeesandteams.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest()); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1ProcessallmembershipsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1ProcessallmembershipsRequestBuilder.java index fb51e0c3..c70d8dcd 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1ProcessallmembershipsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1ProcessallmembershipsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.ProcessAllMembershipsRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1ProcessallmembershipsOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Processallmemberships; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.util.Optional; @@ -36,7 +36,7 @@ public PostApiIndexV1ProcessallmembershipsRequestBuilder request(Optional, PostApiIndexV1ProcessallmembershipsResponse> operation - = new PostApiIndexV1ProcessallmembershipsOperation(sdkConfiguration); + = new PostApiIndexV1Processallmemberships.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1RotatetokenRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1RotatetokenRequestBuilder.java index 7443de2a..3f6e55ba 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1RotatetokenRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1RotatetokenRequestBuilder.java @@ -6,7 +6,7 @@ import static com.glean.api_client.glean_api_client.operations.Operations.RequestlessOperation; import com.glean.api_client.glean_api_client.SDKConfiguration; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1RotatetokenOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Rotatetoken; import java.lang.Exception; public class PostApiIndexV1RotatetokenRequestBuilder { @@ -20,7 +20,7 @@ public PostApiIndexV1RotatetokenRequestBuilder(SDKConfiguration sdkConfiguration public PostApiIndexV1RotatetokenResponse call() throws Exception { RequestlessOperation operation - = new PostApiIndexV1RotatetokenOperation(sdkConfiguration); + = new PostApiIndexV1Rotatetoken.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest()); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1UpdatepermissionsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1UpdatepermissionsRequestBuilder.java index ee9a13ab..d7a2052f 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1UpdatepermissionsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1UpdatepermissionsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.UpdatePermissionsRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1UpdatepermissionsOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Updatepermissions; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1UpdatepermissionsRequestBuilder request(UpdatePermissionsRe public PostApiIndexV1UpdatepermissionsResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1UpdatepermissionsOperation(sdkConfiguration); + = new PostApiIndexV1Updatepermissions.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1UploadshortcutsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1UploadshortcutsRequestBuilder.java index 6f4b73cf..f516c199 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1UploadshortcutsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostApiIndexV1UploadshortcutsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.UploadShortcutsRequest; -import com.glean.api_client.glean_api_client.operations.PostApiIndexV1UploadshortcutsOperation; +import com.glean.api_client.glean_api_client.operations.PostApiIndexV1Uploadshortcuts; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostApiIndexV1UploadshortcutsRequestBuilder request(UploadShortcutsReques public PostApiIndexV1UploadshortcutsResponse call() throws Exception { RequestOperation operation - = new PostApiIndexV1UploadshortcutsOperation(sdkConfiguration); + = new PostApiIndexV1Uploadshortcuts.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostRestApiV1ToolsCallRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostRestApiV1ToolsCallRequestBuilder.java index 68815141..5243900f 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostRestApiV1ToolsCallRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/PostRestApiV1ToolsCallRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.ToolsCallRequest; -import com.glean.api_client.glean_api_client.operations.PostRestApiV1ToolsCallOperation; +import com.glean.api_client.glean_api_client.operations.PostRestApiV1ToolsCall; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public PostRestApiV1ToolsCallRequestBuilder request(ToolsCallRequest request) { public PostRestApiV1ToolsCallResponse call() throws Exception { RequestOperation operation - = new PostRestApiV1ToolsCallOperation(sdkConfiguration); + = new PostRestApiV1ToolsCall.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/RecommendationsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/RecommendationsRequestBuilder.java index fc42a1c1..12eeab8e 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/RecommendationsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/RecommendationsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.RecommendationsRequest; -import com.glean.api_client.glean_api_client.operations.RecommendationsOperation; +import com.glean.api_client.glean_api_client.operations.Recommendations; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public RecommendationsRequestBuilder request(RecommendationsRequest request) { public RecommendationsResponse call() throws Exception { RequestOperation operation - = new RecommendationsOperation(sdkConfiguration); + = new Recommendations.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/SearchAgentsRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/SearchAgentsRequestBuilder.java index 889697ba..6a0972f1 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/SearchAgentsRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/SearchAgentsRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.SearchAgentsRequest; -import com.glean.api_client.glean_api_client.operations.SearchAgentsOperation; +import com.glean.api_client.glean_api_client.operations.SearchAgents; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public SearchAgentsRequestBuilder request(SearchAgentsRequest request) { public SearchAgentsResponse call() throws Exception { RequestOperation operation - = new SearchAgentsOperation(sdkConfiguration); + = new SearchAgents.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/SearchRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/SearchRequestBuilder.java index 26aaf6c9..3c79d6ed 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/SearchRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/SearchRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.SearchRequest; -import com.glean.api_client.glean_api_client.operations.SearchOperation; +import com.glean.api_client.glean_api_client.operations.Search; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public SearchRequestBuilder request(SearchRequest request) { public SearchResponse call() throws Exception { RequestOperation operation - = new SearchOperation(sdkConfiguration); + = new Search.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/SetdocvisibilityRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/SetdocvisibilityRequestBuilder.java index 7ce6c956..eb2e4d18 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/SetdocvisibilityRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/SetdocvisibilityRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.UpdateDocumentVisibilityOverridesRequest; -import com.glean.api_client.glean_api_client.operations.SetdocvisibilityOperation; +import com.glean.api_client.glean_api_client.operations.Setdocvisibility; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public SetdocvisibilityRequestBuilder request(UpdateDocumentVisibilityOverridesR public SetdocvisibilityResponse call() throws Exception { RequestOperation operation - = new SetdocvisibilityOperation(sdkConfiguration); + = new Setdocvisibility.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/SummarizeRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/SummarizeRequestBuilder.java index 1e65866d..28e9d33c 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/SummarizeRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/SummarizeRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.SummarizeRequest; -import com.glean.api_client.glean_api_client.operations.SummarizeOperation; +import com.glean.api_client.glean_api_client.operations.Summarize; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public SummarizeRequestBuilder request(SummarizeRequest request) { public SummarizeResponse call() throws Exception { RequestOperation operation - = new SummarizeOperation(sdkConfiguration); + = new Summarize.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/UnpinRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/UnpinRequestBuilder.java index d1401516..6793b78e 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/UnpinRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/UnpinRequestBuilder.java @@ -7,7 +7,6 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.Unpin; -import com.glean.api_client.glean_api_client.operations.UnpinOperation; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +28,7 @@ public UnpinRequestBuilder request(Unpin request) { public UnpinResponse call() throws Exception { RequestOperation operation - = new UnpinOperation(sdkConfiguration); + = new com.glean.api_client.glean_api_client.operations.Unpin.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/UpdateannouncementRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/UpdateannouncementRequestBuilder.java index a0bb1f35..10ccb34a 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/UpdateannouncementRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/UpdateannouncementRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.UpdateAnnouncementRequest; -import com.glean.api_client.glean_api_client.operations.UpdateannouncementOperation; +import com.glean.api_client.glean_api_client.operations.Updateannouncement; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public UpdateannouncementRequestBuilder request(UpdateAnnouncementRequest reques public UpdateannouncementResponse call() throws Exception { RequestOperation operation - = new UpdateannouncementOperation(sdkConfiguration); + = new Updateannouncement.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/UpdatepolicyRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/UpdatepolicyRequestBuilder.java index 7461334a..ef36399b 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/UpdatepolicyRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/UpdatepolicyRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.UpdateDlpReportRequest; -import com.glean.api_client.glean_api_client.operations.UpdatepolicyOperation; +import com.glean.api_client.glean_api_client.operations.Updatepolicy; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.String; @@ -46,7 +46,7 @@ private UpdatepolicyRequest buildRequest() { public UpdatepolicyResponse call() throws Exception { RequestOperation operation - = new UpdatepolicyOperation(sdkConfiguration); + = new Updatepolicy.Sync(sdkConfiguration); UpdatepolicyRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/UpdateshortcutRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/UpdateshortcutRequestBuilder.java index ca2f1cf9..48051b65 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/UpdateshortcutRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/UpdateshortcutRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.UpdateShortcutRequest; -import com.glean.api_client.glean_api_client.operations.UpdateshortcutOperation; +import com.glean.api_client.glean_api_client.operations.Updateshortcut; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public UpdateshortcutRequestBuilder request(UpdateShortcutRequest request) { public UpdateshortcutResponse call() throws Exception { RequestOperation operation - = new UpdateshortcutOperation(sdkConfiguration); + = new Updateshortcut.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/UploadchatfilesRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/UploadchatfilesRequestBuilder.java index 38ab899b..6853a58b 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/UploadchatfilesRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/UploadchatfilesRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.UploadChatFilesRequest; -import com.glean.api_client.glean_api_client.operations.UploadchatfilesOperation; +import com.glean.api_client.glean_api_client.operations.Uploadchatfiles; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; import java.lang.Long; @@ -53,7 +53,7 @@ private UploadchatfilesRequest buildRequest() { public UploadchatfilesResponse call() throws Exception { RequestOperation operation - = new UploadchatfilesOperation(sdkConfiguration); + = new Uploadchatfiles.Sync(sdkConfiguration); UploadchatfilesRequest request = buildRequest(); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/glean/api_client/glean_api_client/models/operations/VerifyRequestBuilder.java b/src/main/java/com/glean/api_client/glean_api_client/models/operations/VerifyRequestBuilder.java index fdad2bf4..fef291ba 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/models/operations/VerifyRequestBuilder.java +++ b/src/main/java/com/glean/api_client/glean_api_client/models/operations/VerifyRequestBuilder.java @@ -7,7 +7,7 @@ import com.glean.api_client.glean_api_client.SDKConfiguration; import com.glean.api_client.glean_api_client.models.components.VerifyRequest; -import com.glean.api_client.glean_api_client.operations.VerifyOperation; +import com.glean.api_client.glean_api_client.operations.Verify; import com.glean.api_client.glean_api_client.utils.Utils; import java.lang.Exception; @@ -29,7 +29,7 @@ public VerifyRequestBuilder request(VerifyRequest request) { public VerifyResponse call() throws Exception { RequestOperation operation - = new VerifyOperation(sdkConfiguration); + = new Verify.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Activity.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Activity.java new file mode 100644 index 00000000..a0f06813 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Activity.java @@ -0,0 +1,180 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.ActivityResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Activity { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(com.glean.api_client.glean_api_client.models.components.Activity request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/activity"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "activity", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "activity", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "activity", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(com.glean.api_client.glean_api_client.models.components.Activity request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public ActivityResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + ActivityResponse.Builder resBuilder = + ActivityResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + ActivityResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/ActivityOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/ActivityOperation.java deleted file mode 100644 index b65ed712..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/ActivityOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.Activity; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.ActivityResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class ActivityOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public ActivityOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(Activity request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/activity"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "activity", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "activity", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "activity", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "activity", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public ActivityResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - ActivityResponse.Builder resBuilder = - ActivityResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - ActivityResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Addcollectionitems.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Addcollectionitems.java new file mode 100644 index 00000000..7bfa745b --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Addcollectionitems.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.AddCollectionItemsRequest; +import com.glean.api_client.glean_api_client.models.components.AddCollectionItemsResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.AddcollectionitemsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Addcollectionitems { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(AddCollectionItemsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/addcollectionitems"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "addcollectionitems", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "addcollectionitems", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "addcollectionitems", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(AddCollectionItemsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public AddcollectionitemsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + AddcollectionitemsResponse.Builder resBuilder = + AddcollectionitemsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + AddcollectionitemsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + AddCollectionItemsResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withAddCollectionItemsResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/AddcollectionitemsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/AddcollectionitemsOperation.java deleted file mode 100644 index 1aff13bb..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/AddcollectionitemsOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.AddCollectionItemsRequest; -import com.glean.api_client.glean_api_client.models.components.AddCollectionItemsResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.AddcollectionitemsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class AddcollectionitemsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public AddcollectionitemsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(AddCollectionItemsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/addcollectionitems"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "addcollectionitems", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "addcollectionitems", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "addcollectionitems", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "addcollectionitems", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public AddcollectionitemsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - AddcollectionitemsResponse.Builder resBuilder = - AddcollectionitemsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - AddcollectionitemsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - AddCollectionItemsResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withAddCollectionItemsResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Addverificationreminder.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Addverificationreminder.java new file mode 100644 index 00000000..dae539bf --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Addverificationreminder.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.ReminderRequest; +import com.glean.api_client.glean_api_client.models.components.Verification; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.AddverificationreminderResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Addverificationreminder { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(ReminderRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/addverificationreminder"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "addverificationreminder", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "addverificationreminder", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "addverificationreminder", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(ReminderRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public AddverificationreminderResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + AddverificationreminderResponse.Builder resBuilder = + AddverificationreminderResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + AddverificationreminderResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + Verification out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withVerification(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/AddverificationreminderOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/AddverificationreminderOperation.java deleted file mode 100644 index e21a4e44..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/AddverificationreminderOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.ReminderRequest; -import com.glean.api_client.glean_api_client.models.components.Verification; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.AddverificationreminderResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class AddverificationreminderOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public AddverificationreminderOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(ReminderRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/addverificationreminder"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "addverificationreminder", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "addverificationreminder", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "addverificationreminder", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "addverificationreminder", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public AddverificationreminderResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - AddverificationreminderResponse.Builder resBuilder = - AddverificationreminderResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - AddverificationreminderResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - Verification out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withVerification(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Adminsearch.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Adminsearch.java new file mode 100644 index 00000000..18bea8fd --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Adminsearch.java @@ -0,0 +1,211 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.SearchRequest; +import com.glean.api_client.glean_api_client.models.components.SearchResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.errors.GleanDataError; +import com.glean.api_client.glean_api_client.models.operations.AdminsearchResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Adminsearch { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(SearchRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/adminsearch"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "adminsearch", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "adminsearch", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "adminsearch", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(SearchRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "422", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public AdminsearchResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + AdminsearchResponse.Builder resBuilder = + AdminsearchResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + AdminsearchResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + SearchResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withSearchResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "403", "422")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + GleanDataError out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + throw out; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/AdminsearchOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/AdminsearchOperation.java deleted file mode 100644 index c5dfb5c5..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/AdminsearchOperation.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.SearchRequest; -import com.glean.api_client.glean_api_client.models.components.SearchResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.errors.GleanDataError; -import com.glean.api_client.glean_api_client.models.operations.AdminsearchResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class AdminsearchOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public AdminsearchOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(SearchRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/adminsearch"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "adminsearch", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "422", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "adminsearch", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "adminsearch", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "adminsearch", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public AdminsearchResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - AdminsearchResponse.Builder resBuilder = - AdminsearchResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - AdminsearchResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - SearchResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withSearchResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "403", "422")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - GleanDataError out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Autocomplete.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Autocomplete.java new file mode 100644 index 00000000..d5d186e4 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Autocomplete.java @@ -0,0 +1,193 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.AutocompleteRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.AutocompleteResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Autocomplete { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(AutocompleteRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/autocomplete"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "autocomplete", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "autocomplete", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "autocomplete", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(AutocompleteRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public AutocompleteResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + AutocompleteResponse.Builder resBuilder = + AutocompleteResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + AutocompleteResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + com.glean.api_client.glean_api_client.models.components.AutocompleteResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withAutocompleteResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/AutocompleteOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/AutocompleteOperation.java deleted file mode 100644 index 230ba8db..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/AutocompleteOperation.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.AutocompleteRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.AutocompleteResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class AutocompleteOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public AutocompleteOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(AutocompleteRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/autocomplete"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "autocomplete", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "autocomplete", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "autocomplete", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "autocomplete", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public AutocompleteResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - AutocompleteResponse.Builder resBuilder = - AutocompleteResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - AutocompleteResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - com.glean.api_client.glean_api_client.models.components.AutocompleteResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withAutocompleteResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Chat.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Chat.java new file mode 100644 index 00000000..422890a3 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Chat.java @@ -0,0 +1,198 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.ChatRequest; +import com.glean.api_client.glean_api_client.models.operations.ChatResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Chat { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(ChatRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/chat"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "chatRequest", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + ChatRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "chat", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "chat", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "chat", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(ChatRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "408", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public ChatResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + ChatResponse.Builder resBuilder = + ChatResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + ChatResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + com.glean.api_client.glean_api_client.models.components.ChatResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withChatResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "408", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/ChatOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/ChatOperation.java deleted file mode 100644 index 34841168..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/ChatOperation.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.ChatRequest; -import com.glean.api_client.glean_api_client.models.operations.ChatResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class ChatOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public ChatOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(ChatRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/chat"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "chatRequest", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - ChatRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "chat", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "408", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "chat", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "chat", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "chat", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public ChatResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - ChatResponse.Builder resBuilder = - ChatResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - ChatResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - com.glean.api_client.glean_api_client.models.components.ChatResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withChatResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "408", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/ChatStream.java b/src/main/java/com/glean/api_client/glean_api_client/operations/ChatStream.java new file mode 100644 index 00000000..93d59bcc --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/ChatStream.java @@ -0,0 +1,195 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.ChatStreamRequest; +import com.glean.api_client.glean_api_client.models.operations.ChatStreamResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class ChatStream { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(ChatStreamRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/chat#stream"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "chatRequest", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "text/plain") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + ChatStreamRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "chatStream", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "chatStream", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "chatStream", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(ChatStreamRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "408", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public ChatStreamResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + ChatStreamResponse.Builder resBuilder = + ChatStreamResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + ChatStreamResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "text/plain")) { + String out = Utils.toUtf8AndClose(response.body()); + res.withChatRequestStream(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "408", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/ChatStreamOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/ChatStreamOperation.java deleted file mode 100644 index f21ff1af..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/ChatStreamOperation.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.ChatStreamRequest; -import com.glean.api_client.glean_api_client.models.operations.ChatStreamResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class ChatStreamOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public ChatStreamOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(ChatStreamRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/chat#stream"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "chatRequest", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "text/plain") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - ChatStreamRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "chatStream", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "408", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "chatStream", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "chatStream", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "chatStream", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public ChatStreamResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - ChatStreamResponse.Builder resBuilder = - ChatStreamResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - ChatStreamResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "text/plain")) { - String out = Utils.toUtf8AndClose(response.body()); - res.withChatRequestStream(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "408", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/CreateAndStreamRun.java b/src/main/java/com/glean/api_client/glean_api_client/operations/CreateAndStreamRun.java new file mode 100644 index 00000000..24966236 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/CreateAndStreamRun.java @@ -0,0 +1,190 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.AgentRunCreate; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.CreateAndStreamRunResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class CreateAndStreamRun { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(AgentRunCreate request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/agents/runs/stream"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "text/event-stream") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createAndStreamRun", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createAndStreamRun", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createAndStreamRun", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(AgentRunCreate request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "403", "404", "409", "422", "4XX", "500", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public CreateAndStreamRunResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreateAndStreamRunResponse.Builder resBuilder = + CreateAndStreamRunResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + CreateAndStreamRunResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "text/event-stream")) { + String out = Utils.toUtf8AndClose(response.body()); + res.withRes(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404", "409", "422", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/CreateAndStreamRunOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/CreateAndStreamRunOperation.java deleted file mode 100644 index 3e0d81d9..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/CreateAndStreamRunOperation.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.AgentRunCreate; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.CreateAndStreamRunResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class CreateAndStreamRunOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public CreateAndStreamRunOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(AgentRunCreate request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/agents/runs/stream"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "text/event-stream") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "createAndStreamRun", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "403", "404", "409", "422", "4XX", "500", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createAndStreamRun", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "createAndStreamRun", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createAndStreamRun", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public CreateAndStreamRunResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - CreateAndStreamRunResponse.Builder resBuilder = - CreateAndStreamRunResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - CreateAndStreamRunResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "text/event-stream")) { - String out = Utils.toUtf8AndClose(response.body()); - res.withRes(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404", "409", "422", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/CreateAndWaitRun.java b/src/main/java/com/glean/api_client/glean_api_client/operations/CreateAndWaitRun.java new file mode 100644 index 00000000..2803b31d --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/CreateAndWaitRun.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.AgentRunCreate; +import com.glean.api_client.glean_api_client.models.components.AgentRunWaitResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.CreateAndWaitRunResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class CreateAndWaitRun { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(AgentRunCreate request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/agents/runs/wait"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createAndWaitRun", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createAndWaitRun", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createAndWaitRun", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(AgentRunCreate request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "403", "404", "409", "422", "4XX", "500", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public CreateAndWaitRunResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreateAndWaitRunResponse.Builder resBuilder = + CreateAndWaitRunResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + CreateAndWaitRunResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + AgentRunWaitResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withAgentRunWaitResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404", "409", "422", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/CreateAndWaitRunOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/CreateAndWaitRunOperation.java deleted file mode 100644 index 5ed4fd25..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/CreateAndWaitRunOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.AgentRunCreate; -import com.glean.api_client.glean_api_client.models.components.AgentRunWaitResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.CreateAndWaitRunResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class CreateAndWaitRunOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public CreateAndWaitRunOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(AgentRunCreate request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/agents/runs/wait"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "createAndWaitRun", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "403", "404", "409", "422", "4XX", "500", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createAndWaitRun", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "createAndWaitRun", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createAndWaitRun", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public CreateAndWaitRunResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - CreateAndWaitRunResponse.Builder resBuilder = - CreateAndWaitRunResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - CreateAndWaitRunResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - AgentRunWaitResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withAgentRunWaitResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404", "409", "422", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Createannouncement.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Createannouncement.java new file mode 100644 index 00000000..dfd221b5 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Createannouncement.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.Announcement; +import com.glean.api_client.glean_api_client.models.components.CreateAnnouncementRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.CreateannouncementResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Createannouncement { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(CreateAnnouncementRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/createannouncement"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createannouncement", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createannouncement", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createannouncement", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(CreateAnnouncementRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public CreateannouncementResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreateannouncementResponse.Builder resBuilder = + CreateannouncementResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + CreateannouncementResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + Announcement out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withAnnouncement(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/CreateannouncementOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/CreateannouncementOperation.java deleted file mode 100644 index 75425659..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/CreateannouncementOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.Announcement; -import com.glean.api_client.glean_api_client.models.components.CreateAnnouncementRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.CreateannouncementResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class CreateannouncementOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public CreateannouncementOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(CreateAnnouncementRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/createannouncement"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "createannouncement", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createannouncement", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "createannouncement", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createannouncement", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public CreateannouncementResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - CreateannouncementResponse.Builder resBuilder = - CreateannouncementResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - CreateannouncementResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - Announcement out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withAnnouncement(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Createanswer.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Createanswer.java new file mode 100644 index 00000000..391dea98 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Createanswer.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.Answer; +import com.glean.api_client.glean_api_client.models.components.CreateAnswerRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.CreateanswerResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Createanswer { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(CreateAnswerRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/createanswer"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createanswer", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createanswer", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createanswer", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(CreateAnswerRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public CreateanswerResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreateanswerResponse.Builder resBuilder = + CreateanswerResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + CreateanswerResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + Answer out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withAnswer(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/CreateanswerOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/CreateanswerOperation.java deleted file mode 100644 index d5c42a9a..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/CreateanswerOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.Answer; -import com.glean.api_client.glean_api_client.models.components.CreateAnswerRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.CreateanswerResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class CreateanswerOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public CreateanswerOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(CreateAnswerRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/createanswer"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "createanswer", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createanswer", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "createanswer", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createanswer", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public CreateanswerResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - CreateanswerResponse.Builder resBuilder = - CreateanswerResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - CreateanswerResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - Answer out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withAnswer(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Createauthtoken.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Createauthtoken.java new file mode 100644 index 00000000..4d852f22 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Createauthtoken.java @@ -0,0 +1,176 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestlessOperation; + +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.CreateAuthTokenResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.CreateauthtokenResponse; +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.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.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Createauthtoken { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest() throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/createauthtoken"); + HTTPRequest req = new HTTPRequest(url, "POST"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createauthtoken", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestlessOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createauthtoken", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createauthtoken", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest() throws Exception { + HttpRequest r = buildRequest(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public CreateauthtokenResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreateauthtokenResponse.Builder resBuilder = + CreateauthtokenResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + CreateauthtokenResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + CreateAuthTokenResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withCreateAuthTokenResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/CreateauthtokenOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/CreateauthtokenOperation.java deleted file mode 100644 index c80a1a36..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/CreateauthtokenOperation.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestlessOperation; - -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.CreateAuthTokenResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.CreateauthtokenResponse; -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.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.Utils; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class CreateauthtokenOperation implements RequestlessOperation { - - private final SDKConfiguration sdkConfiguration; - - public CreateauthtokenOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest() throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/createauthtoken"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "createauthtoken", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createauthtoken", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "createauthtoken", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createauthtoken", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public CreateauthtokenResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - CreateauthtokenResponse.Builder resBuilder = - CreateauthtokenResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - CreateauthtokenResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - CreateAuthTokenResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withCreateAuthTokenResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Createcollection.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Createcollection.java new file mode 100644 index 00000000..a6f5c068 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Createcollection.java @@ -0,0 +1,211 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.CreateCollectionRequest; +import com.glean.api_client.glean_api_client.models.components.CreateCollectionResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.errors.CollectionError; +import com.glean.api_client.glean_api_client.models.operations.CreatecollectionResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Createcollection { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(CreateCollectionRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/createcollection"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createcollection", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createcollection", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createcollection", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(CreateCollectionRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "422", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public CreatecollectionResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreatecollectionResponse.Builder resBuilder = + CreatecollectionResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + CreatecollectionResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + CreateCollectionResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withCreateCollectionResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "422")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + CollectionError out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + throw out; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/CreatecollectionOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/CreatecollectionOperation.java deleted file mode 100644 index a9668477..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/CreatecollectionOperation.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.CreateCollectionRequest; -import com.glean.api_client.glean_api_client.models.components.CreateCollectionResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.errors.CollectionError; -import com.glean.api_client.glean_api_client.models.operations.CreatecollectionResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class CreatecollectionOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public CreatecollectionOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(CreateCollectionRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/createcollection"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "createcollection", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "422", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createcollection", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "createcollection", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createcollection", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public CreatecollectionResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - CreatecollectionResponse.Builder resBuilder = - CreatecollectionResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - CreatecollectionResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - CreateCollectionResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withCreateCollectionResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "422")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - CollectionError out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Createpolicy.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Createpolicy.java new file mode 100644 index 00000000..4167b468 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Createpolicy.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.CreateDlpReportRequest; +import com.glean.api_client.glean_api_client.models.components.CreateDlpReportResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.CreatepolicyResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Createpolicy { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(CreateDlpReportRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/governance/data/policies"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json; charset=UTF-8") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createpolicy", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createpolicy", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createpolicy", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(CreateDlpReportRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public CreatepolicyResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreatepolicyResponse.Builder resBuilder = + CreatepolicyResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + CreatepolicyResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { + CreateDlpReportResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withCreateDlpReportResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/CreatepolicyOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/CreatepolicyOperation.java deleted file mode 100644 index dddb43c4..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/CreatepolicyOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.CreateDlpReportRequest; -import com.glean.api_client.glean_api_client.models.components.CreateDlpReportResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.CreatepolicyResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class CreatepolicyOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public CreatepolicyOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(CreateDlpReportRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/governance/data/policies"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json; charset=UTF-8") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "createpolicy", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createpolicy", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "createpolicy", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createpolicy", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public CreatepolicyResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - CreatepolicyResponse.Builder resBuilder = - CreatepolicyResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - CreatepolicyResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { - CreateDlpReportResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withCreateDlpReportResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Createreport.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Createreport.java new file mode 100644 index 00000000..18869aed --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Createreport.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.UpdateDlpConfigRequest; +import com.glean.api_client.glean_api_client.models.components.UpdateDlpConfigResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.CreatereportResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Createreport { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(UpdateDlpConfigRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/governance/data/reports"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json; charset=UTF-8") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createreport", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createreport", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createreport", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(UpdateDlpConfigRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public CreatereportResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreatereportResponse.Builder resBuilder = + CreatereportResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + CreatereportResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { + UpdateDlpConfigResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withUpdateDlpConfigResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/CreatereportOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/CreatereportOperation.java deleted file mode 100644 index 2cebc138..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/CreatereportOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.UpdateDlpConfigRequest; -import com.glean.api_client.glean_api_client.models.components.UpdateDlpConfigResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.CreatereportResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class CreatereportOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public CreatereportOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(UpdateDlpConfigRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/governance/data/reports"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json; charset=UTF-8") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "createreport", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createreport", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "createreport", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createreport", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public CreatereportResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - CreatereportResponse.Builder resBuilder = - CreatereportResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - CreatereportResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { - UpdateDlpConfigResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withUpdateDlpConfigResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Createshortcut.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Createshortcut.java new file mode 100644 index 00000000..da1f632f --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Createshortcut.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.CreateShortcutRequest; +import com.glean.api_client.glean_api_client.models.components.CreateShortcutResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.CreateshortcutResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Createshortcut { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(CreateShortcutRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/createshortcut"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createshortcut", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createshortcut", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createshortcut", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(CreateShortcutRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public CreateshortcutResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreateshortcutResponse.Builder resBuilder = + CreateshortcutResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + CreateshortcutResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + CreateShortcutResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withCreateShortcutResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/CreateshortcutOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/CreateshortcutOperation.java deleted file mode 100644 index b9e367db..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/CreateshortcutOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.CreateShortcutRequest; -import com.glean.api_client.glean_api_client.models.components.CreateShortcutResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.CreateshortcutResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class CreateshortcutOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public CreateshortcutOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(CreateShortcutRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/createshortcut"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "createshortcut", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createshortcut", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "createshortcut", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "createshortcut", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public CreateshortcutResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - CreateshortcutResponse.Builder resBuilder = - CreateshortcutResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - CreateshortcutResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - CreateShortcutResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withCreateShortcutResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Deleteallchats.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Deleteallchats.java new file mode 100644 index 00000000..c78704cb --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Deleteallchats.java @@ -0,0 +1,168 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.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.SecuritySource; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.DeleteallchatsRequest; +import com.glean.api_client.glean_api_client.models.operations.DeleteallchatsResponse; +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.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.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Deleteallchats { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(DeleteallchatsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/deleteallchats"); + HTTPRequest req = new HTTPRequest(url, "POST"); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + DeleteallchatsRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteallchats", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteallchats", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteallchats", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(DeleteallchatsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public DeleteallchatsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + DeleteallchatsResponse.Builder resBuilder = + DeleteallchatsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + DeleteallchatsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/DeleteallchatsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/DeleteallchatsOperation.java deleted file mode 100644 index 3e79932a..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/DeleteallchatsOperation.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.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.SecuritySource; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.DeleteallchatsRequest; -import com.glean.api_client.glean_api_client.models.operations.DeleteallchatsResponse; -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.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.Utils; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class DeleteallchatsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public DeleteallchatsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(DeleteallchatsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/deleteallchats"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - DeleteallchatsRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "deleteallchats", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "deleteallchats", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "deleteallchats", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "deleteallchats", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public DeleteallchatsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - DeleteallchatsResponse.Builder resBuilder = - DeleteallchatsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - DeleteallchatsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Deleteannouncement.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Deleteannouncement.java new file mode 100644 index 00000000..3e022bf8 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Deleteannouncement.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.DeleteAnnouncementRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.DeleteannouncementResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Deleteannouncement { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(DeleteAnnouncementRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/deleteannouncement"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteannouncement", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteannouncement", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteannouncement", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(DeleteAnnouncementRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public DeleteannouncementResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + DeleteannouncementResponse.Builder resBuilder = + DeleteannouncementResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + DeleteannouncementResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/DeleteannouncementOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/DeleteannouncementOperation.java deleted file mode 100644 index 77837054..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/DeleteannouncementOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.DeleteAnnouncementRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.DeleteannouncementResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class DeleteannouncementOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public DeleteannouncementOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(DeleteAnnouncementRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/deleteannouncement"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "deleteannouncement", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "deleteannouncement", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "deleteannouncement", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "deleteannouncement", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public DeleteannouncementResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - DeleteannouncementResponse.Builder resBuilder = - DeleteannouncementResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - DeleteannouncementResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Deleteanswer.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Deleteanswer.java new file mode 100644 index 00000000..0da598f6 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Deleteanswer.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.DeleteAnswerRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.DeleteanswerResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Deleteanswer { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(DeleteAnswerRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/deleteanswer"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteanswer", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteanswer", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteanswer", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(DeleteAnswerRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public DeleteanswerResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + DeleteanswerResponse.Builder resBuilder = + DeleteanswerResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + DeleteanswerResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/DeleteanswerOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/DeleteanswerOperation.java deleted file mode 100644 index 70764610..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/DeleteanswerOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.DeleteAnswerRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.DeleteanswerResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class DeleteanswerOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public DeleteanswerOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(DeleteAnswerRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/deleteanswer"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "deleteanswer", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "deleteanswer", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "deleteanswer", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "deleteanswer", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public DeleteanswerResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - DeleteanswerResponse.Builder resBuilder = - DeleteanswerResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - DeleteanswerResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Deletechatfiles.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Deletechatfiles.java new file mode 100644 index 00000000..202e7657 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Deletechatfiles.java @@ -0,0 +1,186 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.DeletechatfilesRequest; +import com.glean.api_client.glean_api_client.models.operations.DeletechatfilesResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Deletechatfiles { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(DeletechatfilesRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/deletechatfiles"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "deleteChatFilesRequest", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + DeletechatfilesRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deletechatfiles", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deletechatfiles", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deletechatfiles", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(DeletechatfilesRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public DeletechatfilesResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + DeletechatfilesResponse.Builder resBuilder = + DeletechatfilesResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + DeletechatfilesResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/DeletechatfilesOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/DeletechatfilesOperation.java deleted file mode 100644 index e8d3ea28..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/DeletechatfilesOperation.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.DeletechatfilesRequest; -import com.glean.api_client.glean_api_client.models.operations.DeletechatfilesResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class DeletechatfilesOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public DeletechatfilesOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(DeletechatfilesRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/deletechatfiles"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "deleteChatFilesRequest", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - DeletechatfilesRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "deletechatfiles", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "deletechatfiles", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "deletechatfiles", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "deletechatfiles", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public DeletechatfilesResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - DeletechatfilesResponse.Builder resBuilder = - DeletechatfilesResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - DeletechatfilesResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Deletechats.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Deletechats.java new file mode 100644 index 00000000..9dd6b266 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Deletechats.java @@ -0,0 +1,186 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.DeletechatsRequest; +import com.glean.api_client.glean_api_client.models.operations.DeletechatsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Deletechats { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(DeletechatsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/deletechats"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "deleteChatsRequest", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + DeletechatsRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deletechats", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deletechats", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deletechats", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(DeletechatsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public DeletechatsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + DeletechatsResponse.Builder resBuilder = + DeletechatsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + DeletechatsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/DeletechatsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/DeletechatsOperation.java deleted file mode 100644 index 397f3518..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/DeletechatsOperation.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.DeletechatsRequest; -import com.glean.api_client.glean_api_client.models.operations.DeletechatsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class DeletechatsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public DeletechatsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(DeletechatsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/deletechats"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "deleteChatsRequest", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - DeletechatsRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "deletechats", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "deletechats", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "deletechats", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "deletechats", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public DeletechatsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - DeletechatsResponse.Builder resBuilder = - DeletechatsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - DeletechatsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Deletecollection.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Deletecollection.java new file mode 100644 index 00000000..63168fea --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Deletecollection.java @@ -0,0 +1,198 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.DeleteCollectionRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.errors.CollectionError; +import com.glean.api_client.glean_api_client.models.operations.DeletecollectionResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Deletecollection { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(DeleteCollectionRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/deletecollection"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deletecollection", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deletecollection", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deletecollection", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(DeleteCollectionRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "422", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public DeletecollectionResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + DeletecollectionResponse.Builder resBuilder = + DeletecollectionResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + DeletecollectionResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "422")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + CollectionError out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + throw out; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/DeletecollectionOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/DeletecollectionOperation.java deleted file mode 100644 index 871cac9c..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/DeletecollectionOperation.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.DeleteCollectionRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.errors.CollectionError; -import com.glean.api_client.glean_api_client.models.operations.DeletecollectionResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class DeletecollectionOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public DeletecollectionOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(DeleteCollectionRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/deletecollection"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "deletecollection", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "422", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "deletecollection", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "deletecollection", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "deletecollection", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public DeletecollectionResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - DeletecollectionResponse.Builder resBuilder = - DeletecollectionResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - DeletecollectionResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "422")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - CollectionError out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Deletecollectionitem.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Deletecollectionitem.java new file mode 100644 index 00000000..83c59804 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Deletecollectionitem.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.DeleteCollectionItemRequest; +import com.glean.api_client.glean_api_client.models.components.DeleteCollectionItemResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.DeletecollectionitemResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Deletecollectionitem { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(DeleteCollectionItemRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/deletecollectionitem"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deletecollectionitem", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deletecollectionitem", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deletecollectionitem", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(DeleteCollectionItemRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "422", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public DeletecollectionitemResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + DeletecollectionitemResponse.Builder resBuilder = + DeletecollectionitemResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + DeletecollectionitemResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + DeleteCollectionItemResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withDeleteCollectionItemResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "422", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/DeletecollectionitemOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/DeletecollectionitemOperation.java deleted file mode 100644 index 63e417ff..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/DeletecollectionitemOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.DeleteCollectionItemRequest; -import com.glean.api_client.glean_api_client.models.components.DeleteCollectionItemResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.DeletecollectionitemResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class DeletecollectionitemOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public DeletecollectionitemOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(DeleteCollectionItemRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/deletecollectionitem"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "deletecollectionitem", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "422", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "deletecollectionitem", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "deletecollectionitem", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "deletecollectionitem", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public DeletecollectionitemResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - DeletecollectionitemResponse.Builder resBuilder = - DeletecollectionitemResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - DeletecollectionitemResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - DeleteCollectionItemResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withDeleteCollectionItemResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "422", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Deleteshortcut.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Deleteshortcut.java new file mode 100644 index 00000000..d46b5aff --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Deleteshortcut.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.DeleteShortcutRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.DeleteshortcutResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Deleteshortcut { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(DeleteShortcutRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/deleteshortcut"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteshortcut", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteshortcut", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteshortcut", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(DeleteShortcutRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public DeleteshortcutResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + DeleteshortcutResponse.Builder resBuilder = + DeleteshortcutResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + DeleteshortcutResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/DeleteshortcutOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/DeleteshortcutOperation.java deleted file mode 100644 index 475b993f..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/DeleteshortcutOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.DeleteShortcutRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.DeleteshortcutResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class DeleteshortcutOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public DeleteshortcutOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(DeleteShortcutRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/deleteshortcut"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "deleteshortcut", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "deleteshortcut", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "deleteshortcut", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "deleteshortcut", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public DeleteshortcutResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - DeleteshortcutResponse.Builder resBuilder = - DeleteshortcutResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - DeleteshortcutResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Downloadpolicycsv.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Downloadpolicycsv.java new file mode 100644 index 00000000..b7663753 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Downloadpolicycsv.java @@ -0,0 +1,174 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.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.SecuritySource; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.DownloadpolicycsvRequest; +import com.glean.api_client.glean_api_client.models.operations.DownloadpolicycsvResponse; +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.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.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Downloadpolicycsv { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(DownloadpolicycsvRequest request) throws Exception { + String url = Utils.generateURL( + DownloadpolicycsvRequest.class, + this.baseUrl, + "/rest/api/v1/governance/data/policies/{id}/download", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "text/csv; charset=UTF-8") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "downloadpolicycsv", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "downloadpolicycsv", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "downloadpolicycsv", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(DownloadpolicycsvRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public DownloadpolicycsvResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + DownloadpolicycsvResponse.Builder resBuilder = + DownloadpolicycsvResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + DownloadpolicycsvResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "text/csv; charset=UTF-8")) { + String out = Utils.toUtf8AndClose(response.body()); + res.withRes(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/DownloadpolicycsvOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/DownloadpolicycsvOperation.java deleted file mode 100644 index fab40cf8..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/DownloadpolicycsvOperation.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.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.SecuritySource; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.DownloadpolicycsvRequest; -import com.glean.api_client.glean_api_client.models.operations.DownloadpolicycsvResponse; -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.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.Utils; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class DownloadpolicycsvOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public DownloadpolicycsvOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(DownloadpolicycsvRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - DownloadpolicycsvRequest.class, - baseUrl, - "/rest/api/v1/governance/data/policies/{id}/download", - request, null); - - HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "text/csv; charset=UTF-8") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "downloadpolicycsv", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "downloadpolicycsv", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "downloadpolicycsv", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "downloadpolicycsv", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public DownloadpolicycsvResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - DownloadpolicycsvResponse.Builder resBuilder = - DownloadpolicycsvResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - DownloadpolicycsvResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "text/csv; charset=UTF-8")) { - String out = Utils.toUtf8AndClose(response.body()); - res.withRes(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Downloadreportcsv.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Downloadreportcsv.java new file mode 100644 index 00000000..93a79814 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Downloadreportcsv.java @@ -0,0 +1,174 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.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.SecuritySource; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.DownloadreportcsvRequest; +import com.glean.api_client.glean_api_client.models.operations.DownloadreportcsvResponse; +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.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.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Downloadreportcsv { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(DownloadreportcsvRequest request) throws Exception { + String url = Utils.generateURL( + DownloadreportcsvRequest.class, + this.baseUrl, + "/rest/api/v1/governance/data/reports/{id}/download", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "text/csv; charset=UTF-8") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "downloadreportcsv", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "downloadreportcsv", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "downloadreportcsv", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(DownloadreportcsvRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public DownloadreportcsvResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + DownloadreportcsvResponse.Builder resBuilder = + DownloadreportcsvResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + DownloadreportcsvResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "text/csv; charset=UTF-8")) { + String out = Utils.toUtf8AndClose(response.body()); + res.withRes(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/DownloadreportcsvOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/DownloadreportcsvOperation.java deleted file mode 100644 index 724d7eb7..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/DownloadreportcsvOperation.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.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.SecuritySource; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.DownloadreportcsvRequest; -import com.glean.api_client.glean_api_client.models.operations.DownloadreportcsvResponse; -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.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.Utils; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class DownloadreportcsvOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public DownloadreportcsvOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(DownloadreportcsvRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - DownloadreportcsvRequest.class, - baseUrl, - "/rest/api/v1/governance/data/reports/{id}/download", - request, null); - - HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "text/csv; charset=UTF-8") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "downloadreportcsv", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "downloadreportcsv", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "downloadreportcsv", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "downloadreportcsv", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public DownloadreportcsvResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - DownloadreportcsvResponse.Builder resBuilder = - DownloadreportcsvResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - DownloadreportcsvResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "text/csv; charset=UTF-8")) { - String out = Utils.toUtf8AndClose(response.body()); - res.withRes(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Editanswer.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Editanswer.java new file mode 100644 index 00000000..8810b4dd --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Editanswer.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.Answer; +import com.glean.api_client.glean_api_client.models.components.EditAnswerRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.EditanswerResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Editanswer { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(EditAnswerRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/editanswer"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "editanswer", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "editanswer", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "editanswer", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(EditAnswerRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public EditanswerResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + EditanswerResponse.Builder resBuilder = + EditanswerResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + EditanswerResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + Answer out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withAnswer(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/EditanswerOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/EditanswerOperation.java deleted file mode 100644 index 01540234..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/EditanswerOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.Answer; -import com.glean.api_client.glean_api_client.models.components.EditAnswerRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.EditanswerResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class EditanswerOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public EditanswerOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(EditAnswerRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/editanswer"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "editanswer", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "editanswer", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "editanswer", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "editanswer", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public EditanswerResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - EditanswerResponse.Builder resBuilder = - EditanswerResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - EditanswerResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - Answer out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withAnswer(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Editcollection.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Editcollection.java new file mode 100644 index 00000000..08bb75e6 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Editcollection.java @@ -0,0 +1,211 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.EditCollectionRequest; +import com.glean.api_client.glean_api_client.models.components.EditCollectionResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.errors.CollectionError; +import com.glean.api_client.glean_api_client.models.operations.EditcollectionResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Editcollection { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(EditCollectionRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/editcollection"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "editcollection", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "editcollection", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "editcollection", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(EditCollectionRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "422", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public EditcollectionResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + EditcollectionResponse.Builder resBuilder = + EditcollectionResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + EditcollectionResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + EditCollectionResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withEditCollectionResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "422")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + CollectionError out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + throw out; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/EditcollectionOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/EditcollectionOperation.java deleted file mode 100644 index a5f99fc4..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/EditcollectionOperation.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.EditCollectionRequest; -import com.glean.api_client.glean_api_client.models.components.EditCollectionResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.errors.CollectionError; -import com.glean.api_client.glean_api_client.models.operations.EditcollectionResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class EditcollectionOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public EditcollectionOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(EditCollectionRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/editcollection"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "editcollection", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "422", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "editcollection", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "editcollection", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "editcollection", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public EditcollectionResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - EditcollectionResponse.Builder resBuilder = - EditcollectionResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - EditcollectionResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - EditCollectionResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withEditCollectionResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "422")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - CollectionError out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Editcollectionitem.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Editcollectionitem.java new file mode 100644 index 00000000..7455ac45 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Editcollectionitem.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.EditCollectionItemRequest; +import com.glean.api_client.glean_api_client.models.components.EditCollectionItemResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.EditcollectionitemResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Editcollectionitem { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(EditCollectionItemRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/editcollectionitem"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "editcollectionitem", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "editcollectionitem", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "editcollectionitem", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(EditCollectionItemRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public EditcollectionitemResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + EditcollectionitemResponse.Builder resBuilder = + EditcollectionitemResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + EditcollectionitemResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + EditCollectionItemResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withEditCollectionItemResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/EditcollectionitemOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/EditcollectionitemOperation.java deleted file mode 100644 index d2c9f3c6..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/EditcollectionitemOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.EditCollectionItemRequest; -import com.glean.api_client.glean_api_client.models.components.EditCollectionItemResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.EditcollectionitemResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class EditcollectionitemOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public EditcollectionitemOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(EditCollectionItemRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/editcollectionitem"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "editcollectionitem", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "editcollectionitem", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "editcollectionitem", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "editcollectionitem", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public EditcollectionitemResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - EditcollectionitemResponse.Builder resBuilder = - EditcollectionitemResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - EditcollectionitemResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - EditCollectionItemResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withEditCollectionItemResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Editpin.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Editpin.java new file mode 100644 index 00000000..fa862b89 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Editpin.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.EditPinRequest; +import com.glean.api_client.glean_api_client.models.components.PinDocument; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.EditpinResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Editpin { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(EditPinRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/editpin"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "editpin", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "editpin", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "editpin", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(EditPinRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public EditpinResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + EditpinResponse.Builder resBuilder = + EditpinResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + EditpinResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + PinDocument out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withPinDocument(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/EditpinOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/EditpinOperation.java deleted file mode 100644 index ffd9c086..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/EditpinOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.EditPinRequest; -import com.glean.api_client.glean_api_client.models.components.PinDocument; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.EditpinResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class EditpinOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public EditpinOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(EditPinRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/editpin"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "editpin", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "editpin", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "editpin", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "editpin", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public EditpinResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - EditpinResponse.Builder resBuilder = - EditpinResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - EditpinResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - PinDocument out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withPinDocument(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Feed.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Feed.java new file mode 100644 index 00000000..88ea2b2b --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Feed.java @@ -0,0 +1,193 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.FeedRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.FeedResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Feed { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(FeedRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/feed"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "feed", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "feed", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "feed", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(FeedRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "408", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public FeedResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + FeedResponse.Builder resBuilder = + FeedResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + FeedResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + com.glean.api_client.glean_api_client.models.components.FeedResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withFeedResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "408", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/FeedOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/FeedOperation.java deleted file mode 100644 index 48dc7881..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/FeedOperation.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.FeedRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.FeedResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class FeedOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public FeedOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(FeedRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/feed"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "feed", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "408", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "feed", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "feed", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "feed", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public FeedResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - FeedResponse.Builder resBuilder = - FeedResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - FeedResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - com.glean.api_client.glean_api_client.models.components.FeedResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withFeedResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "408", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Feedback.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Feedback.java new file mode 100644 index 00000000..85ea2a59 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Feedback.java @@ -0,0 +1,183 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.FeedbackRequest; +import com.glean.api_client.glean_api_client.models.operations.FeedbackResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Feedback { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(FeedbackRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/feedback"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "feedback1", + "json", + false); + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + FeedbackRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "feedback", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "feedback", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "feedback", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(FeedbackRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public FeedbackResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + FeedbackResponse.Builder resBuilder = + FeedbackResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + FeedbackResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/FeedbackOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/FeedbackOperation.java deleted file mode 100644 index a1f20df1..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/FeedbackOperation.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.FeedbackRequest; -import com.glean.api_client.glean_api_client.models.operations.FeedbackResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class FeedbackOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public FeedbackOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(FeedbackRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/feedback"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "feedback1", - "json", - false); - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - FeedbackRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "feedback", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "feedback", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "feedback", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "feedback", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public FeedbackResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - FeedbackResponse.Builder resBuilder = - FeedbackResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - FeedbackResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetAgent.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetAgent.java new file mode 100644 index 00000000..508a96fb --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/GetAgent.java @@ -0,0 +1,184 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.Agent; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.GetAgentRequest; +import com.glean.api_client.glean_api_client.models.operations.GetAgentResponse; +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.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.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class GetAgent { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetAgentRequest request) throws Exception { + String url = Utils.generateURL( + GetAgentRequest.class, + this.baseUrl, + "/rest/api/v1/agents/{agent_id}", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + GetAgentRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getAgent", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getAgent", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getAgent", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetAgentRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "403", "404", "4XX", "500", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public GetAgentResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetAgentResponse.Builder resBuilder = + GetAgentResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetAgentResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + Agent out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withAgent(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetAgentOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetAgentOperation.java deleted file mode 100644 index 5908eb3d..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/GetAgentOperation.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.Agent; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.GetAgentRequest; -import com.glean.api_client.glean_api_client.models.operations.GetAgentResponse; -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.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.Utils; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class GetAgentOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public GetAgentOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetAgentRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - GetAgentRequest.class, - baseUrl, - "/rest/api/v1/agents/{agent_id}", - request, null); - - HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - GetAgentRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "getAgent", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "403", "404", "4XX", "500", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getAgent", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "getAgent", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getAgent", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public GetAgentResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetAgentResponse.Builder resBuilder = - GetAgentResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - GetAgentResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - Agent out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withAgent(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetAgentSchemas.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetAgentSchemas.java new file mode 100644 index 00000000..09df9735 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/GetAgentSchemas.java @@ -0,0 +1,184 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.AgentSchemas; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.GetAgentSchemasRequest; +import com.glean.api_client.glean_api_client.models.operations.GetAgentSchemasResponse; +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.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.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class GetAgentSchemas { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetAgentSchemasRequest request) throws Exception { + String url = Utils.generateURL( + GetAgentSchemasRequest.class, + this.baseUrl, + "/rest/api/v1/agents/{agent_id}/schemas", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + GetAgentSchemasRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getAgentSchemas", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getAgentSchemas", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getAgentSchemas", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetAgentSchemasRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "403", "404", "422", "4XX", "500", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public GetAgentSchemasResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetAgentSchemasResponse.Builder resBuilder = + GetAgentSchemasResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetAgentSchemasResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + AgentSchemas out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withAgentSchemas(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404", "422", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetAgentSchemasOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetAgentSchemasOperation.java deleted file mode 100644 index 2beab7d3..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/GetAgentSchemasOperation.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.AgentSchemas; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.GetAgentSchemasRequest; -import com.glean.api_client.glean_api_client.models.operations.GetAgentSchemasResponse; -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.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.Utils; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class GetAgentSchemasOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public GetAgentSchemasOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetAgentSchemasRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - GetAgentSchemasRequest.class, - baseUrl, - "/rest/api/v1/agents/{agent_id}/schemas", - request, null); - - HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - GetAgentSchemasRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "getAgentSchemas", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "403", "404", "422", "4XX", "500", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getAgentSchemas", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "getAgentSchemas", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getAgentSchemas", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public GetAgentSchemasResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetAgentSchemasResponse.Builder resBuilder = - GetAgentSchemasResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - GetAgentSchemasResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - AgentSchemas out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withAgentSchemas(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404", "422", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetRestApiV1ToolsList.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetRestApiV1ToolsList.java new file mode 100644 index 00000000..42e5e10a --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/GetRestApiV1ToolsList.java @@ -0,0 +1,182 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.ToolsListResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.GetRestApiV1ToolsListRequest; +import com.glean.api_client.glean_api_client.models.operations.GetRestApiV1ToolsListResponse; +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.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.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class GetRestApiV1ToolsList { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetRestApiV1ToolsListRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/tools/list"); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + GetRestApiV1ToolsListRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "get_/rest/api/v1/tools/list", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "get_/rest/api/v1/tools/list", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "get_/rest/api/v1/tools/list", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetRestApiV1ToolsListRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "404", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public GetRestApiV1ToolsListResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetRestApiV1ToolsListResponse.Builder resBuilder = + GetRestApiV1ToolsListResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetRestApiV1ToolsListResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + ToolsListResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withToolsListResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "404", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetRestApiV1ToolsListOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetRestApiV1ToolsListOperation.java deleted file mode 100644 index f75bf1b5..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/GetRestApiV1ToolsListOperation.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.ToolsListResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.GetRestApiV1ToolsListRequest; -import com.glean.api_client.glean_api_client.models.operations.GetRestApiV1ToolsListResponse; -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.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.Utils; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class GetRestApiV1ToolsListOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public GetRestApiV1ToolsListOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetRestApiV1ToolsListRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/tools/list"); - - HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - GetRestApiV1ToolsListRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "get_/rest/api/v1/tools/list", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "404", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "get_/rest/api/v1/tools/list", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "get_/rest/api/v1/tools/list", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "get_/rest/api/v1/tools/list", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public GetRestApiV1ToolsListResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetRestApiV1ToolsListResponse.Builder resBuilder = - GetRestApiV1ToolsListResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - GetRestApiV1ToolsListResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - ToolsListResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withToolsListResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "404", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Getanswer.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Getanswer.java new file mode 100644 index 00000000..8d3112a2 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Getanswer.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.GetAnswerRequest; +import com.glean.api_client.glean_api_client.models.components.GetAnswerResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.GetanswerResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Getanswer { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetAnswerRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/getanswer"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getanswer", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getanswer", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getanswer", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetAnswerRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public GetanswerResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetanswerResponse.Builder resBuilder = + GetanswerResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetanswerResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + GetAnswerResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withGetAnswerResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetanswerOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetanswerOperation.java deleted file mode 100644 index 03aadf31..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/GetanswerOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.GetAnswerRequest; -import com.glean.api_client.glean_api_client.models.components.GetAnswerResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.GetanswerResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class GetanswerOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public GetanswerOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetAnswerRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/getanswer"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "getanswer", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getanswer", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "getanswer", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getanswer", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public GetanswerResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetanswerResponse.Builder resBuilder = - GetanswerResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - GetanswerResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - GetAnswerResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetAnswerResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Getchat.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Getchat.java new file mode 100644 index 00000000..fd342fcc --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Getchat.java @@ -0,0 +1,199 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.GetChatResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.GetchatRequest; +import com.glean.api_client.glean_api_client.models.operations.GetchatResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Getchat { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetchatRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/getchat"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "getChatRequest", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + GetchatRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getchat", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getchat", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getchat", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetchatRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public GetchatResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetchatResponse.Builder resBuilder = + GetchatResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetchatResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + GetChatResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withGetChatResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetchatOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetchatOperation.java deleted file mode 100644 index 9e01431f..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/GetchatOperation.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.GetChatResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.GetchatRequest; -import com.glean.api_client.glean_api_client.models.operations.GetchatResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class GetchatOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public GetchatOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetchatRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/getchat"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "getChatRequest", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - GetchatRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "getchat", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getchat", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "getchat", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getchat", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public GetchatResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetchatResponse.Builder resBuilder = - GetchatResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - GetchatResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - GetChatResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetChatResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Getchatapplication.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Getchatapplication.java new file mode 100644 index 00000000..01a33de0 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Getchatapplication.java @@ -0,0 +1,199 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.GetChatApplicationResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.GetchatapplicationRequest; +import com.glean.api_client.glean_api_client.models.operations.GetchatapplicationResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Getchatapplication { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetchatapplicationRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/getchatapplication"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "getChatApplicationRequest", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + GetchatapplicationRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getchatapplication", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getchatapplication", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getchatapplication", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetchatapplicationRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public GetchatapplicationResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetchatapplicationResponse.Builder resBuilder = + GetchatapplicationResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetchatapplicationResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + GetChatApplicationResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withGetChatApplicationResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetchatapplicationOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetchatapplicationOperation.java deleted file mode 100644 index 289b5104..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/GetchatapplicationOperation.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.GetChatApplicationResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.GetchatapplicationRequest; -import com.glean.api_client.glean_api_client.models.operations.GetchatapplicationResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class GetchatapplicationOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public GetchatapplicationOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetchatapplicationRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/getchatapplication"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "getChatApplicationRequest", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - GetchatapplicationRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "getchatapplication", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getchatapplication", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "getchatapplication", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getchatapplication", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public GetchatapplicationResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetchatapplicationResponse.Builder resBuilder = - GetchatapplicationResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - GetchatapplicationResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - GetChatApplicationResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetChatApplicationResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Getchatfiles.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Getchatfiles.java new file mode 100644 index 00000000..a22f6f85 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Getchatfiles.java @@ -0,0 +1,199 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.GetChatFilesResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.GetchatfilesRequest; +import com.glean.api_client.glean_api_client.models.operations.GetchatfilesResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Getchatfiles { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetchatfilesRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/getchatfiles"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "getChatFilesRequest", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + GetchatfilesRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getchatfiles", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getchatfiles", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getchatfiles", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetchatfilesRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public GetchatfilesResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetchatfilesResponse.Builder resBuilder = + GetchatfilesResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetchatfilesResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + GetChatFilesResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withGetChatFilesResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetchatfilesOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetchatfilesOperation.java deleted file mode 100644 index 98698fd0..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/GetchatfilesOperation.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.GetChatFilesResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.GetchatfilesRequest; -import com.glean.api_client.glean_api_client.models.operations.GetchatfilesResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class GetchatfilesOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public GetchatfilesOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetchatfilesRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/getchatfiles"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "getChatFilesRequest", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - GetchatfilesRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "getchatfiles", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getchatfiles", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "getchatfiles", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getchatfiles", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public GetchatfilesResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetchatfilesResponse.Builder resBuilder = - GetchatfilesResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - GetchatfilesResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - GetChatFilesResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetChatFilesResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Getcollection.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Getcollection.java new file mode 100644 index 00000000..32e0d14d --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Getcollection.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.GetCollectionRequest; +import com.glean.api_client.glean_api_client.models.components.GetCollectionResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.GetcollectionResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Getcollection { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetCollectionRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/getcollection"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getcollection", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getcollection", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getcollection", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetCollectionRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public GetcollectionResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetcollectionResponse.Builder resBuilder = + GetcollectionResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetcollectionResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + GetCollectionResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withGetCollectionResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetcollectionOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetcollectionOperation.java deleted file mode 100644 index 1279146e..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/GetcollectionOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.GetCollectionRequest; -import com.glean.api_client.glean_api_client.models.components.GetCollectionResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.GetcollectionResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class GetcollectionOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public GetcollectionOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetCollectionRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/getcollection"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "getcollection", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getcollection", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "getcollection", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getcollection", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public GetcollectionResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetcollectionResponse.Builder resBuilder = - GetcollectionResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - GetcollectionResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - GetCollectionResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetCollectionResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Getdocpermissions.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Getdocpermissions.java new file mode 100644 index 00000000..5a48f8a7 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Getdocpermissions.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.GetDocPermissionsRequest; +import com.glean.api_client.glean_api_client.models.components.GetDocPermissionsResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.GetdocpermissionsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Getdocpermissions { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetDocPermissionsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/getdocpermissions"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getdocpermissions", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getdocpermissions", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getdocpermissions", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetDocPermissionsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public GetdocpermissionsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetdocpermissionsResponse.Builder resBuilder = + GetdocpermissionsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetdocpermissionsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + GetDocPermissionsResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withGetDocPermissionsResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetdocpermissionsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetdocpermissionsOperation.java deleted file mode 100644 index 73143d6a..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/GetdocpermissionsOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.GetDocPermissionsRequest; -import com.glean.api_client.glean_api_client.models.components.GetDocPermissionsResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.GetdocpermissionsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class GetdocpermissionsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public GetdocpermissionsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetDocPermissionsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/getdocpermissions"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "getdocpermissions", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getdocpermissions", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "getdocpermissions", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getdocpermissions", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public GetdocpermissionsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetdocpermissionsResponse.Builder resBuilder = - GetdocpermissionsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - GetdocpermissionsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - GetDocPermissionsResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetDocPermissionsResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Getdocuments.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Getdocuments.java new file mode 100644 index 00000000..3791250b --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Getdocuments.java @@ -0,0 +1,191 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.GetDocumentsRequest; +import com.glean.api_client.glean_api_client.models.components.GetDocumentsResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.GetdocumentsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Getdocuments { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(Optional request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/getdocuments"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference>() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getdocuments", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation, GetdocumentsResponse> { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getdocuments", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getdocuments", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(Optional request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public GetdocumentsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetdocumentsResponse.Builder resBuilder = + GetdocumentsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetdocumentsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + GetDocumentsResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withGetDocumentsResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetdocumentsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetdocumentsOperation.java deleted file mode 100644 index 3178245b..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/GetdocumentsOperation.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.GetDocumentsRequest; -import com.glean.api_client.glean_api_client.models.components.GetDocumentsResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.GetdocumentsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class GetdocumentsOperation implements RequestOperation, GetdocumentsResponse> { - - private final SDKConfiguration sdkConfiguration; - - public GetdocumentsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(Optional request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/getdocuments"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference>() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "getdocuments", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getdocuments", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "getdocuments", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getdocuments", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public GetdocumentsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetdocumentsResponse.Builder resBuilder = - GetdocumentsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - GetdocumentsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - GetDocumentsResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetDocumentsResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Getdocumentsbyfacets.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Getdocumentsbyfacets.java new file mode 100644 index 00000000..4ca0de85 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Getdocumentsbyfacets.java @@ -0,0 +1,191 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.GetDocumentsByFacetsRequest; +import com.glean.api_client.glean_api_client.models.components.GetDocumentsByFacetsResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.GetdocumentsbyfacetsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Getdocumentsbyfacets { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(Optional request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/getdocumentsbyfacets"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference>() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getdocumentsbyfacets", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation, GetdocumentsbyfacetsResponse> { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getdocumentsbyfacets", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getdocumentsbyfacets", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(Optional request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "404", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public GetdocumentsbyfacetsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetdocumentsbyfacetsResponse.Builder resBuilder = + GetdocumentsbyfacetsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetdocumentsbyfacetsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + GetDocumentsByFacetsResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withGetDocumentsByFacetsResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "404", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetdocumentsbyfacetsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetdocumentsbyfacetsOperation.java deleted file mode 100644 index 55cfbcd9..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/GetdocumentsbyfacetsOperation.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.GetDocumentsByFacetsRequest; -import com.glean.api_client.glean_api_client.models.components.GetDocumentsByFacetsResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.GetdocumentsbyfacetsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class GetdocumentsbyfacetsOperation implements RequestOperation, GetdocumentsbyfacetsResponse> { - - private final SDKConfiguration sdkConfiguration; - - public GetdocumentsbyfacetsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(Optional request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/getdocumentsbyfacets"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference>() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "getdocumentsbyfacets", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "404", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getdocumentsbyfacets", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "getdocumentsbyfacets", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getdocumentsbyfacets", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public GetdocumentsbyfacetsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetdocumentsbyfacetsResponse.Builder resBuilder = - GetdocumentsbyfacetsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - GetdocumentsbyfacetsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - GetDocumentsByFacetsResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetDocumentsByFacetsResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "404", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Getdocvisibility.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Getdocvisibility.java new file mode 100644 index 00000000..7d278f42 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Getdocvisibility.java @@ -0,0 +1,182 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.GetDocumentVisibilityOverridesResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.GetdocvisibilityRequest; +import com.glean.api_client.glean_api_client.models.operations.GetdocvisibilityResponse; +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.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.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Getdocvisibility { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetdocvisibilityRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/governance/documents/visibilityoverrides"); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json; charset=UTF-8") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + GetdocvisibilityRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getdocvisibility", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getdocvisibility", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getdocvisibility", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetdocvisibilityRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public GetdocvisibilityResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetdocvisibilityResponse.Builder resBuilder = + GetdocvisibilityResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetdocvisibilityResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { + GetDocumentVisibilityOverridesResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withGetDocumentVisibilityOverridesResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetdocvisibilityOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetdocvisibilityOperation.java deleted file mode 100644 index a29c9c05..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/GetdocvisibilityOperation.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.GetDocumentVisibilityOverridesResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.GetdocvisibilityRequest; -import com.glean.api_client.glean_api_client.models.operations.GetdocvisibilityResponse; -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.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.Utils; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class GetdocvisibilityOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public GetdocvisibilityOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetdocvisibilityRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/governance/documents/visibilityoverrides"); - - HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "application/json; charset=UTF-8") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - GetdocvisibilityRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "getdocvisibility", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getdocvisibility", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "getdocvisibility", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getdocvisibility", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public GetdocvisibilityResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetdocvisibilityResponse.Builder resBuilder = - GetdocvisibilityResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - GetdocvisibilityResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { - GetDocumentVisibilityOverridesResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetDocumentVisibilityOverridesResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Getpin.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Getpin.java new file mode 100644 index 00000000..7e76c943 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Getpin.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.GetPinRequest; +import com.glean.api_client.glean_api_client.models.components.GetPinResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.GetpinResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Getpin { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetPinRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/getpin"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getpin", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getpin", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getpin", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetPinRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public GetpinResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetpinResponse.Builder resBuilder = + GetpinResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetpinResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + GetPinResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withGetPinResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetpinOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetpinOperation.java deleted file mode 100644 index 436598bf..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/GetpinOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.GetPinRequest; -import com.glean.api_client.glean_api_client.models.components.GetPinResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.GetpinResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class GetpinOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public GetpinOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetPinRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/getpin"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "getpin", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getpin", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "getpin", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getpin", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public GetpinResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetpinResponse.Builder resBuilder = - GetpinResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - GetpinResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - GetPinResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetPinResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Getpolicy.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Getpolicy.java new file mode 100644 index 00000000..5299ab06 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Getpolicy.java @@ -0,0 +1,184 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.GetDlpReportResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.GetpolicyRequest; +import com.glean.api_client.glean_api_client.models.operations.GetpolicyResponse; +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.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.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Getpolicy { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetpolicyRequest request) throws Exception { + String url = Utils.generateURL( + GetpolicyRequest.class, + this.baseUrl, + "/rest/api/v1/governance/data/policies/{id}", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + GetpolicyRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getpolicy", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getpolicy", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getpolicy", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetpolicyRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public GetpolicyResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetpolicyResponse.Builder resBuilder = + GetpolicyResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetpolicyResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + GetDlpReportResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withGetDlpReportResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetpolicyOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetpolicyOperation.java deleted file mode 100644 index f08c20ed..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/GetpolicyOperation.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.GetDlpReportResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.GetpolicyRequest; -import com.glean.api_client.glean_api_client.models.operations.GetpolicyResponse; -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.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.Utils; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class GetpolicyOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public GetpolicyOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetpolicyRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - GetpolicyRequest.class, - baseUrl, - "/rest/api/v1/governance/data/policies/{id}", - request, null); - - HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - GetpolicyRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "getpolicy", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getpolicy", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "getpolicy", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getpolicy", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public GetpolicyResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetpolicyResponse.Builder resBuilder = - GetpolicyResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - GetpolicyResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - GetDlpReportResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetDlpReportResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Getreportstatus.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Getreportstatus.java new file mode 100644 index 00000000..e81b5922 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Getreportstatus.java @@ -0,0 +1,179 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.ReportStatusResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.GetreportstatusRequest; +import com.glean.api_client.glean_api_client.models.operations.GetreportstatusResponse; +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.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.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Getreportstatus { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetreportstatusRequest request) throws Exception { + String url = Utils.generateURL( + GetreportstatusRequest.class, + this.baseUrl, + "/rest/api/v1/governance/data/reports/{id}/status", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json; charset=UTF-8") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getreportstatus", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getreportstatus", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getreportstatus", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetreportstatusRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public GetreportstatusResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetreportstatusResponse.Builder resBuilder = + GetreportstatusResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetreportstatusResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { + ReportStatusResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withReportStatusResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetreportstatusOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetreportstatusOperation.java deleted file mode 100644 index a6e1ca3e..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/GetreportstatusOperation.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.ReportStatusResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.GetreportstatusRequest; -import com.glean.api_client.glean_api_client.models.operations.GetreportstatusResponse; -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.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.Utils; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class GetreportstatusOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public GetreportstatusOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetreportstatusRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - GetreportstatusRequest.class, - baseUrl, - "/rest/api/v1/governance/data/reports/{id}/status", - request, null); - - HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "application/json; charset=UTF-8") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "getreportstatus", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getreportstatus", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "getreportstatus", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getreportstatus", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public GetreportstatusResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetreportstatusResponse.Builder resBuilder = - GetreportstatusResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - GetreportstatusResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { - ReportStatusResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withReportStatusResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Getshortcut.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Getshortcut.java new file mode 100644 index 00000000..0c492838 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Getshortcut.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.GetShortcutRequestUnion; +import com.glean.api_client.glean_api_client.models.components.GetShortcutResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.GetshortcutResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Getshortcut { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetShortcutRequestUnion request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/getshortcut"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getshortcut", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getshortcut", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getshortcut", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetShortcutRequestUnion request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public GetshortcutResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetshortcutResponse.Builder resBuilder = + GetshortcutResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetshortcutResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + GetShortcutResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withGetShortcutResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/GetshortcutOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/GetshortcutOperation.java deleted file mode 100644 index d923f78f..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/GetshortcutOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.GetShortcutRequestUnion; -import com.glean.api_client.glean_api_client.models.components.GetShortcutResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.GetshortcutResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class GetshortcutOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public GetshortcutOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetShortcutRequestUnion request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/getshortcut"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "getshortcut", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getshortcut", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "getshortcut", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "getshortcut", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public GetshortcutResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetshortcutResponse.Builder resBuilder = - GetshortcutResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - GetshortcutResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - GetShortcutResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetShortcutResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Insights.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Insights.java new file mode 100644 index 00000000..5f690e4a --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Insights.java @@ -0,0 +1,193 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.InsightsRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.InsightsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Insights { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(InsightsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/insights"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "insights", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "insights", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "insights", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(InsightsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public InsightsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + InsightsResponse.Builder resBuilder = + InsightsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + InsightsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + com.glean.api_client.glean_api_client.models.components.InsightsResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withInsightsResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/InsightsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/InsightsOperation.java deleted file mode 100644 index cdbc37d5..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/InsightsOperation.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.InsightsRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.InsightsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class InsightsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public InsightsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(InsightsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/insights"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "insights", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "insights", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "insights", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "insights", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public InsightsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - InsightsResponse.Builder resBuilder = - InsightsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - InsightsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - com.glean.api_client.glean_api_client.models.components.InsightsResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withInsightsResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Listanswers.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Listanswers.java new file mode 100644 index 00000000..c65757e0 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Listanswers.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.ListAnswersRequest; +import com.glean.api_client.glean_api_client.models.components.ListAnswersResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.ListanswersResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Listanswers { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(ListAnswersRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/listanswers"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listanswers", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listanswers", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listanswers", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(ListAnswersRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public ListanswersResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + ListanswersResponse.Builder resBuilder = + ListanswersResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + ListanswersResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + ListAnswersResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withListAnswersResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/ListanswersOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/ListanswersOperation.java deleted file mode 100644 index df78c840..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/ListanswersOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.ListAnswersRequest; -import com.glean.api_client.glean_api_client.models.components.ListAnswersResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.ListanswersResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class ListanswersOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public ListanswersOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(ListAnswersRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/listanswers"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "listanswers", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "listanswers", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "listanswers", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "listanswers", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public ListanswersResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - ListanswersResponse.Builder resBuilder = - ListanswersResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - ListanswersResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - ListAnswersResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withListAnswersResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Listchats.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Listchats.java new file mode 100644 index 00000000..90850a6a --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Listchats.java @@ -0,0 +1,182 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.ListChatsResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.ListchatsRequest; +import com.glean.api_client.glean_api_client.models.operations.ListchatsResponse; +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.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.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Listchats { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(ListchatsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/listchats"); + HTTPRequest req = new HTTPRequest(url, "POST"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + ListchatsRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listchats", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listchats", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listchats", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(ListchatsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "401", "403", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public ListchatsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + ListchatsResponse.Builder resBuilder = + ListchatsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + ListchatsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + ListChatsResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withListChatsResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "401", "403", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/ListchatsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/ListchatsOperation.java deleted file mode 100644 index c5b5e536..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/ListchatsOperation.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.ListChatsResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.ListchatsRequest; -import com.glean.api_client.glean_api_client.models.operations.ListchatsResponse; -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.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.Utils; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class ListchatsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public ListchatsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(ListchatsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/listchats"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - ListchatsRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "listchats", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "401", "403", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "listchats", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "listchats", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "listchats", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public ListchatsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - ListchatsResponse.Builder resBuilder = - ListchatsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - ListchatsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - ListChatsResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withListChatsResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "401", "403", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Listcollections.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Listcollections.java new file mode 100644 index 00000000..3ab20ca5 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Listcollections.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.ListCollectionsRequest; +import com.glean.api_client.glean_api_client.models.components.ListCollectionsResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.ListcollectionsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Listcollections { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(ListCollectionsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/listcollections"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listcollections", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listcollections", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listcollections", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(ListCollectionsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public ListcollectionsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + ListcollectionsResponse.Builder resBuilder = + ListcollectionsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + ListcollectionsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + ListCollectionsResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withListCollectionsResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/ListcollectionsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/ListcollectionsOperation.java deleted file mode 100644 index e565aa0a..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/ListcollectionsOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.ListCollectionsRequest; -import com.glean.api_client.glean_api_client.models.components.ListCollectionsResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.ListcollectionsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class ListcollectionsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public ListcollectionsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(ListCollectionsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/listcollections"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "listcollections", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "listcollections", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "listcollections", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "listcollections", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public ListcollectionsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - ListcollectionsResponse.Builder resBuilder = - ListcollectionsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - ListcollectionsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - ListCollectionsResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withListCollectionsResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Listentities.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Listentities.java new file mode 100644 index 00000000..bdb21780 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Listentities.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.ListEntitiesRequest; +import com.glean.api_client.glean_api_client.models.components.ListEntitiesResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.ListentitiesResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Listentities { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(ListEntitiesRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/listentities"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listentities", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listentities", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listentities", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(ListEntitiesRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public ListentitiesResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + ListentitiesResponse.Builder resBuilder = + ListentitiesResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + ListentitiesResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + ListEntitiesResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withListEntitiesResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/ListentitiesOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/ListentitiesOperation.java deleted file mode 100644 index 04af6b17..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/ListentitiesOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.ListEntitiesRequest; -import com.glean.api_client.glean_api_client.models.components.ListEntitiesResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.ListentitiesResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class ListentitiesOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public ListentitiesOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(ListEntitiesRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/listentities"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "listentities", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "listentities", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "listentities", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "listentities", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public ListentitiesResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - ListentitiesResponse.Builder resBuilder = - ListentitiesResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - ListentitiesResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - ListEntitiesResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withListEntitiesResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Listpins.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Listpins.java new file mode 100644 index 00000000..13a3d771 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Listpins.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.ListPinsResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.ListpinsRequest; +import com.glean.api_client.glean_api_client.models.operations.ListpinsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Listpins { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(ListpinsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/listpins"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listpins", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listpins", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listpins", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(ListpinsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public ListpinsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + ListpinsResponse.Builder resBuilder = + ListpinsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + ListpinsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + ListPinsResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withListPinsResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/ListpinsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/ListpinsOperation.java deleted file mode 100644 index ffb3f47f..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/ListpinsOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.ListPinsResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.ListpinsRequest; -import com.glean.api_client.glean_api_client.models.operations.ListpinsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class ListpinsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public ListpinsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(ListpinsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/listpins"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "listpins", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "listpins", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "listpins", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "listpins", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public ListpinsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - ListpinsResponse.Builder resBuilder = - ListpinsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - ListpinsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - ListPinsResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withListPinsResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Listpolicies.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Listpolicies.java new file mode 100644 index 00000000..4adb90f6 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Listpolicies.java @@ -0,0 +1,182 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.ListDlpReportsResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.ListpoliciesRequest; +import com.glean.api_client.glean_api_client.models.operations.ListpoliciesResponse; +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.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.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Listpolicies { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(ListpoliciesRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/governance/data/policies"); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + ListpoliciesRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listpolicies", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listpolicies", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listpolicies", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(ListpoliciesRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public ListpoliciesResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + ListpoliciesResponse.Builder resBuilder = + ListpoliciesResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + ListpoliciesResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + ListDlpReportsResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withListDlpReportsResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/ListpoliciesOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/ListpoliciesOperation.java deleted file mode 100644 index 93296f13..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/ListpoliciesOperation.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.ListDlpReportsResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.ListpoliciesRequest; -import com.glean.api_client.glean_api_client.models.operations.ListpoliciesResponse; -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.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.Utils; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class ListpoliciesOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public ListpoliciesOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(ListpoliciesRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/governance/data/policies"); - - HTTPRequest req = new HTTPRequest(url, "GET"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - ListpoliciesRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "listpolicies", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "listpolicies", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "listpolicies", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "listpolicies", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public ListpoliciesResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - ListpoliciesResponse.Builder resBuilder = - ListpoliciesResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - ListpoliciesResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - ListDlpReportsResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withListDlpReportsResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Listshortcuts.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Listshortcuts.java new file mode 100644 index 00000000..d604b878 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Listshortcuts.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.ListShortcutsPaginatedRequest; +import com.glean.api_client.glean_api_client.models.components.ListShortcutsPaginatedResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.ListshortcutsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Listshortcuts { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(ListShortcutsPaginatedRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/listshortcuts"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listshortcuts", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listshortcuts", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listshortcuts", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(ListShortcutsPaginatedRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public ListshortcutsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + ListshortcutsResponse.Builder resBuilder = + ListshortcutsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + ListshortcutsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + ListShortcutsPaginatedResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withListShortcutsPaginatedResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/ListshortcutsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/ListshortcutsOperation.java deleted file mode 100644 index 6b276b7b..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/ListshortcutsOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.ListShortcutsPaginatedRequest; -import com.glean.api_client.glean_api_client.models.components.ListShortcutsPaginatedResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.ListshortcutsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class ListshortcutsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public ListshortcutsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(ListShortcutsPaginatedRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/listshortcuts"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "listshortcuts", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "listshortcuts", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "listshortcuts", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "listshortcuts", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public ListshortcutsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - ListshortcutsResponse.Builder resBuilder = - ListshortcutsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - ListshortcutsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - ListShortcutsPaginatedResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withListShortcutsPaginatedResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Listverifications.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Listverifications.java new file mode 100644 index 00000000..2c899769 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Listverifications.java @@ -0,0 +1,182 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.VerificationFeed; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.ListverificationsRequest; +import com.glean.api_client.glean_api_client.models.operations.ListverificationsResponse; +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.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.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Listverifications { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(ListverificationsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/listverifications"); + HTTPRequest req = new HTTPRequest(url, "POST"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + ListverificationsRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listverifications", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listverifications", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "listverifications", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(ListverificationsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public ListverificationsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + ListverificationsResponse.Builder resBuilder = + ListverificationsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + ListverificationsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + VerificationFeed out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withVerificationFeed(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/ListverificationsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/ListverificationsOperation.java deleted file mode 100644 index 29807c19..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/ListverificationsOperation.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.VerificationFeed; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.ListverificationsRequest; -import com.glean.api_client.glean_api_client.models.operations.ListverificationsResponse; -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.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.Utils; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class ListverificationsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public ListverificationsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(ListverificationsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/listverifications"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - ListverificationsRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "listverifications", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "listverifications", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "listverifications", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "listverifications", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public ListverificationsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - ListverificationsResponse.Builder resBuilder = - ListverificationsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - ListverificationsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - VerificationFeed out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withVerificationFeed(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Messages.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Messages.java new file mode 100644 index 00000000..730881c8 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Messages.java @@ -0,0 +1,193 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.MessagesRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.MessagesResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Messages { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(MessagesRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/messages"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "messages", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "messages", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "messages", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(MessagesRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public MessagesResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + MessagesResponse.Builder resBuilder = + MessagesResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + MessagesResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + com.glean.api_client.glean_api_client.models.components.MessagesResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withMessagesResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/MessagesOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/MessagesOperation.java deleted file mode 100644 index cd3d1f07..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/MessagesOperation.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.MessagesRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.MessagesResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class MessagesOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public MessagesOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(MessagesRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/messages"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "messages", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "messages", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "messages", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "messages", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public MessagesResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - MessagesResponse.Builder resBuilder = - MessagesResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - MessagesResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - com.glean.api_client.glean_api_client.models.components.MessagesResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withMessagesResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/People.java b/src/main/java/com/glean/api_client/glean_api_client/operations/People.java new file mode 100644 index 00000000..e5dfbc93 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/People.java @@ -0,0 +1,193 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.PeopleRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PeopleResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class People { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(PeopleRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/people"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "people", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "people", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "people", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(PeopleRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PeopleResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PeopleResponse.Builder resBuilder = + PeopleResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PeopleResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + com.glean.api_client.glean_api_client.models.components.PeopleResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withPeopleResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PeopleOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PeopleOperation.java deleted file mode 100644 index d9b04daf..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PeopleOperation.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.PeopleRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PeopleResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PeopleOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PeopleOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(PeopleRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/people"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "people", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "people", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "people", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "people", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PeopleResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PeopleResponse.Builder resBuilder = - PeopleResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PeopleResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - com.glean.api_client.glean_api_client.models.components.PeopleResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withPeopleResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Pin.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Pin.java new file mode 100644 index 00000000..053a7926 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Pin.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.PinDocument; +import com.glean.api_client.glean_api_client.models.components.PinRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PinResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Pin { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(PinRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/pin"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "pin", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "pin", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "pin", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(PinRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PinResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PinResponse.Builder resBuilder = + PinResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PinResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + PinDocument out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withPinDocument(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PinOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PinOperation.java deleted file mode 100644 index e034bd36..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PinOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.PinDocument; -import com.glean.api_client.glean_api_client.models.components.PinRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PinResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PinOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PinOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(PinRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/pin"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "pin", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "pin", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "pin", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "pin", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PinResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PinResponse.Builder resBuilder = - PinResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PinResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - PinDocument out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withPinDocument(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Adddatasource.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Adddatasource.java new file mode 100644 index 00000000..181d8915 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Adddatasource.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.CustomDatasourceConfig; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1AdddatasourceResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Adddatasource { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(CustomDatasourceConfig request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/adddatasource"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/adddatasource", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/adddatasource", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/adddatasource", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(CustomDatasourceConfig request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1AdddatasourceResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1AdddatasourceResponse.Builder resBuilder = + PostApiIndexV1AdddatasourceResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1AdddatasourceResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1AdddatasourceOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1AdddatasourceOperation.java deleted file mode 100644 index 95455f9b..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1AdddatasourceOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.CustomDatasourceConfig; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1AdddatasourceResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1AdddatasourceOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1AdddatasourceOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(CustomDatasourceConfig request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/adddatasource"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/adddatasource", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/adddatasource", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/adddatasource", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/adddatasource", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1AdddatasourceResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1AdddatasourceResponse.Builder resBuilder = - PostApiIndexV1AdddatasourceResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1AdddatasourceResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Betausers.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Betausers.java new file mode 100644 index 00000000..3ade43f8 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Betausers.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.GreenlistUsersRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BetausersResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Betausers { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GreenlistUsersRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/betausers"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/betausers", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/betausers", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/betausers", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GreenlistUsersRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1BetausersResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1BetausersResponse.Builder resBuilder = + PostApiIndexV1BetausersResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1BetausersResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BetausersOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BetausersOperation.java deleted file mode 100644 index 53a2e0e0..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BetausersOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.GreenlistUsersRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BetausersResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1BetausersOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1BetausersOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GreenlistUsersRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/betausers"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/betausers", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/betausers", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/betausers", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/betausers", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1BetausersResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1BetausersResponse.Builder resBuilder = - PostApiIndexV1BetausersResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1BetausersResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexdocuments.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexdocuments.java new file mode 100644 index 00000000..0eb0ece8 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexdocuments.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.BulkIndexDocumentsRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BulkindexdocumentsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Bulkindexdocuments { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(BulkIndexDocumentsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/bulkindexdocuments"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexdocuments", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexdocuments", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexdocuments", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(BulkIndexDocumentsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1BulkindexdocumentsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1BulkindexdocumentsResponse.Builder resBuilder = + PostApiIndexV1BulkindexdocumentsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1BulkindexdocumentsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexdocumentsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexdocumentsOperation.java deleted file mode 100644 index c68a37cc..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexdocumentsOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.BulkIndexDocumentsRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BulkindexdocumentsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1BulkindexdocumentsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1BulkindexdocumentsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(BulkIndexDocumentsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/bulkindexdocuments"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexdocuments", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexdocuments", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexdocuments", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexdocuments", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1BulkindexdocumentsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1BulkindexdocumentsResponse.Builder resBuilder = - PostApiIndexV1BulkindexdocumentsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1BulkindexdocumentsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexemployees.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexemployees.java new file mode 100644 index 00000000..2b4e5281 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexemployees.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.BulkIndexEmployeesRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BulkindexemployeesResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Bulkindexemployees { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(BulkIndexEmployeesRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/bulkindexemployees"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexemployees", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexemployees", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexemployees", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(BulkIndexEmployeesRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1BulkindexemployeesResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1BulkindexemployeesResponse.Builder resBuilder = + PostApiIndexV1BulkindexemployeesResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1BulkindexemployeesResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexemployeesOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexemployeesOperation.java deleted file mode 100644 index 4c01f494..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexemployeesOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.BulkIndexEmployeesRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BulkindexemployeesResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1BulkindexemployeesOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1BulkindexemployeesOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(BulkIndexEmployeesRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/bulkindexemployees"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexemployees", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexemployees", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexemployees", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexemployees", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1BulkindexemployeesResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1BulkindexemployeesResponse.Builder resBuilder = - PostApiIndexV1BulkindexemployeesResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1BulkindexemployeesResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexgroups.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexgroups.java new file mode 100644 index 00000000..df6651e0 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexgroups.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.BulkIndexGroupsRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BulkindexgroupsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Bulkindexgroups { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(BulkIndexGroupsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/bulkindexgroups"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexgroups", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexgroups", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexgroups", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(BulkIndexGroupsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1BulkindexgroupsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1BulkindexgroupsResponse.Builder resBuilder = + PostApiIndexV1BulkindexgroupsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1BulkindexgroupsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexgroupsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexgroupsOperation.java deleted file mode 100644 index 7436d893..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexgroupsOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.BulkIndexGroupsRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BulkindexgroupsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1BulkindexgroupsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1BulkindexgroupsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(BulkIndexGroupsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/bulkindexgroups"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexgroups", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexgroups", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexgroups", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexgroups", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1BulkindexgroupsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1BulkindexgroupsResponse.Builder resBuilder = - PostApiIndexV1BulkindexgroupsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1BulkindexgroupsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexmemberships.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexmemberships.java new file mode 100644 index 00000000..fac9939d --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexmemberships.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.BulkIndexMembershipsRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BulkindexmembershipsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Bulkindexmemberships { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(BulkIndexMembershipsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/bulkindexmemberships"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexmemberships", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexmemberships", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexmemberships", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(BulkIndexMembershipsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1BulkindexmembershipsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1BulkindexmembershipsResponse.Builder resBuilder = + PostApiIndexV1BulkindexmembershipsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1BulkindexmembershipsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexmembershipsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexmembershipsOperation.java deleted file mode 100644 index 4ee86168..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexmembershipsOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.BulkIndexMembershipsRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BulkindexmembershipsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1BulkindexmembershipsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1BulkindexmembershipsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(BulkIndexMembershipsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/bulkindexmemberships"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexmemberships", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexmemberships", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexmemberships", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexmemberships", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1BulkindexmembershipsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1BulkindexmembershipsResponse.Builder resBuilder = - PostApiIndexV1BulkindexmembershipsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1BulkindexmembershipsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexshortcuts.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexshortcuts.java new file mode 100644 index 00000000..fc46c7ef --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexshortcuts.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.BulkIndexShortcutsRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BulkindexshortcutsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Bulkindexshortcuts { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(BulkIndexShortcutsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/bulkindexshortcuts"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexshortcuts", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexshortcuts", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexshortcuts", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(BulkIndexShortcutsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1BulkindexshortcutsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1BulkindexshortcutsResponse.Builder resBuilder = + PostApiIndexV1BulkindexshortcutsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1BulkindexshortcutsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexshortcutsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexshortcutsOperation.java deleted file mode 100644 index 59fb6327..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexshortcutsOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.BulkIndexShortcutsRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BulkindexshortcutsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1BulkindexshortcutsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1BulkindexshortcutsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(BulkIndexShortcutsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/bulkindexshortcuts"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexshortcuts", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexshortcuts", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexshortcuts", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexshortcuts", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1BulkindexshortcutsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1BulkindexshortcutsResponse.Builder resBuilder = - PostApiIndexV1BulkindexshortcutsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1BulkindexshortcutsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexteams.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexteams.java new file mode 100644 index 00000000..182e3727 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexteams.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.BulkIndexTeamsRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BulkindexteamsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Bulkindexteams { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(BulkIndexTeamsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/bulkindexteams"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexteams", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexteams", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexteams", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(BulkIndexTeamsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1BulkindexteamsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1BulkindexteamsResponse.Builder resBuilder = + PostApiIndexV1BulkindexteamsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1BulkindexteamsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexteamsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexteamsOperation.java deleted file mode 100644 index 0e2fbbb8..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexteamsOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.BulkIndexTeamsRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BulkindexteamsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1BulkindexteamsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1BulkindexteamsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(BulkIndexTeamsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/bulkindexteams"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexteams", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexteams", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexteams", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexteams", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1BulkindexteamsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1BulkindexteamsResponse.Builder resBuilder = - PostApiIndexV1BulkindexteamsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1BulkindexteamsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexusers.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexusers.java new file mode 100644 index 00000000..5a4f417e --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Bulkindexusers.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.BulkIndexUsersRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BulkindexusersResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Bulkindexusers { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(BulkIndexUsersRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/bulkindexusers"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexusers", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexusers", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/bulkindexusers", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(BulkIndexUsersRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1BulkindexusersResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1BulkindexusersResponse.Builder resBuilder = + PostApiIndexV1BulkindexusersResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1BulkindexusersResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexusersOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexusersOperation.java deleted file mode 100644 index 691aeb44..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1BulkindexusersOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.BulkIndexUsersRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BulkindexusersResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1BulkindexusersOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1BulkindexusersOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(BulkIndexUsersRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/bulkindexusers"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexusers", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexusers", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexusers", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/bulkindexusers", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1BulkindexusersResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1BulkindexusersResponse.Builder resBuilder = - PostApiIndexV1BulkindexusersResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1BulkindexusersResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Checkdocumentaccess.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Checkdocumentaccess.java new file mode 100644 index 00000000..e9939d4b --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Checkdocumentaccess.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.CheckDocumentAccessRequest; +import com.glean.api_client.glean_api_client.models.components.CheckDocumentAccessResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1CheckdocumentaccessResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Checkdocumentaccess { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(CheckDocumentAccessRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/checkdocumentaccess"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/checkdocumentaccess", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/checkdocumentaccess", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/checkdocumentaccess", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(CheckDocumentAccessRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1CheckdocumentaccessResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1CheckdocumentaccessResponse.Builder resBuilder = + PostApiIndexV1CheckdocumentaccessResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1CheckdocumentaccessResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + CheckDocumentAccessResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withCheckDocumentAccessResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1CheckdocumentaccessOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1CheckdocumentaccessOperation.java deleted file mode 100644 index c6386605..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1CheckdocumentaccessOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.CheckDocumentAccessRequest; -import com.glean.api_client.glean_api_client.models.components.CheckDocumentAccessResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1CheckdocumentaccessResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1CheckdocumentaccessOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1CheckdocumentaccessOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(CheckDocumentAccessRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/checkdocumentaccess"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/checkdocumentaccess", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/checkdocumentaccess", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/checkdocumentaccess", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/checkdocumentaccess", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1CheckdocumentaccessResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1CheckdocumentaccessResponse.Builder resBuilder = - PostApiIndexV1CheckdocumentaccessResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1CheckdocumentaccessResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - CheckDocumentAccessResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withCheckDocumentAccessResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceDocument.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceDocument.java new file mode 100644 index 00000000..cab83c96 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceDocument.java @@ -0,0 +1,196 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.DebugDocumentResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceDocumentRequest; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceDocumentResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1DebugDatasourceDocument { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(PostApiIndexV1DebugDatasourceDocumentRequest request) throws Exception { + String url = Utils.generateURL( + PostApiIndexV1DebugDatasourceDocumentRequest.class, + this.baseUrl, + "/api/index/v1/debug/{datasource}/document", + request, null); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "debugDocumentRequest", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json; charset=UTF-8") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/debug/{datasource}/document", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/debug/{datasource}/document", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/debug/{datasource}/document", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(PostApiIndexV1DebugDatasourceDocumentRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1DebugDatasourceDocumentResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1DebugDatasourceDocumentResponse.Builder resBuilder = + PostApiIndexV1DebugDatasourceDocumentResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1DebugDatasourceDocumentResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { + DebugDocumentResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withDebugDocumentResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceDocumentOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceDocumentOperation.java deleted file mode 100644 index 3ac504aa..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceDocumentOperation.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.DebugDocumentResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceDocumentRequest; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceDocumentResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1DebugDatasourceDocumentOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1DebugDatasourceDocumentOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(PostApiIndexV1DebugDatasourceDocumentRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - PostApiIndexV1DebugDatasourceDocumentRequest.class, - baseUrl, - "/api/index/v1/debug/{datasource}/document", - request, null); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "debugDocumentRequest", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json; charset=UTF-8") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/debug/{datasource}/document", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/debug/{datasource}/document", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/debug/{datasource}/document", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/debug/{datasource}/document", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1DebugDatasourceDocumentResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1DebugDatasourceDocumentResponse.Builder resBuilder = - PostApiIndexV1DebugDatasourceDocumentResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1DebugDatasourceDocumentResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { - DebugDocumentResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withDebugDocumentResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceDocuments.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceDocuments.java new file mode 100644 index 00000000..2485b63a --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceDocuments.java @@ -0,0 +1,196 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.DebugDocumentsResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceDocumentsRequest; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceDocumentsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1DebugDatasourceDocuments { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(PostApiIndexV1DebugDatasourceDocumentsRequest request) throws Exception { + String url = Utils.generateURL( + PostApiIndexV1DebugDatasourceDocumentsRequest.class, + this.baseUrl, + "/api/index/v1/debug/{datasource}/documents", + request, null); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "debugDocumentsRequest", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json; charset=UTF-8") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/debug/{datasource}/documents", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/debug/{datasource}/documents", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/debug/{datasource}/documents", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(PostApiIndexV1DebugDatasourceDocumentsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1DebugDatasourceDocumentsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1DebugDatasourceDocumentsResponse.Builder resBuilder = + PostApiIndexV1DebugDatasourceDocumentsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1DebugDatasourceDocumentsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { + DebugDocumentsResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withDebugDocumentsResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceDocumentsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceDocumentsOperation.java deleted file mode 100644 index a1c32c9b..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceDocumentsOperation.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.DebugDocumentsResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceDocumentsRequest; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceDocumentsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1DebugDatasourceDocumentsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1DebugDatasourceDocumentsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(PostApiIndexV1DebugDatasourceDocumentsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - PostApiIndexV1DebugDatasourceDocumentsRequest.class, - baseUrl, - "/api/index/v1/debug/{datasource}/documents", - request, null); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "debugDocumentsRequest", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json; charset=UTF-8") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/debug/{datasource}/documents", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/debug/{datasource}/documents", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/debug/{datasource}/documents", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/debug/{datasource}/documents", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1DebugDatasourceDocumentsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1DebugDatasourceDocumentsResponse.Builder resBuilder = - PostApiIndexV1DebugDatasourceDocumentsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1DebugDatasourceDocumentsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { - DebugDocumentsResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withDebugDocumentsResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceStatus.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceStatus.java new file mode 100644 index 00000000..bf2d790c --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceStatus.java @@ -0,0 +1,179 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.DebugDatasourceStatusResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceStatusRequest; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceStatusResponse; +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.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.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1DebugDatasourceStatus { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(PostApiIndexV1DebugDatasourceStatusRequest request) throws Exception { + String url = Utils.generateURL( + PostApiIndexV1DebugDatasourceStatusRequest.class, + this.baseUrl, + "/api/index/v1/debug/{datasource}/status", + request, null); + HTTPRequest req = new HTTPRequest(url, "POST"); + req.addHeader("Accept", "application/json; charset=UTF-8") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/debug/{datasource}/status", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/debug/{datasource}/status", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/debug/{datasource}/status", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(PostApiIndexV1DebugDatasourceStatusRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1DebugDatasourceStatusResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1DebugDatasourceStatusResponse.Builder resBuilder = + PostApiIndexV1DebugDatasourceStatusResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1DebugDatasourceStatusResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { + DebugDatasourceStatusResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withDebugDatasourceStatusResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceStatusOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceStatusOperation.java deleted file mode 100644 index 46c27467..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceStatusOperation.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.DebugDatasourceStatusResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceStatusRequest; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceStatusResponse; -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.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.Utils; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1DebugDatasourceStatusOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1DebugDatasourceStatusOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(PostApiIndexV1DebugDatasourceStatusRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - PostApiIndexV1DebugDatasourceStatusRequest.class, - baseUrl, - "/api/index/v1/debug/{datasource}/status", - request, null); - - HTTPRequest req = new HTTPRequest(url, "POST"); - req.addHeader("Accept", "application/json; charset=UTF-8") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/debug/{datasource}/status", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/debug/{datasource}/status", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/debug/{datasource}/status", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/debug/{datasource}/status", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1DebugDatasourceStatusResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1DebugDatasourceStatusResponse.Builder resBuilder = - PostApiIndexV1DebugDatasourceStatusResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1DebugDatasourceStatusResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { - DebugDatasourceStatusResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withDebugDatasourceStatusResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceUser.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceUser.java new file mode 100644 index 00000000..819e96c3 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceUser.java @@ -0,0 +1,196 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.DebugUserResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceUserRequest; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceUserResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1DebugDatasourceUser { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(PostApiIndexV1DebugDatasourceUserRequest request) throws Exception { + String url = Utils.generateURL( + PostApiIndexV1DebugDatasourceUserRequest.class, + this.baseUrl, + "/api/index/v1/debug/{datasource}/user", + request, null); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "debugUserRequest", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json; charset=UTF-8") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/debug/{datasource}/user", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/debug/{datasource}/user", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/debug/{datasource}/user", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(PostApiIndexV1DebugDatasourceUserRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1DebugDatasourceUserResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1DebugDatasourceUserResponse.Builder resBuilder = + PostApiIndexV1DebugDatasourceUserResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1DebugDatasourceUserResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { + DebugUserResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withDebugUserResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceUserOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceUserOperation.java deleted file mode 100644 index 080c0247..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DebugDatasourceUserOperation.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.DebugUserResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceUserRequest; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceUserResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1DebugDatasourceUserOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1DebugDatasourceUserOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(PostApiIndexV1DebugDatasourceUserRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - PostApiIndexV1DebugDatasourceUserRequest.class, - baseUrl, - "/api/index/v1/debug/{datasource}/user", - request, null); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "debugUserRequest", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json; charset=UTF-8") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/debug/{datasource}/user", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/debug/{datasource}/user", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/debug/{datasource}/user", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/debug/{datasource}/user", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1DebugDatasourceUserResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1DebugDatasourceUserResponse.Builder resBuilder = - PostApiIndexV1DebugDatasourceUserResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1DebugDatasourceUserResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { - DebugUserResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withDebugUserResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deletedocument.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deletedocument.java new file mode 100644 index 00000000..20907ebc --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deletedocument.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.DeleteDocumentRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DeletedocumentResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Deletedocument { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(DeleteDocumentRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/deletedocument"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deletedocument", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deletedocument", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deletedocument", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(DeleteDocumentRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1DeletedocumentResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1DeletedocumentResponse.Builder resBuilder = + PostApiIndexV1DeletedocumentResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1DeletedocumentResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeletedocumentOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeletedocumentOperation.java deleted file mode 100644 index f01bfa39..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeletedocumentOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.DeleteDocumentRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DeletedocumentResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1DeletedocumentOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1DeletedocumentOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(DeleteDocumentRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/deletedocument"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deletedocument", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deletedocument", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deletedocument", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deletedocument", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1DeletedocumentResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1DeletedocumentResponse.Builder resBuilder = - PostApiIndexV1DeletedocumentResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1DeletedocumentResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deleteemployee.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deleteemployee.java new file mode 100644 index 00000000..6a192976 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deleteemployee.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.DeleteEmployeeRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DeleteemployeeResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Deleteemployee { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(DeleteEmployeeRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/deleteemployee"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deleteemployee", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deleteemployee", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deleteemployee", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(DeleteEmployeeRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1DeleteemployeeResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1DeleteemployeeResponse.Builder resBuilder = + PostApiIndexV1DeleteemployeeResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1DeleteemployeeResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeleteemployeeOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeleteemployeeOperation.java deleted file mode 100644 index 5b714bf0..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeleteemployeeOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.DeleteEmployeeRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DeleteemployeeResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1DeleteemployeeOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1DeleteemployeeOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(DeleteEmployeeRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/deleteemployee"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deleteemployee", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deleteemployee", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deleteemployee", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deleteemployee", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1DeleteemployeeResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1DeleteemployeeResponse.Builder resBuilder = - PostApiIndexV1DeleteemployeeResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1DeleteemployeeResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deletegroup.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deletegroup.java new file mode 100644 index 00000000..6bcb91d6 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deletegroup.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.DeleteGroupRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DeletegroupResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Deletegroup { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(DeleteGroupRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/deletegroup"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deletegroup", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deletegroup", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deletegroup", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(DeleteGroupRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1DeletegroupResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1DeletegroupResponse.Builder resBuilder = + PostApiIndexV1DeletegroupResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1DeletegroupResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeletegroupOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeletegroupOperation.java deleted file mode 100644 index 0f739251..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeletegroupOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.DeleteGroupRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DeletegroupResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1DeletegroupOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1DeletegroupOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(DeleteGroupRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/deletegroup"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deletegroup", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deletegroup", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deletegroup", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deletegroup", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1DeletegroupResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1DeletegroupResponse.Builder resBuilder = - PostApiIndexV1DeletegroupResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1DeletegroupResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deletemembership.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deletemembership.java new file mode 100644 index 00000000..dc5f5f43 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deletemembership.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.DeleteMembershipRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DeletemembershipResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Deletemembership { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(DeleteMembershipRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/deletemembership"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deletemembership", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deletemembership", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deletemembership", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(DeleteMembershipRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1DeletemembershipResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1DeletemembershipResponse.Builder resBuilder = + PostApiIndexV1DeletemembershipResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1DeletemembershipResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeletemembershipOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeletemembershipOperation.java deleted file mode 100644 index ff1bf411..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeletemembershipOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.DeleteMembershipRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DeletemembershipResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1DeletemembershipOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1DeletemembershipOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(DeleteMembershipRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/deletemembership"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deletemembership", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deletemembership", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deletemembership", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deletemembership", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1DeletemembershipResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1DeletemembershipResponse.Builder resBuilder = - PostApiIndexV1DeletemembershipResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1DeletemembershipResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deleteteam.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deleteteam.java new file mode 100644 index 00000000..c62d2d83 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deleteteam.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.DeleteTeamRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DeleteteamResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Deleteteam { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(DeleteTeamRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/deleteteam"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deleteteam", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deleteteam", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deleteteam", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(DeleteTeamRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1DeleteteamResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1DeleteteamResponse.Builder resBuilder = + PostApiIndexV1DeleteteamResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1DeleteteamResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeleteteamOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeleteteamOperation.java deleted file mode 100644 index e9d45dea..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeleteteamOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.DeleteTeamRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DeleteteamResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1DeleteteamOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1DeleteteamOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(DeleteTeamRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/deleteteam"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deleteteam", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deleteteam", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deleteteam", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deleteteam", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1DeleteteamResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1DeleteteamResponse.Builder resBuilder = - PostApiIndexV1DeleteteamResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1DeleteteamResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deleteuser.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deleteuser.java new file mode 100644 index 00000000..834cfbb0 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Deleteuser.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.DeleteUserRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DeleteuserResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Deleteuser { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(DeleteUserRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/deleteuser"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deleteuser", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deleteuser", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/deleteuser", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(DeleteUserRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1DeleteuserResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1DeleteuserResponse.Builder resBuilder = + PostApiIndexV1DeleteuserResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1DeleteuserResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeleteuserOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeleteuserOperation.java deleted file mode 100644 index 4410e6ed..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1DeleteuserOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.DeleteUserRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DeleteuserResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1DeleteuserOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1DeleteuserOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(DeleteUserRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/deleteuser"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deleteuser", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deleteuser", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deleteuser", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/deleteuser", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1DeleteuserResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1DeleteuserResponse.Builder resBuilder = - PostApiIndexV1DeleteuserResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1DeleteuserResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Getdatasourceconfig.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Getdatasourceconfig.java new file mode 100644 index 00000000..e55b8874 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Getdatasourceconfig.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.CustomDatasourceConfig; +import com.glean.api_client.glean_api_client.models.components.GetDatasourceConfigRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1GetdatasourceconfigResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Getdatasourceconfig { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetDatasourceConfigRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/getdatasourceconfig"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/getdatasourceconfig", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/getdatasourceconfig", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/getdatasourceconfig", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetDatasourceConfigRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1GetdatasourceconfigResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1GetdatasourceconfigResponse.Builder resBuilder = + PostApiIndexV1GetdatasourceconfigResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1GetdatasourceconfigResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + CustomDatasourceConfig out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withCustomDatasourceConfig(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1GetdatasourceconfigOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1GetdatasourceconfigOperation.java deleted file mode 100644 index 41d79ee7..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1GetdatasourceconfigOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.CustomDatasourceConfig; -import com.glean.api_client.glean_api_client.models.components.GetDatasourceConfigRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1GetdatasourceconfigResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1GetdatasourceconfigOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1GetdatasourceconfigOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetDatasourceConfigRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/getdatasourceconfig"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/getdatasourceconfig", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/getdatasourceconfig", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/getdatasourceconfig", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/getdatasourceconfig", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1GetdatasourceconfigResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1GetdatasourceconfigResponse.Builder resBuilder = - PostApiIndexV1GetdatasourceconfigResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1GetdatasourceconfigResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - CustomDatasourceConfig out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withCustomDatasourceConfig(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Getdocumentcount.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Getdocumentcount.java new file mode 100644 index 00000000..cd62fa5b --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Getdocumentcount.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.GetDocumentCountRequest; +import com.glean.api_client.glean_api_client.models.components.GetDocumentCountResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1GetdocumentcountResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Getdocumentcount { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetDocumentCountRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/getdocumentcount"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/getdocumentcount", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/getdocumentcount", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/getdocumentcount", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetDocumentCountRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1GetdocumentcountResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1GetdocumentcountResponse.Builder resBuilder = + PostApiIndexV1GetdocumentcountResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1GetdocumentcountResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + GetDocumentCountResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withGetDocumentCountResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1GetdocumentcountOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1GetdocumentcountOperation.java deleted file mode 100644 index 2aad4245..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1GetdocumentcountOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.GetDocumentCountRequest; -import com.glean.api_client.glean_api_client.models.components.GetDocumentCountResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1GetdocumentcountResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1GetdocumentcountOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1GetdocumentcountOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetDocumentCountRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/getdocumentcount"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/getdocumentcount", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/getdocumentcount", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/getdocumentcount", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/getdocumentcount", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1GetdocumentcountResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1GetdocumentcountResponse.Builder resBuilder = - PostApiIndexV1GetdocumentcountResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1GetdocumentcountResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - GetDocumentCountResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetDocumentCountResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Getdocumentstatus.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Getdocumentstatus.java new file mode 100644 index 00000000..20be55d7 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Getdocumentstatus.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.GetDocumentStatusRequest; +import com.glean.api_client.glean_api_client.models.components.GetDocumentStatusResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1GetdocumentstatusResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Getdocumentstatus { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetDocumentStatusRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/getdocumentstatus"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/getdocumentstatus", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/getdocumentstatus", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/getdocumentstatus", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetDocumentStatusRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1GetdocumentstatusResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1GetdocumentstatusResponse.Builder resBuilder = + PostApiIndexV1GetdocumentstatusResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1GetdocumentstatusResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + GetDocumentStatusResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withGetDocumentStatusResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1GetdocumentstatusOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1GetdocumentstatusOperation.java deleted file mode 100644 index ed1b81c7..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1GetdocumentstatusOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.GetDocumentStatusRequest; -import com.glean.api_client.glean_api_client.models.components.GetDocumentStatusResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1GetdocumentstatusResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1GetdocumentstatusOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1GetdocumentstatusOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetDocumentStatusRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/getdocumentstatus"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/getdocumentstatus", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/getdocumentstatus", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/getdocumentstatus", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/getdocumentstatus", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1GetdocumentstatusResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1GetdocumentstatusResponse.Builder resBuilder = - PostApiIndexV1GetdocumentstatusResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1GetdocumentstatusResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - GetDocumentStatusResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetDocumentStatusResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Getusercount.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Getusercount.java new file mode 100644 index 00000000..49e6d190 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Getusercount.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.GetUserCountRequest; +import com.glean.api_client.glean_api_client.models.components.GetUserCountResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1GetusercountResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Getusercount { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(GetUserCountRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/getusercount"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/getusercount", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/getusercount", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/getusercount", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(GetUserCountRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1GetusercountResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1GetusercountResponse.Builder resBuilder = + PostApiIndexV1GetusercountResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1GetusercountResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + GetUserCountResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withGetUserCountResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1GetusercountOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1GetusercountOperation.java deleted file mode 100644 index be7b1d59..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1GetusercountOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.GetUserCountRequest; -import com.glean.api_client.glean_api_client.models.components.GetUserCountResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1GetusercountResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1GetusercountOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1GetusercountOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(GetUserCountRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/getusercount"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/getusercount", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/getusercount", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/getusercount", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/getusercount", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1GetusercountResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1GetusercountResponse.Builder resBuilder = - PostApiIndexV1GetusercountResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1GetusercountResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - GetUserCountResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetUserCountResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexdocument.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexdocument.java new file mode 100644 index 00000000..cc914ef8 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexdocument.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.IndexDocumentRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexdocumentResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Indexdocument { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(IndexDocumentRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/indexdocument"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexdocument", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexdocument", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexdocument", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(IndexDocumentRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1IndexdocumentResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1IndexdocumentResponse.Builder resBuilder = + PostApiIndexV1IndexdocumentResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1IndexdocumentResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexdocumentOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexdocumentOperation.java deleted file mode 100644 index 74413f99..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexdocumentOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.IndexDocumentRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexdocumentResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1IndexdocumentOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1IndexdocumentOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(IndexDocumentRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/indexdocument"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexdocument", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexdocument", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexdocument", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexdocument", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1IndexdocumentResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1IndexdocumentResponse.Builder resBuilder = - PostApiIndexV1IndexdocumentResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1IndexdocumentResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexdocuments.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexdocuments.java new file mode 100644 index 00000000..5a22dcd6 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexdocuments.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.IndexDocumentsRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexdocumentsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Indexdocuments { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(IndexDocumentsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/indexdocuments"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexdocuments", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexdocuments", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexdocuments", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(IndexDocumentsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1IndexdocumentsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1IndexdocumentsResponse.Builder resBuilder = + PostApiIndexV1IndexdocumentsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1IndexdocumentsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexdocumentsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexdocumentsOperation.java deleted file mode 100644 index 51864d0b..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexdocumentsOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.IndexDocumentsRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexdocumentsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1IndexdocumentsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1IndexdocumentsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(IndexDocumentsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/indexdocuments"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexdocuments", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexdocuments", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexdocuments", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexdocuments", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1IndexdocumentsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1IndexdocumentsResponse.Builder resBuilder = - PostApiIndexV1IndexdocumentsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1IndexdocumentsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexemployee.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexemployee.java new file mode 100644 index 00000000..92fe7e16 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexemployee.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.IndexEmployeeRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexemployeeResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Indexemployee { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(IndexEmployeeRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/indexemployee"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexemployee", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexemployee", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexemployee", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(IndexEmployeeRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1IndexemployeeResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1IndexemployeeResponse.Builder resBuilder = + PostApiIndexV1IndexemployeeResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1IndexemployeeResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexemployeeOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexemployeeOperation.java deleted file mode 100644 index 7076450a..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexemployeeOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.IndexEmployeeRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexemployeeResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1IndexemployeeOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1IndexemployeeOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(IndexEmployeeRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/indexemployee"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexemployee", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexemployee", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexemployee", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexemployee", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1IndexemployeeResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1IndexemployeeResponse.Builder resBuilder = - PostApiIndexV1IndexemployeeResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1IndexemployeeResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexgroup.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexgroup.java new file mode 100644 index 00000000..9f5c77e5 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexgroup.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.IndexGroupRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexgroupResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Indexgroup { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(IndexGroupRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/indexgroup"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexgroup", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexgroup", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexgroup", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(IndexGroupRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1IndexgroupResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1IndexgroupResponse.Builder resBuilder = + PostApiIndexV1IndexgroupResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1IndexgroupResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexgroupOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexgroupOperation.java deleted file mode 100644 index 2a64caf1..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexgroupOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.IndexGroupRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexgroupResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1IndexgroupOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1IndexgroupOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(IndexGroupRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/indexgroup"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexgroup", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexgroup", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexgroup", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexgroup", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1IndexgroupResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1IndexgroupResponse.Builder resBuilder = - PostApiIndexV1IndexgroupResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1IndexgroupResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexmembership.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexmembership.java new file mode 100644 index 00000000..2fb98253 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexmembership.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.IndexMembershipRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexmembershipResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Indexmembership { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(IndexMembershipRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/indexmembership"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexmembership", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexmembership", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexmembership", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(IndexMembershipRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1IndexmembershipResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1IndexmembershipResponse.Builder resBuilder = + PostApiIndexV1IndexmembershipResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1IndexmembershipResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexmembershipOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexmembershipOperation.java deleted file mode 100644 index 4238b10f..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexmembershipOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.IndexMembershipRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexmembershipResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1IndexmembershipOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1IndexmembershipOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(IndexMembershipRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/indexmembership"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexmembership", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexmembership", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexmembership", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexmembership", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1IndexmembershipResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1IndexmembershipResponse.Builder resBuilder = - PostApiIndexV1IndexmembershipResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1IndexmembershipResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexteam.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexteam.java new file mode 100644 index 00000000..d1fe8d7f --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexteam.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.IndexTeamRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexteamResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Indexteam { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(IndexTeamRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/indexteam"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexteam", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexteam", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexteam", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(IndexTeamRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1IndexteamResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1IndexteamResponse.Builder resBuilder = + PostApiIndexV1IndexteamResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1IndexteamResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexteamOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexteamOperation.java deleted file mode 100644 index bdbbbd70..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexteamOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.IndexTeamRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexteamResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1IndexteamOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1IndexteamOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(IndexTeamRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/indexteam"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexteam", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexteam", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexteam", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexteam", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1IndexteamResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1IndexteamResponse.Builder resBuilder = - PostApiIndexV1IndexteamResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1IndexteamResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexuser.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexuser.java new file mode 100644 index 00000000..b8bf3d69 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Indexuser.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.IndexUserRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexuserResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Indexuser { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(IndexUserRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/indexuser"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexuser", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexuser", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/indexuser", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(IndexUserRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1IndexuserResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1IndexuserResponse.Builder resBuilder = + PostApiIndexV1IndexuserResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1IndexuserResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexuserOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexuserOperation.java deleted file mode 100644 index a953e62c..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1IndexuserOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.IndexUserRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexuserResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1IndexuserOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1IndexuserOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(IndexUserRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/indexuser"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexuser", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexuser", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexuser", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/indexuser", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1IndexuserResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1IndexuserResponse.Builder resBuilder = - PostApiIndexV1IndexuserResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1IndexuserResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Processalldocuments.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Processalldocuments.java new file mode 100644 index 00000000..401d8b4e --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Processalldocuments.java @@ -0,0 +1,178 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.ProcessAllDocumentsRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1ProcessalldocumentsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Processalldocuments { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(Optional request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/processalldocuments"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference>() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/processalldocuments", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation, PostApiIndexV1ProcessalldocumentsResponse> { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/processalldocuments", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/processalldocuments", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(Optional request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1ProcessalldocumentsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1ProcessalldocumentsResponse.Builder resBuilder = + PostApiIndexV1ProcessalldocumentsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1ProcessalldocumentsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1ProcessalldocumentsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1ProcessalldocumentsOperation.java deleted file mode 100644 index 0f46371c..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1ProcessalldocumentsOperation.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.ProcessAllDocumentsRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1ProcessalldocumentsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1ProcessalldocumentsOperation implements RequestOperation, PostApiIndexV1ProcessalldocumentsResponse> { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1ProcessalldocumentsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(Optional request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/processalldocuments"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference>() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/processalldocuments", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/processalldocuments", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/processalldocuments", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/processalldocuments", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1ProcessalldocumentsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1ProcessalldocumentsResponse.Builder resBuilder = - PostApiIndexV1ProcessalldocumentsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1ProcessalldocumentsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Processallemployeesandteams.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Processallemployeesandteams.java new file mode 100644 index 00000000..2dd1667d --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Processallemployeesandteams.java @@ -0,0 +1,162 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestlessOperation; + +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.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1ProcessallemployeesandteamsResponse; +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.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.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Processallemployeesandteams { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest() throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/processallemployeesandteams"); + HTTPRequest req = new HTTPRequest(url, "POST"); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/processallemployeesandteams", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestlessOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/processallemployeesandteams", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/processallemployeesandteams", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest() throws Exception { + HttpRequest r = buildRequest(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1ProcessallemployeesandteamsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1ProcessallemployeesandteamsResponse.Builder resBuilder = + PostApiIndexV1ProcessallemployeesandteamsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1ProcessallemployeesandteamsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1ProcessallemployeesandteamsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1ProcessallemployeesandteamsOperation.java deleted file mode 100644 index b486ef91..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1ProcessallemployeesandteamsOperation.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestlessOperation; - -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.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1ProcessallemployeesandteamsResponse; -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.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.Utils; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1ProcessallemployeesandteamsOperation implements RequestlessOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1ProcessallemployeesandteamsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest() throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/processallemployeesandteams"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/processallemployeesandteams", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/processallemployeesandteams", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/processallemployeesandteams", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/processallemployeesandteams", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1ProcessallemployeesandteamsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1ProcessallemployeesandteamsResponse.Builder resBuilder = - PostApiIndexV1ProcessallemployeesandteamsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1ProcessallemployeesandteamsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Processallmemberships.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Processallmemberships.java new file mode 100644 index 00000000..5daab850 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Processallmemberships.java @@ -0,0 +1,178 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.ProcessAllMembershipsRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1ProcessallmembershipsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Processallmemberships { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(Optional request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/processallmemberships"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference>() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/processallmemberships", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation, PostApiIndexV1ProcessallmembershipsResponse> { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/processallmemberships", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/processallmemberships", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(Optional request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1ProcessallmembershipsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1ProcessallmembershipsResponse.Builder resBuilder = + PostApiIndexV1ProcessallmembershipsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1ProcessallmembershipsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1ProcessallmembershipsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1ProcessallmembershipsOperation.java deleted file mode 100644 index 0490fc17..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1ProcessallmembershipsOperation.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.ProcessAllMembershipsRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1ProcessallmembershipsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1ProcessallmembershipsOperation implements RequestOperation, PostApiIndexV1ProcessallmembershipsResponse> { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1ProcessallmembershipsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(Optional request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/processallmemberships"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference>() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/processallmemberships", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/processallmemberships", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/processallmemberships", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/processallmemberships", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1ProcessallmembershipsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1ProcessallmembershipsResponse.Builder resBuilder = - PostApiIndexV1ProcessallmembershipsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1ProcessallmembershipsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Rotatetoken.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Rotatetoken.java new file mode 100644 index 00000000..840cd430 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Rotatetoken.java @@ -0,0 +1,176 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestlessOperation; + +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.RotateTokenResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1RotatetokenResponse; +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.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.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Rotatetoken { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest() throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/rotatetoken"); + HTTPRequest req = new HTTPRequest(url, "POST"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/rotatetoken", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestlessOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/rotatetoken", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/rotatetoken", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest() throws Exception { + HttpRequest r = buildRequest(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1RotatetokenResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1RotatetokenResponse.Builder resBuilder = + PostApiIndexV1RotatetokenResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1RotatetokenResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + RotateTokenResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withRotateTokenResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1RotatetokenOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1RotatetokenOperation.java deleted file mode 100644 index 21250ed3..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1RotatetokenOperation.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestlessOperation; - -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.RotateTokenResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1RotatetokenResponse; -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.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.Utils; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1RotatetokenOperation implements RequestlessOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1RotatetokenOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest() throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/rotatetoken"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/rotatetoken", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/rotatetoken", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/rotatetoken", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/rotatetoken", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1RotatetokenResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1RotatetokenResponse.Builder resBuilder = - PostApiIndexV1RotatetokenResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1RotatetokenResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - RotateTokenResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withRotateTokenResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Updatepermissions.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Updatepermissions.java new file mode 100644 index 00000000..881386c9 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Updatepermissions.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.UpdatePermissionsRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1UpdatepermissionsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Updatepermissions { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(UpdatePermissionsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/updatepermissions"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/updatepermissions", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/updatepermissions", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/updatepermissions", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(UpdatePermissionsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1UpdatepermissionsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1UpdatepermissionsResponse.Builder resBuilder = + PostApiIndexV1UpdatepermissionsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1UpdatepermissionsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1UpdatepermissionsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1UpdatepermissionsOperation.java deleted file mode 100644 index 3e7fe1c7..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1UpdatepermissionsOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.UpdatePermissionsRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1UpdatepermissionsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1UpdatepermissionsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1UpdatepermissionsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(UpdatePermissionsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/updatepermissions"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/updatepermissions", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/updatepermissions", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/updatepermissions", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/updatepermissions", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1UpdatepermissionsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1UpdatepermissionsResponse.Builder resBuilder = - PostApiIndexV1UpdatepermissionsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1UpdatepermissionsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Uploadshortcuts.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Uploadshortcuts.java new file mode 100644 index 00000000..a4fc2678 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1Uploadshortcuts.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.UploadShortcutsRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1UploadshortcutsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostApiIndexV1Uploadshortcuts { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(UploadShortcutsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/api/index/v1/uploadshortcuts"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/uploadshortcuts", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/uploadshortcuts", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/api/index/v1/uploadshortcuts", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(UploadShortcutsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostApiIndexV1UploadshortcutsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostApiIndexV1UploadshortcutsResponse.Builder resBuilder = + PostApiIndexV1UploadshortcutsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostApiIndexV1UploadshortcutsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1UploadshortcutsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1UploadshortcutsOperation.java deleted file mode 100644 index 5fa2a4aa..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostApiIndexV1UploadshortcutsOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.UploadShortcutsRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1UploadshortcutsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostApiIndexV1UploadshortcutsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostApiIndexV1UploadshortcutsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(UploadShortcutsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/api/index/v1/uploadshortcuts"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/uploadshortcuts", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "409", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/uploadshortcuts", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/uploadshortcuts", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/api/index/v1/uploadshortcuts", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostApiIndexV1UploadshortcutsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostApiIndexV1UploadshortcutsResponse.Builder resBuilder = - PostApiIndexV1UploadshortcutsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostApiIndexV1UploadshortcutsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "409", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostRestApiV1ToolsCall.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostRestApiV1ToolsCall.java new file mode 100644 index 00000000..51a0a9f6 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/PostRestApiV1ToolsCall.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.ToolsCallRequest; +import com.glean.api_client.glean_api_client.models.components.ToolsCallResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.PostRestApiV1ToolsCallResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class PostRestApiV1ToolsCall { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(ToolsCallRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/tools/call"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/rest/api/v1/tools/call", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/rest/api/v1/tools/call", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "post_/rest/api/v1/tools/call", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(ToolsCallRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "404", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public PostRestApiV1ToolsCallResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + PostRestApiV1ToolsCallResponse.Builder resBuilder = + PostRestApiV1ToolsCallResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + PostRestApiV1ToolsCallResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + ToolsCallResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withToolsCallResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "404", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/PostRestApiV1ToolsCallOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/PostRestApiV1ToolsCallOperation.java deleted file mode 100644 index 85b9478e..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/PostRestApiV1ToolsCallOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.ToolsCallRequest; -import com.glean.api_client.glean_api_client.models.components.ToolsCallResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.PostRestApiV1ToolsCallResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class PostRestApiV1ToolsCallOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public PostRestApiV1ToolsCallOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(ToolsCallRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/tools/call"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/rest/api/v1/tools/call", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "404", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/rest/api/v1/tools/call", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/rest/api/v1/tools/call", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "post_/rest/api/v1/tools/call", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public PostRestApiV1ToolsCallResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - PostRestApiV1ToolsCallResponse.Builder resBuilder = - PostRestApiV1ToolsCallResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - PostRestApiV1ToolsCallResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - ToolsCallResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withToolsCallResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "404", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Recommendations.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Recommendations.java new file mode 100644 index 00000000..27621270 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Recommendations.java @@ -0,0 +1,199 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.RecommendationsRequest; +import com.glean.api_client.glean_api_client.models.components.ResultsResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.RecommendationsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Recommendations { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(RecommendationsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/recommendations"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "recommendations", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "recommendations", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "recommendations", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(RecommendationsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public RecommendationsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + RecommendationsResponse.Builder resBuilder = + RecommendationsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + RecommendationsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + ResultsResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withResultsResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "202", "204")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/RecommendationsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/RecommendationsOperation.java deleted file mode 100644 index 181fa08c..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/RecommendationsOperation.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.RecommendationsRequest; -import com.glean.api_client.glean_api_client.models.components.ResultsResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.RecommendationsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class RecommendationsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public RecommendationsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(RecommendationsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/recommendations"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "recommendations", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "recommendations", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "recommendations", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "recommendations", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public RecommendationsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - RecommendationsResponse.Builder resBuilder = - RecommendationsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - RecommendationsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - ResultsResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withResultsResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "202", "204")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Search.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Search.java new file mode 100644 index 00000000..43612be1 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Search.java @@ -0,0 +1,210 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.SearchRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.errors.GleanDataError; +import com.glean.api_client.glean_api_client.models.operations.SearchResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Search { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(SearchRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/search"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "search", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "search", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "search", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(SearchRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "408", "422", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public SearchResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + SearchResponse.Builder resBuilder = + SearchResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + SearchResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + com.glean.api_client.glean_api_client.models.components.SearchResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withSearchResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "403", "422")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + GleanDataError out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + throw out; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "408", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/SearchAgents.java b/src/main/java/com/glean/api_client/glean_api_client/operations/SearchAgents.java new file mode 100644 index 00000000..3959464d --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/SearchAgents.java @@ -0,0 +1,193 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.SearchAgentsRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.SearchAgentsResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class SearchAgents { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(SearchAgentsRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/agents/search"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "searchAgents", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "searchAgents", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "searchAgents", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(SearchAgentsRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "403", "404", "422", "4XX", "500", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public SearchAgentsResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + SearchAgentsResponse.Builder resBuilder = + SearchAgentsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + SearchAgentsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + com.glean.api_client.glean_api_client.models.components.SearchAgentsResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withSearchAgentsResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404", "422", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/SearchAgentsOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/SearchAgentsOperation.java deleted file mode 100644 index cf6d88ee..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/SearchAgentsOperation.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.SearchAgentsRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.SearchAgentsResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class SearchAgentsOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public SearchAgentsOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(SearchAgentsRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/agents/search"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "searchAgents", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "403", "404", "422", "4XX", "500", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "searchAgents", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "searchAgents", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "searchAgents", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public SearchAgentsResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - SearchAgentsResponse.Builder resBuilder = - SearchAgentsResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - SearchAgentsResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - com.glean.api_client.glean_api_client.models.components.SearchAgentsResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withSearchAgentsResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404", "422", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/SearchOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/SearchOperation.java deleted file mode 100644 index 8e5156d2..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/SearchOperation.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.SearchRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.errors.GleanDataError; -import com.glean.api_client.glean_api_client.models.operations.SearchResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class SearchOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public SearchOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(SearchRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/search"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "search", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "408", "422", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "search", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "search", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "search", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public SearchResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - SearchResponse.Builder resBuilder = - SearchResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - SearchResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - com.glean.api_client.glean_api_client.models.components.SearchResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withSearchResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "403", "422")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - GleanDataError out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "408", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Setdocvisibility.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Setdocvisibility.java new file mode 100644 index 00000000..e4600295 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Setdocvisibility.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.UpdateDocumentVisibilityOverridesRequest; +import com.glean.api_client.glean_api_client.models.components.UpdateDocumentVisibilityOverridesResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.SetdocvisibilityResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Setdocvisibility { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(UpdateDocumentVisibilityOverridesRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/governance/documents/visibilityoverrides"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json; charset=UTF-8") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "setdocvisibility", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "setdocvisibility", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "setdocvisibility", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(UpdateDocumentVisibilityOverridesRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public SetdocvisibilityResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + SetdocvisibilityResponse.Builder resBuilder = + SetdocvisibilityResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + SetdocvisibilityResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { + UpdateDocumentVisibilityOverridesResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withUpdateDocumentVisibilityOverridesResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/SetdocvisibilityOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/SetdocvisibilityOperation.java deleted file mode 100644 index 693e821a..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/SetdocvisibilityOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.UpdateDocumentVisibilityOverridesRequest; -import com.glean.api_client.glean_api_client.models.components.UpdateDocumentVisibilityOverridesResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.SetdocvisibilityResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class SetdocvisibilityOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public SetdocvisibilityOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(UpdateDocumentVisibilityOverridesRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/governance/documents/visibilityoverrides"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json; charset=UTF-8") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "setdocvisibility", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "setdocvisibility", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "setdocvisibility", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "setdocvisibility", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public SetdocvisibilityResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - SetdocvisibilityResponse.Builder resBuilder = - SetdocvisibilityResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - SetdocvisibilityResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { - UpdateDocumentVisibilityOverridesResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withUpdateDocumentVisibilityOverridesResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Summarize.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Summarize.java new file mode 100644 index 00000000..63aac21f --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Summarize.java @@ -0,0 +1,193 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.SummarizeRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.SummarizeResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Summarize { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(SummarizeRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/summarize"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "summarize", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "summarize", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "summarize", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(SummarizeRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public SummarizeResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + SummarizeResponse.Builder resBuilder = + SummarizeResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + SummarizeResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + com.glean.api_client.glean_api_client.models.components.SummarizeResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withSummarizeResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/SummarizeOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/SummarizeOperation.java deleted file mode 100644 index df9e8c06..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/SummarizeOperation.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.SummarizeRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.SummarizeResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class SummarizeOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public SummarizeOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(SummarizeRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/summarize"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "summarize", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "summarize", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "summarize", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "summarize", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public SummarizeResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - SummarizeResponse.Builder resBuilder = - SummarizeResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - SummarizeResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - com.glean.api_client.glean_api_client.models.components.SummarizeResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withSummarizeResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Unpin.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Unpin.java new file mode 100644 index 00000000..00b4a103 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Unpin.java @@ -0,0 +1,180 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.UnpinResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Unpin { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(com.glean.api_client.glean_api_client.models.components.Unpin request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/unpin"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "*/*") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "unpin", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "unpin", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "unpin", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(com.glean.api_client.glean_api_client.models.components.Unpin request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public UnpinResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + UnpinResponse.Builder resBuilder = + UnpinResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + UnpinResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + // no content + return res; + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/UnpinOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/UnpinOperation.java deleted file mode 100644 index f7dcf898..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/UnpinOperation.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.Unpin; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.UnpinResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class UnpinOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public UnpinOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(Unpin request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/unpin"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "*/*") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "unpin", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "unpin", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "unpin", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "unpin", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public UnpinResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - UnpinResponse.Builder resBuilder = - UnpinResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - UnpinResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - // no content - return res; - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Updateannouncement.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Updateannouncement.java new file mode 100644 index 00000000..69d918b6 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Updateannouncement.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.Announcement; +import com.glean.api_client.glean_api_client.models.components.UpdateAnnouncementRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.UpdateannouncementResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Updateannouncement { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(UpdateAnnouncementRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/updateannouncement"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateannouncement", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateannouncement", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateannouncement", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(UpdateAnnouncementRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public UpdateannouncementResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + UpdateannouncementResponse.Builder resBuilder = + UpdateannouncementResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + UpdateannouncementResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + Announcement out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withAnnouncement(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/UpdateannouncementOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/UpdateannouncementOperation.java deleted file mode 100644 index b7c6cf53..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/UpdateannouncementOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.Announcement; -import com.glean.api_client.glean_api_client.models.components.UpdateAnnouncementRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.UpdateannouncementResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class UpdateannouncementOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public UpdateannouncementOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(UpdateAnnouncementRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/updateannouncement"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "updateannouncement", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "updateannouncement", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "updateannouncement", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "updateannouncement", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public UpdateannouncementResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - UpdateannouncementResponse.Builder resBuilder = - UpdateannouncementResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - UpdateannouncementResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - Announcement out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withAnnouncement(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Updatepolicy.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Updatepolicy.java new file mode 100644 index 00000000..1b542e52 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Updatepolicy.java @@ -0,0 +1,196 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.UpdateDlpReportResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.UpdatepolicyRequest; +import com.glean.api_client.glean_api_client.models.operations.UpdatepolicyResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Updatepolicy { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(UpdatepolicyRequest request) throws Exception { + String url = Utils.generateURL( + UpdatepolicyRequest.class, + this.baseUrl, + "/rest/api/v1/governance/data/policies/{id}", + request, null); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "updateDlpReportRequest", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json; charset=UTF-8") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updatepolicy", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updatepolicy", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updatepolicy", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(UpdatepolicyRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public UpdatepolicyResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + UpdatepolicyResponse.Builder resBuilder = + UpdatepolicyResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + UpdatepolicyResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { + UpdateDlpReportResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withUpdateDlpReportResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/UpdatepolicyOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/UpdatepolicyOperation.java deleted file mode 100644 index 44f881c8..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/UpdatepolicyOperation.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.UpdateDlpReportResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.UpdatepolicyRequest; -import com.glean.api_client.glean_api_client.models.operations.UpdatepolicyResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class UpdatepolicyOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public UpdatepolicyOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(UpdatepolicyRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - UpdatepolicyRequest.class, - baseUrl, - "/rest/api/v1/governance/data/policies/{id}", - request, null); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "updateDlpReportRequest", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json; charset=UTF-8") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "updatepolicy", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "403", "4XX", "500", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "updatepolicy", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "updatepolicy", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "updatepolicy", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public UpdatepolicyResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - UpdatepolicyResponse.Builder resBuilder = - UpdatepolicyResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - UpdatepolicyResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json; charset=UTF-8")) { - UpdateDlpReportResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withUpdateDlpReportResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "403", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "500", "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Updateshortcut.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Updateshortcut.java new file mode 100644 index 00000000..af9d1015 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Updateshortcut.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.UpdateShortcutRequest; +import com.glean.api_client.glean_api_client.models.components.UpdateShortcutResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.UpdateshortcutResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Updateshortcut { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(UpdateShortcutRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/updateshortcut"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateshortcut", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateshortcut", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateshortcut", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(UpdateShortcutRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public UpdateshortcutResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + UpdateshortcutResponse.Builder resBuilder = + UpdateshortcutResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + UpdateshortcutResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + UpdateShortcutResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withUpdateShortcutResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/UpdateshortcutOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/UpdateshortcutOperation.java deleted file mode 100644 index 4b512236..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/UpdateshortcutOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.UpdateShortcutRequest; -import com.glean.api_client.glean_api_client.models.components.UpdateShortcutResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.UpdateshortcutResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class UpdateshortcutOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public UpdateshortcutOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(UpdateShortcutRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/updateshortcut"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "updateshortcut", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "updateshortcut", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "updateshortcut", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "updateshortcut", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public UpdateshortcutResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - UpdateshortcutResponse.Builder resBuilder = - UpdateshortcutResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - UpdateshortcutResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - UpdateShortcutResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withUpdateShortcutResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Uploadchatfiles.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Uploadchatfiles.java new file mode 100644 index 00000000..86f1ff60 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Uploadchatfiles.java @@ -0,0 +1,199 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.UploadChatFilesResponse; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.UploadchatfilesRequest; +import com.glean.api_client.glean_api_client.models.operations.UploadchatfilesResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Uploadchatfiles { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(UploadchatfilesRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/uploadchatfiles"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "uploadChatFilesRequest", + "multipart", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + req.addQueryParams(Utils.getQueryParams( + UploadchatfilesRequest.class, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "uploadchatfiles", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "uploadchatfiles", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "uploadchatfiles", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(UploadchatfilesRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public UploadchatfilesResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + UploadchatfilesResponse.Builder resBuilder = + UploadchatfilesResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + UploadchatfilesResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + UploadChatFilesResponse out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withUploadChatFilesResponse(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/UploadchatfilesOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/UploadchatfilesOperation.java deleted file mode 100644 index 13f9ecc6..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/UploadchatfilesOperation.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.UploadChatFilesResponse; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.UploadchatfilesRequest; -import com.glean.api_client.glean_api_client.models.operations.UploadchatfilesResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class UploadchatfilesOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public UploadchatfilesOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(UploadchatfilesRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/uploadchatfiles"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "uploadChatFilesRequest", - "multipart", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - req.addQueryParams(Utils.getQueryParams( - UploadchatfilesRequest.class, - request, - null)); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "uploadchatfiles", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "uploadchatfiles", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "uploadchatfiles", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "uploadchatfiles", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public UploadchatfilesResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - UploadchatfilesResponse.Builder resBuilder = - UploadchatfilesResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - UploadchatfilesResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - UploadChatFilesResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withUploadChatFilesResponse(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/Verify.java b/src/main/java/com/glean/api_client/glean_api_client/operations/Verify.java new file mode 100644 index 00000000..92eaa086 --- /dev/null +++ b/src/main/java/com/glean/api_client/glean_api_client/operations/Verify.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.glean.api_client.glean_api_client.operations; + +import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; + +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.Verification; +import com.glean.api_client.glean_api_client.models.components.VerifyRequest; +import com.glean.api_client.glean_api_client.models.errors.APIException; +import com.glean.api_client.glean_api_client.models.operations.VerifyResponse; +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.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.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; + + + +public class Verify { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + + public Base(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + 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); + } + + HttpRequest buildRequest(VerifyRequest request) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/rest/api/v1/verify"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() { + }); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return sdkConfiguration.hooks().beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "verify", + java.util.Optional.of(java.util.List.of()), + securitySource()), + req.build()); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration) { + super(sdkConfiguration); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "verify", + java.util.Optional.of(java.util.List.of()), + securitySource()), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "verify", + java.util.Optional.of(java.util.List.of()), + securitySource()), + response); + } + + @Override + public HttpResponse doRequest(VerifyRequest request) throws Exception { + HttpRequest r = buildRequest(request); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = onError(null, e); + } + + return httpRes; + } + + + @Override + public VerifyResponse handleResponse(HttpResponse response) throws Exception { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + VerifyResponse.Builder resBuilder = + VerifyResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + VerifyResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + Verification out = Utils.mapper().readValue( + response.body(), + new TypeReference<>() { + }); + res.withVerification(out); + return res; + } else { + throw new APIException( + response, + response.statusCode(), + "Unexpected content-type received: " + contentType, + Utils.extractByteArrayFromBody(response)); + } + } + + if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw new APIException( + response, + response.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(response)); + } + + throw new APIException( + response, + response.statusCode(), + "Unexpected status code received: " + response.statusCode(), + Utils.extractByteArrayFromBody(response)); + } + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/operations/VerifyOperation.java b/src/main/java/com/glean/api_client/glean_api_client/operations/VerifyOperation.java deleted file mode 100644 index fe0ad284..00000000 --- a/src/main/java/com/glean/api_client/glean_api_client/operations/VerifyOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.glean.api_client.glean_api_client.operations; - -import static com.glean.api_client.glean_api_client.operations.Operations.RequestOperation; - -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.Verification; -import com.glean.api_client.glean_api_client.models.components.VerifyRequest; -import com.glean.api_client.glean_api_client.models.errors.APIException; -import com.glean.api_client.glean_api_client.models.operations.VerifyResponse; -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.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.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.Optional; - - -public class VerifyOperation implements RequestOperation { - - private final SDKConfiguration sdkConfiguration; - - public VerifyOperation(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; - } - - @Override - public HttpResponse doRequest(VerifyRequest request) throws Exception { - String baseUrl = Utils.templateUrl( - this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); - String url = Utils.generateURL( - baseUrl, - "/rest/api/v1/verify"); - - HTTPRequest req = new HTTPRequest(url, "POST"); - Object convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = Utils.serializeRequestBody( - convertedRequest, - "request", - "json", - false); - if (serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - req.setBody(Optional.ofNullable(serializedRequestBody)); - req.addHeader("Accept", "application/json") - .addHeader("user-agent", - SDKConfiguration.USER_AGENT); - - Optional hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); - Utils.configureSecurity(req, - this.sdkConfiguration.securitySource().getSecurity()); - HTTPClient client = this.sdkConfiguration.client(); - HttpRequest r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - this.sdkConfiguration, - baseUrl, - "verify", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - req.build()); - HttpResponse httpRes; - try { - httpRes = client.send(r); - if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "429", "4XX", "5XX")) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "verify", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.of(httpRes), - Optional.empty()); - } else { - httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - this.sdkConfiguration, - baseUrl, - "verify", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - httpRes); - } - } catch (Exception e) { - httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - this.sdkConfiguration, - baseUrl, - "verify", - java.util.Optional.of(java.util.List.of()), - hookSecuritySource), - Optional.empty(), - Optional.of(e)); - } - - return httpRes; - } - - @Override - public VerifyResponse handleResponse(HttpResponse response) throws Exception { - String contentType = response - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - VerifyResponse.Builder resBuilder = - VerifyResponse - .builder() - .contentType(contentType) - .statusCode(response.statusCode()) - .rawResponse(response); - - VerifyResponse res = resBuilder.build(); - - if (Utils.statusCodeMatches(response.statusCode(), "200")) { - if (Utils.contentTypeMatches(contentType, "application/json")) { - Verification out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withVerification(out); - return res; - } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); - } - } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "403", "429", "4XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { - // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); - } - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); - } -} diff --git a/src/main/java/com/glean/api_client/glean_api_client/utils/Exceptions.java b/src/main/java/com/glean/api_client/glean_api_client/utils/Exceptions.java index 781ffd38..680a9253 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/utils/Exceptions.java +++ b/src/main/java/com/glean/api_client/glean_api_client/utils/Exceptions.java @@ -9,6 +9,14 @@ import java.io.UncheckedIOException; public class Exceptions { + public static Exception coerceException(Throwable throwable) { + if (throwable instanceof Exception) { + return (Exception) throwable; + } + + return new Exception(throwable); + } + public static RuntimeException unchecked(Throwable t) { if (t instanceof RuntimeException) { return (RuntimeException) t; diff --git a/src/main/java/com/glean/api_client/glean_api_client/utils/HTTPClient.java b/src/main/java/com/glean/api_client/glean_api_client/utils/HTTPClient.java index 8f1f91b1..0ab42b55 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/utils/HTTPClient.java +++ b/src/main/java/com/glean/api_client/glean_api_client/utils/HTTPClient.java @@ -6,28 +6,34 @@ import java.io.IOException; import java.io.InputStream; import java.net.URISyntaxException; -import java.net.http.HttpResponse; +import java.net.http.HttpClient; import java.net.http.HttpRequest; +import java.net.http.HttpResponse; public interface HTTPClient { + HttpClient client = HttpClient.newHttpClient(); /** * Sends an HTTP request and returns the response. - * - *

Note that {@link HttpRequest} is immutable. To modify the request you can use - * {@code HttpRequest#newBuilder(HttpRequest, BiPredicate)} with - * JDK 16 and later (which will copy the request for modification in a builder). - * If that method is not available then use {@link Helpers#copy} (which also returns - * a builder). - * + * + *

+ * Note that {@link HttpRequest} is immutable. To modify the request you can + * use + * {@code HttpRequest#newBuilder(HttpRequest, BiPredicate)} + * with JDK 16 and later (which will copy the request for modification in a + * builder). If that method is not available then use {@link Helpers#copy} + * (which also returns a builder). + * * @param request HTTP request * @return HTTP response * @throws IOException * @throws InterruptedException * @throws URISyntaxException - */ - HttpResponse send(HttpRequest request) - throws IOException, InterruptedException, URISyntaxException; + */ + default HttpResponse send(HttpRequest request) + throws IOException, InterruptedException, URISyntaxException { + return client.send(request, HttpResponse.BodyHandlers.ofInputStream()); + } /** * Controls the debug flag that can be used by clients to perform conditional diff --git a/src/main/java/com/glean/api_client/glean_api_client/utils/Hooks.java b/src/main/java/com/glean/api_client/glean_api_client/utils/Hooks.java index 257ab96b..90e8c5b5 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/utils/Hooks.java +++ b/src/main/java/com/glean/api_client/glean_api_client/utils/Hooks.java @@ -27,7 +27,7 @@ * For example, this code will add a transaction id header to every request: * *

- * hooks.registerBeforeRequest((context, request) -> {
+ * hooks.registerBeforeRequest((context, request) -> {
  *     request.headers().map().put("acme-transaction-id", nextTransactionId());
  *     return request;
  * });
diff --git a/src/main/java/com/glean/api_client/glean_api_client/utils/ResponseWithBody.java b/src/main/java/com/glean/api_client/glean_api_client/utils/ResponseWithBody.java
new file mode 100644
index 00000000..478f0f3f
--- /dev/null
+++ b/src/main/java/com/glean/api_client/glean_api_client/utils/ResponseWithBody.java
@@ -0,0 +1,82 @@
+/* 
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.glean.api_client.glean_api_client.utils;
+
+import javax.net.ssl.SSLSession;
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpHeaders;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.util.Optional;
+import java.util.function.Function;
+
+/**
+ * A wrapper for {@link HttpResponse} that allows mappi ng the response body from type {@code R} to type {@code B}.
+ * 

+ * This class delegates all methods to the original response, except for {@link #body()}, which returns the mapped body. + * The mapping is performed using the provided {@code bodyMapper} function at construction time. + * + * @param the type of the original response body + * @param the type of the mapped response body + */ +public class ResponseWithBody implements HttpResponse { + private final HttpResponse original; + private final Function bodyMapper; + private final B body; + + /** + * Constructs a new {@code ResponseWithBody} by wrapping an existing {@link HttpResponse} and applying + * a mapping function to its body. + * + * @param original the original response to wrap + * @param bodyMapper a function to map the original body to the new body type + */ + public ResponseWithBody(HttpResponse original, Function bodyMapper) { + this.original = original; + this.bodyMapper = bodyMapper; + this.body = bodyMapper.apply(original.body()); + } + + @Override + public int statusCode() { + return original.statusCode(); + } + + @Override + public HttpRequest request() { + return original.request(); + } + + @Override + public Optional> previousResponse() { + return original.previousResponse() + .map(prev -> new ResponseWithBody<>(prev, bodyMapper)); + } + + @Override + public HttpHeaders headers() { + return original.headers(); + } + + @Override + public B body() { + return body; + } + + @Override + public Optional sslSession() { + return original.sslSession(); + } + + @Override + public URI uri() { + return original.uri(); + } + + @Override + public HttpClient.Version version() { + return original.version(); + } +} diff --git a/src/main/java/com/glean/api_client/glean_api_client/utils/Retries.java b/src/main/java/com/glean/api_client/glean_api_client/utils/Retries.java index aa746b06..5e456d47 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/utils/Retries.java +++ b/src/main/java/com/glean/api_client/glean_api_client/utils/Retries.java @@ -31,7 +31,7 @@ private Retries( this.retryConfig = retryConfig; this.statusCodes = statusCodes; } - + @SuppressWarnings("serial") public static final class NonRetryableException extends Exception { private final Exception exception; diff --git a/src/main/java/com/glean/api_client/glean_api_client/utils/SpeakeasyHTTPClient.java b/src/main/java/com/glean/api_client/glean_api_client/utils/SpeakeasyHTTPClient.java index 16387152..2cd3832c 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/utils/SpeakeasyHTTPClient.java +++ b/src/main/java/com/glean/api_client/glean_api_client/utils/SpeakeasyHTTPClient.java @@ -18,6 +18,7 @@ import java.util.Set; import java.util.function.Consumer; import java.util.stream.Collectors; +import java.util.concurrent.CompletableFuture; public class SpeakeasyHTTPClient implements HTTPClient { @@ -79,7 +80,7 @@ public static void setRedactedHeaders(Collection headerNames) { .map(x -> x.toUpperCase(Locale.ENGLISH)) // .collect(Collectors.toSet()); } - + public static void setLogger(Consumer logger) { SpeakeasyHTTPClient.logger = logger; } diff --git a/src/main/java/com/glean/api_client/glean_api_client/utils/Utils.java b/src/main/java/com/glean/api_client/glean_api_client/utils/Utils.java index 4a56783b..2cb42909 100644 --- a/src/main/java/com/glean/api_client/glean_api_client/utils/Utils.java +++ b/src/main/java/com/glean/api_client/glean_api_client/utils/Utils.java @@ -52,6 +52,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import java.util.stream.StreamSupport; +import java.util.concurrent.CompletableFuture; import javax.net.ssl.SSLSession; diff --git a/src/test/java/com/glean/api_client/glean_api_client/ClientChatTests.java b/src/test/java/com/glean/api_client/glean_api_client/ClientChatTests.java index 6a777d66..3386e356 100644 --- a/src/test/java/com/glean/api_client/glean_api_client/ClientChatTests.java +++ b/src/test/java/com/glean/api_client/glean_api_client/ClientChatTests.java @@ -1900,6 +1900,7 @@ public void testClientChat_ChatStreamDefaultExample() throws Exception { .chatRequest(ChatRequest.builder() .messages(List.of( ChatMessage.builder() + .author(Author.USER) .fragments(List.of( ChatMessageFragment.builder() .text("What are the company holidays this year?") @@ -1927,6 +1928,7 @@ public void testClientChat_ChatStreamGptAgentExample() throws Exception { .chatRequest(ChatRequest.builder() .messages(List.of( ChatMessage.builder() + .author(Author.USER) .fragments(List.of( ChatMessageFragment.builder() .text("Who was the first person to land on the moon?") @@ -1979,6 +1981,7 @@ public void testClientChat_ChatStreamUpdateResponse() throws Exception { .chatRequest(ChatRequest.builder() .messages(List.of( ChatMessage.builder() + .author(Author.USER) .citations(List.of( ChatMessageCitation.builder() .sourceDocument(Document.builder() @@ -4048,6 +4051,7 @@ public void testClientChat_ChatStreamUpdateResponse() throws Exception { .build())) .build(), ChatMessage.builder() + .author(Author.USER) .citations(List.of( ChatMessageCitation.builder() .sourceDocument(Document.builder() @@ -6169,6 +6173,7 @@ public void testClientChat_ChatStreamCitationResponse() throws Exception { .chatRequest(ChatRequest.builder() .messages(List.of( ChatMessage.builder() + .author(Author.USER) .citations(List.of( ChatMessageCitation.builder() .sourceDocument(Document.builder() @@ -8071,6 +8076,7 @@ public void testClientChat_ChatStreamCitationResponse() throws Exception { .build())) .build(), ChatMessage.builder() + .author(Author.USER) .citations(List.of( ChatMessageCitation.builder() .sourceDocument(Document.builder() @@ -9105,6 +9111,7 @@ public void testClientChat_ChatStreamCitationResponse() throws Exception { .build())) .build(), ChatMessage.builder() + .author(Author.USER) .citations(List.of( ChatMessageCitation.builder() .sourceDocument(Document.builder() diff --git a/tests/mockserver/internal/sdk/models/components/authconfig.go b/tests/mockserver/internal/sdk/models/components/authconfig.go index 1cecca52..23774105 100644 --- a/tests/mockserver/internal/sdk/models/components/authconfig.go +++ b/tests/mockserver/internal/sdk/models/components/authconfig.go @@ -85,6 +85,7 @@ type AuthConfigStatus string const ( AuthConfigStatusAwaitingAuth AuthConfigStatus = "AWAITING_AUTH" AuthConfigStatusAuthorized AuthConfigStatus = "AUTHORIZED" + AuthConfigStatusAuthDisabled AuthConfigStatus = "AUTH_DISABLED" ) func (e AuthConfigStatus) ToPointer() *AuthConfigStatus { @@ -99,6 +100,8 @@ func (e *AuthConfigStatus) UnmarshalJSON(data []byte) error { case "AWAITING_AUTH": fallthrough case "AUTHORIZED": + fallthrough + case "AUTH_DISABLED": *e = AuthConfigStatus(v) return nil default: diff --git a/tests/mockserver/internal/sdk/models/components/chatmessage.go b/tests/mockserver/internal/sdk/models/components/chatmessage.go index 01c82979..493da20d 100644 --- a/tests/mockserver/internal/sdk/models/components/chatmessage.go +++ b/tests/mockserver/internal/sdk/models/components/chatmessage.go @@ -83,7 +83,7 @@ func (e *MessageType) UnmarshalJSON(data []byte) error { type ChatMessage struct { // Describes the agent that executes the request. AgentConfig *AgentConfig `json:"agentConfig,omitempty"` - Author *Author `default:"USER" json:"author"` + Author *Author `default:"GLEAN_AI" json:"author"` // A list of Citations that were used to generate the response. Citations []ChatMessageCitation `json:"citations,omitempty"` // IDs of files uploaded in the message that are referenced to generate the answer. diff --git a/tests/mockserver/internal/sdk/models/components/chatmessagefragment.go b/tests/mockserver/internal/sdk/models/components/chatmessagefragment.go index e164fc2d..e153531a 100644 --- a/tests/mockserver/internal/sdk/models/components/chatmessagefragment.go +++ b/tests/mockserver/internal/sdk/models/components/chatmessagefragment.go @@ -13,6 +13,8 @@ type ChatMessageFragment struct { // Structure for file uploaded by a user for Chat. File *ChatFile `json:"file,omitempty"` Action *ToolInfo `json:"action,omitempty"` + // Information about the source for a ChatMessage. + Citation *ChatMessageCitation `json:"citation,omitempty"` } func (o *ChatMessageFragment) GetStructuredResults() []StructuredResult { @@ -56,3 +58,10 @@ func (o *ChatMessageFragment) GetAction() *ToolInfo { } return o.Action } + +func (o *ChatMessageFragment) GetCitation() *ChatMessageCitation { + if o == nil { + return nil + } + return o.Citation +} diff --git a/tests/mockserver/internal/sdk/models/components/chatrequest.go b/tests/mockserver/internal/sdk/models/components/chatrequest.go index 28474404..d26c7a1c 100644 --- a/tests/mockserver/internal/sdk/models/components/chatrequest.go +++ b/tests/mockserver/internal/sdk/models/components/chatrequest.go @@ -7,7 +7,7 @@ type ChatRequest struct { SaveChat *bool `json:"saveChat,omitempty"` // The id of the Chat that context should be retrieved from and messages added to. An empty id starts a new Chat, and the Chat is saved if saveChat is true. ChatID *string `json:"chatId,omitempty"` - // A list of chat messages, from most recent to least recent. It can be assumed that the first chat message in the list is the user's most recent query. + // A list of chat messages, from most recent to least recent. At least one message must specify a USER author. Messages []ChatMessage `json:"messages"` // Describes the agent that executes the request. AgentConfig *AgentConfig `json:"agentConfig,omitempty"` diff --git a/tests/mockserver/internal/sdk/models/components/documentdefinition.go b/tests/mockserver/internal/sdk/models/components/documentdefinition.go index d4e073eb..b0bbd077 100644 --- a/tests/mockserver/internal/sdk/models/components/documentdefinition.go +++ b/tests/mockserver/internal/sdk/models/components/documentdefinition.go @@ -47,7 +47,7 @@ type DocumentDefinition struct { AdditionalUrls []string `json:"additionalUrls,omitempty"` // Comments associated with the document. Comments []CommentDefinition `json:"comments,omitempty"` - // Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/docs/facets_and_operators_for_custom_datasources/). + // Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/indexing/datasource/custom-properties/operators_and_facets). CustomProperties []CustomProperty `json:"customProperties,omitempty"` } diff --git a/tests/mockserver/internal/sdk/models/components/feedback.go b/tests/mockserver/internal/sdk/models/components/feedback.go index 101c1f19..a2ba49c8 100644 --- a/tests/mockserver/internal/sdk/models/components/feedback.go +++ b/tests/mockserver/internal/sdk/models/components/feedback.go @@ -67,35 +67,36 @@ func (e *FeedbackCategory) UnmarshalJSON(data []byte) error { type Event string const ( - EventClick Event = "CLICK" - EventContainerClick Event = "CONTAINER_CLICK" - EventCopyLink Event = "COPY_LINK" - EventCreate Event = "CREATE" - EventDismiss Event = "DISMISS" - EventDownvote Event = "DOWNVOTE" - EventEmail Event = "EMAIL" - EventExecute Event = "EXECUTE" - EventFilter Event = "FILTER" - EventFirstToken Event = "FIRST_TOKEN" - EventFocusIn Event = "FOCUS_IN" - EventLastToken Event = "LAST_TOKEN" - EventManualFeedback Event = "MANUAL_FEEDBACK" - EventMarkAsRead Event = "MARK_AS_READ" - EventMessage Event = "MESSAGE" - EventMiddleClick Event = "MIDDLE_CLICK" - EventPageBlur Event = "PAGE_BLUR" - EventPageFocus Event = "PAGE_FOCUS" - EventPageLeave Event = "PAGE_LEAVE" - EventPreview Event = "PREVIEW" - EventRelatedClick Event = "RELATED_CLICK" - EventRightClick Event = "RIGHT_CLICK" - EventSectionClick Event = "SECTION_CLICK" - EventSeen Event = "SEEN" - EventShare Event = "SHARE" - EventShowMore Event = "SHOW_MORE" - EventUpvote Event = "UPVOTE" - EventView Event = "VIEW" - EventVisible Event = "VISIBLE" + EventClick Event = "CLICK" + EventContainerClick Event = "CONTAINER_CLICK" + EventCopyLink Event = "COPY_LINK" + EventCreate Event = "CREATE" + EventDismiss Event = "DISMISS" + EventDownvote Event = "DOWNVOTE" + EventEmail Event = "EMAIL" + EventExecute Event = "EXECUTE" + EventFilter Event = "FILTER" + EventFirstToken Event = "FIRST_TOKEN" + EventFocusIn Event = "FOCUS_IN" + EventLastToken Event = "LAST_TOKEN" + EventManualFeedback Event = "MANUAL_FEEDBACK" + EventManualFeedbackSideBySide Event = "MANUAL_FEEDBACK_SIDE_BY_SIDE" + EventMarkAsRead Event = "MARK_AS_READ" + EventMessage Event = "MESSAGE" + EventMiddleClick Event = "MIDDLE_CLICK" + EventPageBlur Event = "PAGE_BLUR" + EventPageFocus Event = "PAGE_FOCUS" + EventPageLeave Event = "PAGE_LEAVE" + EventPreview Event = "PREVIEW" + EventRelatedClick Event = "RELATED_CLICK" + EventRightClick Event = "RIGHT_CLICK" + EventSectionClick Event = "SECTION_CLICK" + EventSeen Event = "SEEN" + EventShare Event = "SHARE" + EventShowMore Event = "SHOW_MORE" + EventUpvote Event = "UPVOTE" + EventView Event = "VIEW" + EventVisible Event = "VISIBLE" ) func (e Event) ToPointer() *Event { @@ -133,6 +134,8 @@ func (e *Event) UnmarshalJSON(data []byte) error { fallthrough case "MANUAL_FEEDBACK": fallthrough + case "MANUAL_FEEDBACK_SIDE_BY_SIDE": + fallthrough case "MARK_AS_READ": fallthrough case "MESSAGE": @@ -223,11 +226,12 @@ type Feedback struct { // The UI element tree associated with the event, if any. UITree []string `json:"uiTree,omitempty"` // The UI element associated with the event, if any. - UIElement *string `json:"uiElement,omitempty"` - ManualFeedbackInfo *ManualFeedbackInfo `json:"manualFeedbackInfo,omitempty"` - SeenFeedbackInfo *SeenFeedbackInfo `json:"seenFeedbackInfo,omitempty"` - UserViewInfo *UserViewInfo `json:"userViewInfo,omitempty"` - WorkflowFeedbackInfo *WorkflowFeedbackInfo `json:"workflowFeedbackInfo,omitempty"` + UIElement *string `json:"uiElement,omitempty"` + ManualFeedbackInfo *ManualFeedbackInfo `json:"manualFeedbackInfo,omitempty"` + ManualFeedbackSideBySideInfo *ManualFeedbackSideBySideInfo `json:"manualFeedbackSideBySideInfo,omitempty"` + SeenFeedbackInfo *SeenFeedbackInfo `json:"seenFeedbackInfo,omitempty"` + UserViewInfo *UserViewInfo `json:"userViewInfo,omitempty"` + WorkflowFeedbackInfo *WorkflowFeedbackInfo `json:"workflowFeedbackInfo,omitempty"` // The application ID of the client that sent the feedback event. ApplicationID *string `json:"applicationId,omitempty"` // The agent ID of the client that sent the feedback event. @@ -350,6 +354,13 @@ func (o *Feedback) GetManualFeedbackInfo() *ManualFeedbackInfo { return o.ManualFeedbackInfo } +func (o *Feedback) GetManualFeedbackSideBySideInfo() *ManualFeedbackSideBySideInfo { + if o == nil { + return nil + } + return o.ManualFeedbackSideBySideInfo +} + func (o *Feedback) GetSeenFeedbackInfo() *SeenFeedbackInfo { if o == nil { return nil diff --git a/tests/mockserver/internal/sdk/models/components/manualfeedbackinfo.go b/tests/mockserver/internal/sdk/models/components/manualfeedbackinfo.go index 26a64603..642d709e 100644 --- a/tests/mockserver/internal/sdk/models/components/manualfeedbackinfo.go +++ b/tests/mockserver/internal/sdk/models/components/manualfeedbackinfo.go @@ -138,18 +138,18 @@ func (e *Issue) UnmarshalJSON(data []byte) error { } } -// Vote - The vote associated with the Feedback.event.MANUAL_FEEDBACK event. -type Vote string +// ManualFeedbackInfoVote - The vote associated with the Feedback.event.MANUAL_FEEDBACK event. +type ManualFeedbackInfoVote string const ( - VoteUpvote Vote = "UPVOTE" - VoteDownvote Vote = "DOWNVOTE" + ManualFeedbackInfoVoteUpvote ManualFeedbackInfoVote = "UPVOTE" + ManualFeedbackInfoVoteDownvote ManualFeedbackInfoVote = "DOWNVOTE" ) -func (e Vote) ToPointer() *Vote { +func (e ManualFeedbackInfoVote) ToPointer() *ManualFeedbackInfoVote { return &e } -func (e *Vote) UnmarshalJSON(data []byte) error { +func (e *ManualFeedbackInfoVote) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -158,10 +158,10 @@ func (e *Vote) UnmarshalJSON(data []byte) error { case "UPVOTE": fallthrough case "DOWNVOTE": - *e = Vote(v) + *e = ManualFeedbackInfoVote(v) return nil default: - return fmt.Errorf("invalid value for Vote: %v", v) + return fmt.Errorf("invalid value for ManualFeedbackInfoVote: %v", v) } } @@ -195,7 +195,7 @@ type ManualFeedbackInfo struct { // How many times this query has been run in the past. NumQueriesFromFirstRun *int64 `json:"numQueriesFromFirstRun,omitempty"` // The vote associated with the Feedback.event.MANUAL_FEEDBACK event. - Vote *Vote `json:"vote,omitempty"` + Vote *ManualFeedbackInfoVote `json:"vote,omitempty"` // A rating associated with the user feedback. The value will be between one and the maximum given by ratingScale, inclusive. Rating *int64 `json:"rating,omitempty"` // A description of the rating that contextualizes how it appeared to the user, e.g. "satisfied". @@ -295,7 +295,7 @@ func (o *ManualFeedbackInfo) GetNumQueriesFromFirstRun() *int64 { return o.NumQueriesFromFirstRun } -func (o *ManualFeedbackInfo) GetVote() *Vote { +func (o *ManualFeedbackInfo) GetVote() *ManualFeedbackInfoVote { if o == nil { return nil } diff --git a/tests/mockserver/internal/sdk/models/components/manualfeedbacksidebysideinfo.go b/tests/mockserver/internal/sdk/models/components/manualfeedbacksidebysideinfo.go new file mode 100644 index 00000000..23fb1a7d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/manualfeedbacksidebysideinfo.go @@ -0,0 +1,143 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// ManualFeedbackSideBySideInfoSource - The source associated with the side-by-side feedback event. +type ManualFeedbackSideBySideInfoSource string + +const ( + ManualFeedbackSideBySideInfoSourceLiveEval ManualFeedbackSideBySideInfoSource = "LIVE_EVAL" + ManualFeedbackSideBySideInfoSourceChat ManualFeedbackSideBySideInfoSource = "CHAT" + ManualFeedbackSideBySideInfoSourceSearch ManualFeedbackSideBySideInfoSource = "SEARCH" +) + +func (e ManualFeedbackSideBySideInfoSource) ToPointer() *ManualFeedbackSideBySideInfoSource { + return &e +} +func (e *ManualFeedbackSideBySideInfoSource) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "LIVE_EVAL": + fallthrough + case "CHAT": + fallthrough + case "SEARCH": + *e = ManualFeedbackSideBySideInfoSource(v) + return nil + default: + return fmt.Errorf("invalid value for ManualFeedbackSideBySideInfoSource: %v", v) + } +} + +// ManualFeedbackSideBySideInfoVote - The vote for this specific implementation. +type ManualFeedbackSideBySideInfoVote string + +const ( + ManualFeedbackSideBySideInfoVoteUpvote ManualFeedbackSideBySideInfoVote = "UPVOTE" + ManualFeedbackSideBySideInfoVoteDownvote ManualFeedbackSideBySideInfoVote = "DOWNVOTE" + ManualFeedbackSideBySideInfoVoteNeutral ManualFeedbackSideBySideInfoVote = "NEUTRAL" +) + +func (e ManualFeedbackSideBySideInfoVote) ToPointer() *ManualFeedbackSideBySideInfoVote { + return &e +} +func (e *ManualFeedbackSideBySideInfoVote) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "UPVOTE": + fallthrough + case "DOWNVOTE": + fallthrough + case "NEUTRAL": + *e = ManualFeedbackSideBySideInfoVote(v) + return nil + default: + return fmt.Errorf("invalid value for ManualFeedbackSideBySideInfoVote: %v", v) + } +} + +type ManualFeedbackSideBySideInfo struct { + // The email address of the user who submitted the side-by-side feedback. + Email *string `json:"email,omitempty"` + // The source associated with the side-by-side feedback event. + Source *ManualFeedbackSideBySideInfoSource `json:"source,omitempty"` + // The query or prompt that was evaluated across multiple implementations. + Query *string `json:"query,omitempty"` + // Array of implementations that were compared side-by-side. + Implementations []SideBySideImplementation `json:"implementations,omitempty"` + // Unique identifier for this evaluation session to group related feedback events. + EvaluationSessionID *string `json:"evaluationSessionId,omitempty"` + // The ID of the implementation this specific feedback event is for. + ImplementationID *string `json:"implementationId,omitempty"` + // The vote for this specific implementation. + Vote *ManualFeedbackSideBySideInfoVote `json:"vote,omitempty"` + // Specific feedback comments for this implementation. + Comments *string `json:"comments,omitempty"` +} + +func (o *ManualFeedbackSideBySideInfo) GetEmail() *string { + if o == nil { + return nil + } + return o.Email +} + +func (o *ManualFeedbackSideBySideInfo) GetSource() *ManualFeedbackSideBySideInfoSource { + if o == nil { + return nil + } + return o.Source +} + +func (o *ManualFeedbackSideBySideInfo) GetQuery() *string { + if o == nil { + return nil + } + return o.Query +} + +func (o *ManualFeedbackSideBySideInfo) GetImplementations() []SideBySideImplementation { + if o == nil { + return nil + } + return o.Implementations +} + +func (o *ManualFeedbackSideBySideInfo) GetEvaluationSessionID() *string { + if o == nil { + return nil + } + return o.EvaluationSessionID +} + +func (o *ManualFeedbackSideBySideInfo) GetImplementationID() *string { + if o == nil { + return nil + } + return o.ImplementationID +} + +func (o *ManualFeedbackSideBySideInfo) GetVote() *ManualFeedbackSideBySideInfoVote { + if o == nil { + return nil + } + return o.Vote +} + +func (o *ManualFeedbackSideBySideInfo) GetComments() *string { + if o == nil { + return nil + } + return o.Comments +} diff --git a/tests/mockserver/internal/sdk/models/components/searchrequest.go b/tests/mockserver/internal/sdk/models/components/searchrequest.go index 322f0bf8..8441c9c4 100644 --- a/tests/mockserver/internal/sdk/models/components/searchrequest.go +++ b/tests/mockserver/internal/sdk/models/components/searchrequest.go @@ -28,8 +28,6 @@ type SearchRequest struct { RequestOptions *SearchRequestOptions `json:"requestOptions,omitempty"` // Timeout in milliseconds for the request. A `408` error will be returned if handling the request takes longer. TimeoutMillis *int64 `json:"timeoutMillis,omitempty"` - // People associated with the search request. Hints to the server to fetch additional information for these people. Note that in this request, an email may be used as a person's obfuscatedId value. - People []Person `json:"people,omitempty"` // Whether or not to disable spellcheck. DisableSpellcheck *bool `json:"disableSpellcheck,omitempty"` } @@ -129,13 +127,6 @@ func (o *SearchRequest) GetTimeoutMillis() *int64 { return o.TimeoutMillis } -func (o *SearchRequest) GetPeople() []Person { - if o == nil { - return nil - } - return o.People -} - func (o *SearchRequest) GetDisableSpellcheck() *bool { if o == nil { return nil diff --git a/tests/mockserver/internal/sdk/models/components/searchresponsemetadata.go b/tests/mockserver/internal/sdk/models/components/searchresponsemetadata.go index 0d64b4b3..d8c9a4fb 100644 --- a/tests/mockserver/internal/sdk/models/components/searchresponsemetadata.go +++ b/tests/mockserver/internal/sdk/models/components/searchresponsemetadata.go @@ -7,6 +7,8 @@ type SearchResponseMetadata struct { RewrittenQuery *string `json:"rewrittenQuery,omitempty"` // The actual query used to perform search and return results. SearchedQuery *string `json:"searchedQuery,omitempty"` + // The query used to perform search and return results, with negated terms and facets removed. + SearchedQueryWithoutNegation *string `json:"searchedQueryWithoutNegation,omitempty"` // The bolded ranges within the searched query. SearchedQueryRanges []TextRange `json:"searchedQueryRanges,omitempty"` // The query text sent by the client in the request. @@ -40,6 +42,13 @@ func (o *SearchResponseMetadata) GetSearchedQuery() *string { return o.SearchedQuery } +func (o *SearchResponseMetadata) GetSearchedQueryWithoutNegation() *string { + if o == nil { + return nil + } + return o.SearchedQueryWithoutNegation +} + func (o *SearchResponseMetadata) GetSearchedQueryRanges() []TextRange { if o == nil { return nil diff --git a/tests/mockserver/internal/sdk/models/components/sidebysideimplementation.go b/tests/mockserver/internal/sdk/models/components/sidebysideimplementation.go new file mode 100644 index 00000000..f1cf399e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/sidebysideimplementation.go @@ -0,0 +1,82 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ResponseMetadata - Metadata about the response (e.g., latency, token count). +type ResponseMetadata struct { + // Time taken to generate the response in milliseconds. + LatencyMs *int64 `json:"latencyMs,omitempty"` + // Number of tokens in the response. + TokenCount *int64 `json:"tokenCount,omitempty"` + // The specific model version used. + ModelUsed *string `json:"modelUsed,omitempty"` +} + +func (o *ResponseMetadata) GetLatencyMs() *int64 { + if o == nil { + return nil + } + return o.LatencyMs +} + +func (o *ResponseMetadata) GetTokenCount() *int64 { + if o == nil { + return nil + } + return o.TokenCount +} + +func (o *ResponseMetadata) GetModelUsed() *string { + if o == nil { + return nil + } + return o.ModelUsed +} + +type SideBySideImplementation struct { + // Unique identifier for this implementation variant. + ImplementationID *string `json:"implementationId,omitempty"` + // Human-readable name for this implementation (e.g., "Variant A", "GPT-4", "Claude"). + ImplementationName *string `json:"implementationName,omitempty"` + // The search/chat parameters used for this implementation. + SearchParams map[string]string `json:"searchParams,omitempty"` + // The full response generated by this implementation. + Response *string `json:"response,omitempty"` + // Metadata about the response (e.g., latency, token count). + ResponseMetadata *ResponseMetadata `json:"responseMetadata,omitempty"` +} + +func (o *SideBySideImplementation) GetImplementationID() *string { + if o == nil { + return nil + } + return o.ImplementationID +} + +func (o *SideBySideImplementation) GetImplementationName() *string { + if o == nil { + return nil + } + return o.ImplementationName +} + +func (o *SideBySideImplementation) GetSearchParams() map[string]string { + if o == nil { + return nil + } + return o.SearchParams +} + +func (o *SideBySideImplementation) GetResponse() *string { + if o == nil { + return nil + } + return o.Response +} + +func (o *SideBySideImplementation) GetResponseMetadata() *ResponseMetadata { + if o == nil { + return nil + } + return o.ResponseMetadata +} diff --git a/tests/mockserver/internal/sdk/models/components/structuredresult.go b/tests/mockserver/internal/sdk/models/components/structuredresult.go index 4d67fec7..78781210 100644 --- a/tests/mockserver/internal/sdk/models/components/structuredresult.go +++ b/tests/mockserver/internal/sdk/models/components/structuredresult.go @@ -72,6 +72,7 @@ type StructuredResult struct { Team *Team `json:"team,omitempty"` CustomEntity *CustomEntity `json:"customEntity,omitempty"` Answer *Answer `json:"answer,omitempty"` + GeneratedQna *GeneratedQna `json:"generatedQna,omitempty"` ExtractedQnA *ExtractedQnA `json:"extractedQnA,omitempty"` Meeting *Meeting `json:"meeting,omitempty"` App *AppResult `json:"app,omitempty"` @@ -137,6 +138,13 @@ func (o *StructuredResult) GetAnswer() *Answer { return o.Answer } +func (o *StructuredResult) GetGeneratedQna() *GeneratedQna { + if o == nil { + return nil + } + return o.GeneratedQna +} + func (o *StructuredResult) GetExtractedQnA() *ExtractedQnA { if o == nil { return nil