client.admins.identify() -> Optional<AdminWithApp>client.admins.away(adminId, request) -> Optional<Admin>client.admins.listAllActivityLogs() -> ActivityLogListclient.admins.list() -> AdminListclient.admins.find(adminId) -> Optional<Admin>client.aiContent.listContentImportSources() -> ContentImportSourcesListclient.aiContent.createContentImportSource(request) -> ContentImportSourceclient.aiContent.getContentImportSource(sourceId) -> ContentImportSourceclient.aiContent.updateContentImportSource(sourceId, request) -> ContentImportSourceclient.aiContent.deleteContentImportSource(sourceId)client.aiContent.listExternalPages() -> ExternalPagesListclient.aiContent.createExternalPage(request) -> ExternalPageclient.aiContent.getExternalPage(pageId) -> ExternalPageclient.aiContent.updateExternalPage(pageId, request) -> ExternalPageclient.aiContent.deleteExternalPage(pageId) -> ExternalPageclient.articles.list() -> SyncPagingIterable<ArticleListItem>client.articles.create(request) -> Articleclient.articles.find(articleId) -> Articleclient.articles.update(articleId, request) -> ArticleNew gifts in store for the jolly season
") + .build() +); +``` +client.articles.delete(articleId) -> DeletedArticleObjectclient.articles.search() -> ArticleSearchResponseclient.awayStatusReasons.listAwayStatusReasons() -> List<AwayStatusReason>client.export.enqueueANewReportingDataExportJob(request) -> PostExportReportingDataEnqueueResponseclient.export.listAvailableDatasetsAndAttributes() -> GetExportReportingDataGetDatasetsResponseclient.dataExport.exportReportingData(jobIdentifier) -> DataExportExportReportingDataResponseclient.dataExport.downloadReportingDataExport(jobIdentifier)client.dataExport.create(request) -> DataExportclient.dataExport.find(jobIdentifier) -> DataExportclient.dataExport.cancel(jobIdentifier) -> DataExportclient.dataExport.download(jobIdentifier)client.helpCenters.find(helpCenterId) -> HelpCenterclient.helpCenters.list() -> SyncPagingIterable<HelpCenter>client.internalArticles.listInternalArticles() -> InternalArticleListclient.internalArticles.createInternalArticle(request) -> InternalArticleListItemclient.internalArticles.retrieveInternalArticle(internalArticleId) -> InternalArticleListItemclient.internalArticles.updateInternalArticle(internalArticleId, request) -> InternalArticleListItemNew gifts in store for the jolly season
") + .build() +); +``` +client.internalArticles.deleteInternalArticle(internalArticleId) -> DeletedInternalArticleObjectclient.internalArticles.searchInternalArticles() -> InternalArticleSearchResponseclient.companies.retrieve() -> CompaniesRetrieveResponseclient.companies.createOrUpdate(request) -> Companyclient.companies.find(companyId) -> Companyclient.companies.update(companyId, request) -> Companyclient.companies.delete(companyId) -> DeletedCompanyObjectclient.companies.listAttachedContacts(companyId) -> CompanyAttachedContactsclient.companies.listAttachedSegments(companyId) -> CompanyAttachedSegmentsclient.companies.list() -> SyncPagingIterable<Company>client.companies.scroll() -> SyncPagingIterable<Company>client.companies.attachContact(contactId, request) -> Companyclient.companies.detachContact(contactId, companyId) -> Companyclient.contacts.listAttachedCompanies(contactId) -> SyncPagingIterable<Company>client.contacts.listAttachedSegments(contactId) -> ContactSegmentsclient.contacts.listAttachedSubscriptions(contactId) -> SubscriptionTypeListclient.contacts.attachSubscription(contactId, request) -> SubscriptionTypeclient.contacts.detachSubscription(contactId, subscriptionId) -> SubscriptionTypeclient.contacts.listAttachedTags(contactId) -> TagListclient.contacts.find(contactId) -> ContactsFindResponseclient.contacts.update(contactId, request) -> ContactsUpdateResponseclient.contacts.delete(contactId) -> ContactDeletedclient.contacts.mergeLeadInUser(request) -> ContactsMergeLeadInUserResponseclient.contacts.search(request) -> SyncPagingIterable<Contact>client.contacts.list() -> SyncPagingIterable<Contact>client.contacts.create(request) -> ContactsCreateResponseclient.contacts.showContactByExternalId(externalId) -> ShowContactByExternalIdResponseclient.contacts.archive(contactId) -> ContactArchivedclient.contacts.unarchive(contactId) -> ContactUnarchivedclient.contacts.blockContact(contactId) -> ContactBlockedclient.notes.list(contactId) -> SyncPagingIterable<Note>client.notes.create(contactId, request) -> Noteclient.notes.find(noteId) -> Noteclient.tags.tagContact(contactId, request) -> Tagclient.tags.untagContact(contactId, tagId) -> Tagclient.tags.tagConversation(conversationId, request) -> Tagclient.tags.untagConversation(conversationId, tagId, request) -> Tagclient.tags.list() -> TagListclient.tags.create(request) -> Tagclient.tags.find(tagId) -> Tagclient.tags.delete(tagId)client.tags.tagTicket(ticketId, request) -> Tagclient.tags.untagTicket(ticketId, tagId, request) -> Tagclient.conversations.list() -> SyncPagingIterable<Conversation>client.conversations.create(request) -> Messageclient.conversations.find(conversationId) -> Conversationclient.conversations.update(conversationId, request) -> Conversationclient.conversations.deleteConversation(conversationId) -> ConversationDeletedclient.conversations.search(request) -> SyncPagingIterable<Conversation>client.conversations.reply(conversationId, request) -> Conversationclient.conversations.manage(conversationId, request) -> Conversationclient.conversations.attachContactAsAdmin(conversationId, request) -> Conversationclient.conversations.detachContactAsAdmin(conversationId, contactId, request) -> Conversationclient.conversations.redactConversationPart(request) -> Conversationclient.conversations.convertToTicket(conversationId, request) -> Optional<Ticket>client.conversations.runAssignmentRules(conversationId) -> Conversationclient.customChannelEvents.notifyNewConversation(request) -> CustomChannelNotificationResponseclient.customChannelEvents.notifyNewMessage(request) -> CustomChannelNotificationResponseclient.customChannelEvents.notifyQuickReplySelected(request) -> CustomChannelNotificationResponseclient.customChannelEvents.notifyAttributeCollected(request) -> CustomChannelNotificationResponseclient.customObjectInstances.getCustomObjectInstancesByExternalId(customObjectTypeIdentifier) -> Optional<CustomObjectInstance>client.customObjectInstances.createCustomObjectInstances(customObjectTypeIdentifier, request) -> Optional<CustomObjectInstance>client.customObjectInstances.deleteCustomObjectInstancesById(customObjectTypeIdentifier) -> CustomObjectInstanceDeletedclient.customObjectInstances.getCustomObjectInstancesById(customObjectTypeIdentifier, customObjectInstanceId) -> Optional<CustomObjectInstance>client.customObjectInstances.deleteCustomObjectInstancesByExternalId(customObjectTypeIdentifier, customObjectInstanceId) -> CustomObjectInstanceDeletedclient.dataAttributes.list() -> DataAttributeListclient.dataAttributes.create(request) -> DataAttributeclient.dataAttributes.update(dataAttributeId, request) -> DataAttributeclient.events.list() -> DataEventSummaryclient.events.create(request)client.events.summaries(request)client.jobs.status(jobId) -> Jobsclient.messages.create(request) -> Messageclient.segments.list() -> SegmentListclient.segments.find(segmentId) -> Segmentclient.subscriptionTypes.list() -> SubscriptionTypeListclient.phoneCallRedirects.create(request) -> Optional<PhoneSwitch>client.calls.listCalls() -> CallListclient.calls.showCall(callId) -> Callclient.calls.showCallRecording(callId)client.calls.showCallTranscript(callId) -> Stringclient.calls.listCallsWithTranscripts(request) -> ListCallsWithTranscriptsResponseclient.teams.list() -> TeamListclient.teams.find(teamId) -> Teamclient.ticketStates.listTicketStates() -> TicketStateListclient.ticketTypes.list() -> TicketTypeListclient.ticketTypes.create(request) -> Optional<TicketType>client.ticketTypes.get(ticketTypeId) -> Optional<TicketType>client.ticketTypes.update(ticketTypeId, request) -> Optional<TicketType>client.tickets.reply(ticketId, request) -> TicketReplyclient.tickets.create(request) -> Optional<Ticket>client.tickets.enqueueCreateTicket(request) -> Jobsclient.tickets.get(ticketId) -> Optional<Ticket>client.tickets.update(ticketId, request) -> Optional<Ticket>client.tickets.deleteTicket(ticketId) -> DeleteTicketResponseclient.tickets.search(request) -> SyncPagingIterable<Optional<Ticket>>client.visitors.find() -> Optional<Visitor>client.visitors.update(request) -> Optional<Visitor>client.visitors.mergeToContact(request) -> Contactclient.helpCenters.collections.list() -> SyncPagingIterable<Collection>client.helpCenters.collections.create(request) -> Collectionclient.helpCenters.collections.find(collectionId) -> Collectionclient.helpCenters.collections.update(collectionId, request) -> Collectionclient.helpCenters.collections.delete(collectionId) -> DeletedCollectionObjectclient.news.items.list() -> PaginatedResponseclient.news.items.create(request) -> NewsItemNew costumes in store for this spooky season
") + .state(NewsItemRequestState.LIVE) + .deliverSilently(true) + .labels( + Optional.of( + Arrays.asList("Product", "Update", "New") + ) + ) + .reactions( + Optional.of( + Arrays.asList(Optional.of("😆"), Optional.of("😅")) + ) + ) + .newsfeedAssignments( + Optional.of( + Arrays.asList( + NewsfeedAssignment + .builder() + .newsfeedId(53) + .publishedAt(1664638214) + .build() + ) + ) + ) + .build() +); +``` +client.news.items.find(newsItemId) -> NewsItemclient.news.items.update(newsItemId, request) -> NewsItemNew gifts in store for the jolly season
") + .reactions( + Optional.of( + Arrays.asList(Optional.of("😝"), Optional.of("😂")) + ) + ) + .build() + ) + .build() +); +``` +client.news.items.delete(newsItemId) -> DeletedObjectclient.news.feeds.listItems(newsfeedId) -> PaginatedResponseclient.news.feeds.list() -> PaginatedResponseclient.news.feeds.find(newsfeedId) -> Newsfeedclient.ticketTypes.attributes.create(ticketTypeId, request) -> Optional<TicketTypeAttribute>client.ticketTypes.attributes.update(ticketTypeId, attributeId, request) -> Optional<TicketTypeAttribute>client.unstable.admins.identifyAdmin() -> Optional<AdminWithApp>client.unstable.admins.setAwayAdmin(id, request) -> Optional<Admin>client.unstable.admins.listActivityLogs() -> ActivityLogListclient.unstable.admins.listAdmins() -> AdminListclient.unstable.admins.retrieveAdmin(id) -> Optional<Admin>client.unstable.aiContent.listContentImportSources() -> ContentImportSourcesListclient.unstable.aiContent.createContentImportSource(request) -> ContentImportSourceclient.unstable.aiContent.getContentImportSource(id) -> ContentImportSourceclient.unstable.aiContent.updateContentImportSource(id, request) -> ContentImportSourceclient.unstable.aiContent.deleteContentImportSource(id)client.unstable.aiContent.listExternalPages() -> ExternalPagesListclient.unstable.aiContent.createExternalPage(request) -> ExternalPageclient.unstable.aiContent.getExternalPage(id) -> ExternalPageclient.unstable.aiContent.updateExternalPage(id, request) -> ExternalPageclient.unstable.aiContent.deleteExternalPage(id) -> ExternalPageclient.unstable.articles.listArticles() -> ArticleListclient.unstable.articles.createArticle(request) -> Articleclient.unstable.articles.retrieveArticle(id) -> Articleclient.unstable.articles.deleteArticle(id) -> DeletedArticleObjectclient.unstable.articles.searchArticles() -> ArticleSearchResponseclient.unstable.awayStatusReasons.listAwayStatusReasons() -> List<AwayStatusReason>client.unstable.export.enqueueANewReportingDataExportJob(request) -> PostExportReportingDataEnqueueResponseclient.unstable.export.listAvailableDatasetsAndAttributes() -> GetExportReportingDataGetDatasetsResponseclient.unstable.helpCenter.listAllCollections() -> CollectionListclient.unstable.helpCenter.createCollection(request) -> Collectionclient.unstable.helpCenter.retrieveCollection(id) -> Collectionclient.unstable.helpCenter.updateCollection(id, request) -> Collectionclient.unstable.helpCenter.deleteCollection(id) -> DeletedCollectionObjectclient.unstable.helpCenter.retrieveHelpCenter(id) -> HelpCenterclient.unstable.helpCenter.listHelpCenters() -> HelpCenterListclient.unstable.internalArticles.listInternalArticles() -> InternalArticleListclient.unstable.internalArticles.createInternalArticle(request) -> InternalArticleListItemclient.unstable.internalArticles.retrieveInternalArticle(id) -> InternalArticleListItemclient.unstable.internalArticles.updateInternalArticle(id, request) -> InternalArticleListItemNew gifts in store for the jolly season
") + .build() +); +``` +client.unstable.internalArticles.deleteInternalArticle(id) -> DeletedInternalArticleObjectclient.unstable.internalArticles.searchInternalArticles() -> InternalArticleSearchResponseclient.unstable.companies.retrieveCompany() -> CompanyListclient.unstable.companies.createOrUpdateCompany(request) -> Companyclient.unstable.companies.retrieveACompanyById(id) -> Companyclient.unstable.companies.updateCompany(id) -> Companyclient.unstable.companies.deleteCompany(id) -> DeletedCompanyObjectclient.unstable.companies.listAttachedContacts(id) -> CompanyAttachedContactsclient.unstable.companies.listAttachedSegmentsForCompanies(id) -> CompanyAttachedSegmentsclient.unstable.companies.listAllCompanies() -> CompanyListclient.unstable.companies.scrollOverAllCompanies() -> Optional<CompanyScroll>client.unstable.companies.attachContactToACompany(id, request) -> Companyclient.unstable.companies.detachContactFromACompany(contactId, id) -> Companyclient.unstable.notes.listCompanyNotes(id) -> NoteListclient.unstable.notes.listNotes(id) -> NoteListclient.unstable.notes.createNote(id, request) -> Noteclient.unstable.notes.retrieveNote(id) -> Noteclient.unstable.contacts.listCompaniesForAContact(id) -> ContactAttachedCompaniesclient.unstable.contacts.listSegmentsForAContact(contactId) -> ContactSegmentsclient.unstable.contacts.listSubscriptionsForAContact(contactId) -> SubscriptionTypeListclient.unstable.contacts.listTagsForAContact(contactId) -> TagListclient.unstable.contacts.showContact(id) -> ShowContactResponseclient.unstable.contacts.updateContact(id, request) -> UpdateContactResponseclient.unstable.contacts.deleteContact(id) -> ContactDeletedclient.unstable.contacts.mergeContact(request) -> MergeContactResponseclient.unstable.contacts.searchContacts(request) -> ContactListclient.unstable.contacts.listContacts() -> ContactListclient.unstable.contacts.createContact(request) -> CreateContactResponseclient.unstable.contacts.showContactByExternalId(externalId) -> ShowContactByExternalIdResponseclient.unstable.contacts.archiveContact(id) -> ContactArchivedclient.unstable.contacts.unarchiveContact(id) -> ContactUnarchivedclient.unstable.contacts.blockContact(id) -> ContactBlockedclient.unstable.subscriptionTypes.attachSubscriptionTypeToContact(contactId, request) -> SubscriptionTypeclient.unstable.subscriptionTypes.detachSubscriptionTypeToContact(contactId, id) -> SubscriptionTypeclient.unstable.subscriptionTypes.listSubscriptionTypes() -> SubscriptionTypeListclient.unstable.tags.attachTagToContact(contactId, request) -> Tagclient.unstable.tags.detachTagFromContact(contactId, id) -> Tagclient.unstable.tags.attachTagToConversation(conversationId, request) -> Tagclient.unstable.tags.detachTagFromConversation(conversationId, id, request) -> Tagclient.unstable.tags.listTags() -> TagListclient.unstable.tags.createTag(request) -> Tagclient.unstable.tags.findTag(id) -> Tagclient.unstable.tags.deleteTag(id)client.unstable.tags.attachTagToTicket(ticketId, request) -> Tagclient.unstable.tags.detachTagFromTicket(ticketId, id, request) -> Tagclient.unstable.conversations.listConversations() -> ConversationListclient.unstable.conversations.createConversation(request) -> Messageclient.unstable.conversations.retrieveConversation(id) -> Conversationclient.unstable.conversations.updateConversation(id, request) -> Conversationclient.unstable.conversations.deleteConversation(id) -> ConversationDeletedclient.unstable.conversations.searchConversations(request) -> ConversationListclient.unstable.conversations.replyConversation(id, request) -> Conversationclient.unstable.conversations.manageConversation(id, request) -> Conversationclient.unstable.conversations.attachContactToConversation(id, request) -> Conversationclient.unstable.conversations.detachContactFromConversation(conversationId, contactId, request) -> Conversationclient.unstable.conversations.redactConversation(request) -> Conversationclient.unstable.conversations.convertConversationToTicket(id, request) -> Optional<Ticket>client.unstable.customChannelEvents.notifyNewConversation(request) -> CustomChannelNotificationResponseclient.unstable.customChannelEvents.notifyNewMessage(request) -> CustomChannelNotificationResponseclient.unstable.customChannelEvents.notifyQuickReplySelected(request) -> CustomChannelNotificationResponseclient.unstable.customChannelEvents.notifyAttributeCollected(request) -> CustomChannelNotificationResponseclient.unstable.customObjectInstances.getCustomObjectInstancesByExternalId(customObjectTypeIdentifier) -> Optional<CustomObjectInstance>client.unstable.customObjectInstances.createCustomObjectInstances(customObjectTypeIdentifier, request) -> Optional<CustomObjectInstance>client.unstable.customObjectInstances.deleteCustomObjectInstancesById(customObjectTypeIdentifier) -> CustomObjectInstanceDeletedclient.unstable.customObjectInstances.getCustomObjectInstancesById(customObjectTypeIdentifier, id) -> Optional<CustomObjectInstance>client.unstable.customObjectInstances.deleteCustomObjectInstancesByExternalId(customObjectTypeIdentifier, id) -> CustomObjectInstanceDeletedclient.unstable.dataAttributes.lisDataAttributes() -> DataAttributeListclient.unstable.dataAttributes.createDataAttribute(request) -> DataAttributeclient.unstable.dataAttributes.updateDataAttribute(id, request) -> DataAttributeclient.unstable.dataEvents.lisDataEvents() -> DataEventSummaryclient.unstable.dataEvents.createDataEvent(request)client.unstable.dataEvents.dataEventSummaries(request)client.unstable.dataExport.createDataExport(request) -> DataExportclient.unstable.dataExport.getDataExport(jobIdentifier) -> DataExportclient.unstable.dataExport.cancelDataExport(jobIdentifier) -> DataExportclient.unstable.dataExport.downloadDataExport(jobIdentifier)client.unstable.jobs.status(id) -> Jobsclient.unstable.macros.listMacros() -> MacroListclient.unstable.macros.getMacro(id) -> Optional<Macro>client.unstable.messages.createMessage(request) -> Messageclient.unstable.messages.getWhatsAppMessageStatus() -> WhatsappMessageStatusListclient.unstable.news.listNewsItems() -> PaginatedResponseclient.unstable.news.createNewsItem(request) -> NewsItemNew costumes in store for this spooky season
") + .state(NewsItemRequestState.LIVE) + .deliverSilently(true) + .labels( + Optional.of( + Arrays.asList("Product", "Update", "New") + ) + ) + .reactions( + Optional.of( + Arrays.asList(Optional.of("😆"), Optional.of("😅")) + ) + ) + .newsfeedAssignments( + Optional.of( + Arrays.asList( + NewsfeedAssignment + .builder() + .newsfeedId(53) + .publishedAt(1664638214) + .build() + ) + ) + ) + .build() +); +``` +client.unstable.news.retrieveNewsItem(id) -> NewsItemclient.unstable.news.updateNewsItem(id, request) -> NewsItemNew gifts in store for the jolly season
") + .reactions( + Optional.of( + Arrays.asList(Optional.of("😝"), Optional.of("😂")) + ) + ) + .build() + ) + .build() +); +``` +client.unstable.news.deleteNewsItem(id) -> DeletedObjectclient.unstable.news.listLiveNewsfeedItems(id) -> PaginatedResponseclient.unstable.news.listNewsfeeds() -> PaginatedResponseclient.unstable.news.retrieveNewsfeed(id) -> Newsfeedclient.unstable.segments.listSegments() -> SegmentListclient.unstable.segments.retrieveSegment(id) -> Segmentclient.unstable.switch_.createPhoneSwitch(request) -> Optional<PhoneSwitch>client.unstable.calls.listCalls() -> CallListclient.unstable.calls.showCall(id) -> Callclient.unstable.calls.showCallRecording(id)client.unstable.calls.showCallTranscript(id) -> Stringclient.unstable.calls.listCallsWithTranscripts(request) -> ListCallsWithTranscriptsResponseclient.unstable.calls.registerFinVoiceCall(request) -> AiCallResponseclient.unstable.calls.collectFinVoiceCallById(id) -> AiCallResponseclient.unstable.calls.collectFinVoiceCallByExternalId(externalId) -> AiCallResponseclient.unstable.calls.collectFinVoiceCallByPhoneNumber(phoneNumber) -> Errorclient.unstable.teams.listTeams() -> TeamListclient.unstable.teams.retrieveTeam(id) -> Teamclient.unstable.ticketStates.listTicketStates() -> TicketStateListclient.unstable.ticketTypeAttributes.createTicketTypeAttribute(ticketTypeId, request) -> Optional<TicketTypeAttribute>client.unstable.ticketTypeAttributes.updateTicketTypeAttribute(ticketTypeId, id, request) -> Optional<TicketTypeAttribute>client.unstable.ticketTypes.listTicketTypes() -> TicketTypeListclient.unstable.ticketTypes.createTicketType(request) -> Optional<TicketType>client.unstable.ticketTypes.getTicketType(id) -> Optional<TicketType>client.unstable.tickets.replyTicket(id, request) -> TicketReplyclient.unstable.tickets.enqueueCreateTicket(request) -> Jobsclient.unstable.tickets.getTicket(id) -> Optional<Ticket>client.unstable.tickets.updateTicket(id, request) -> Optional<Ticket>client.unstable.tickets.deleteTicket(id) -> DeleteTicketResponseclient.unstable.tickets.searchTickets(request) -> TicketListclient.unstable.visitors.retrieveVisitorWithUserId() -> Optional<Visitor>client.unstable.visitors.updateVisitor(request) -> Optional<Visitor>client.unstable.visitors.convertVisitor(request) -> Contactclient.unstable.brands.listBrands() -> BrandListclient.unstable.brands.retrieveBrand(id) -> Brandclient.unstable.emails.listEmails() -> EmailListclient.unstable.emails.retrieveEmail(id) -> EmailSetting{@code
+ * @Override
+ * protected void setAuthentication(ClientOptions.Builder builder) {
+ * super.setAuthentication(builder); // Keep existing auth
+ * builder.addHeader("X-API-Key", this.apiKey);
+ * }
+ * }
+ */
+ protected void setAuthentication(ClientOptions.Builder builder) {
+ if (this.token != null) {
+ builder.addHeader("Authorization", "Bearer " + this.token);
+ }
+ }
+
+ /**
+ * Sets the request timeout configuration.
+ * Override this method to customize timeout behavior.
+ *
+ * @param builder The ClientOptions.Builder to configure
+ */
+ protected void setTimeouts(ClientOptions.Builder builder) {
+ if (this.timeout.isPresent()) {
+ builder.timeout(this.timeout.get());
+ }
+ }
+
+ /**
+ * Sets the retry configuration for failed requests.
+ * Override this method to implement custom retry strategies.
+ *
+ * @param builder The ClientOptions.Builder to configure
+ */
+ protected void setRetries(ClientOptions.Builder builder) {
+ if (this.maxRetries.isPresent()) {
+ builder.maxRetries(this.maxRetries.get());
+ }
+ }
+
+ /**
+ * Sets the OkHttp client configuration.
+ * Override this method to customize HTTP client behavior (interceptors, connection pools, etc).
+ *
+ * @param builder The ClientOptions.Builder to configure
+ */
+ protected void setHttpClient(ClientOptions.Builder builder) {
+ if (this.httpClient != null) {
+ builder.httpClient(this.httpClient);
+ }
+ }
+
+ /**
+ * Override this method to add any additional configuration to the client.
+ * This method is called at the end of the configuration chain, allowing you to add
+ * custom headers, modify settings, or perform any other client customization.
+ *
+ * @param builder The ClientOptions.Builder to configure
+ *
+ * Example:
+ * {@code
+ * @Override
+ * protected void setAdditional(ClientOptions.Builder builder) {
+ * builder.addHeader("X-Request-ID", () -> UUID.randomUUID().toString());
+ * builder.addHeader("X-Client-Version", "1.0.0");
+ * }
+ * }
+ */
+ protected void setAdditional(ClientOptions.Builder builder) {}
+
+ /**
+ * Override this method to add custom validation logic before the client is built.
+ * This method is called at the beginning of the build() method to ensure the configuration is valid.
+ * Throw an exception to prevent client creation if validation fails.
+ *
+ * Example:
+ * {@code
+ * @Override
+ * protected void validateConfiguration() {
+ * super.validateConfiguration(); // Run parent validations
+ * if (tenantId == null || tenantId.isEmpty()) {
+ * throw new IllegalStateException("tenantId is required");
+ * }
+ * }
+ * }
+ */
+ protected void validateConfiguration() {}
+
public AsyncIntercom build() {
if (token == null) {
throw new RuntimeException("Please provide token or set the INTERCOM_API_KEY environment variable.");
}
- this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + this.token);
- clientOptionsBuilder.environment(this.environment);
- return new AsyncIntercom(clientOptionsBuilder.build());
+ validateConfiguration();
+ return new AsyncIntercom(buildClientOptions());
}
}
diff --git a/src/main/java/com/intercom/api/Intercom.java b/src/main/java/com/intercom/api/Intercom.java
index 4d9bfec..11fa252 100644
--- a/src/main/java/com/intercom/api/Intercom.java
+++ b/src/main/java/com/intercom/api/Intercom.java
@@ -6,14 +6,22 @@
import com.intercom.api.core.ClientOptions;
import com.intercom.api.core.Suppliers;
import com.intercom.api.resources.admins.AdminsClient;
+import com.intercom.api.resources.aicontent.AiContentClient;
import com.intercom.api.resources.articles.ArticlesClient;
+import com.intercom.api.resources.awaystatusreasons.AwayStatusReasonsClient;
+import com.intercom.api.resources.calls.CallsClient;
import com.intercom.api.resources.companies.CompaniesClient;
import com.intercom.api.resources.contacts.ContactsClient;
import com.intercom.api.resources.conversations.ConversationsClient;
+import com.intercom.api.resources.customchannelevents.CustomChannelEventsClient;
+import com.intercom.api.resources.customobjectinstances.CustomObjectInstancesClient;
import com.intercom.api.resources.dataattributes.DataAttributesClient;
import com.intercom.api.resources.dataexport.DataExportClient;
import com.intercom.api.resources.events.EventsClient;
+import com.intercom.api.resources.export.ExportClient;
import com.intercom.api.resources.helpcenters.HelpCentersClient;
+import com.intercom.api.resources.internalarticles.InternalArticlesClient;
+import com.intercom.api.resources.jobs.JobsClient;
import com.intercom.api.resources.messages.MessagesClient;
import com.intercom.api.resources.news.NewsClient;
import com.intercom.api.resources.notes.NotesClient;
@@ -23,6 +31,7 @@
import com.intercom.api.resources.tags.TagsClient;
import com.intercom.api.resources.teams.TeamsClient;
import com.intercom.api.resources.tickets.TicketsClient;
+import com.intercom.api.resources.ticketstates.TicketStatesClient;
import com.intercom.api.resources.tickettypes.TicketTypesClient;
import com.intercom.api.resources.unstable.UnstableClient;
import com.intercom.api.resources.visitors.VisitorsClient;
@@ -33,10 +42,20 @@ public class Intercom {
protected final Supplier{@code
+ * @Override
+ * protected void setAuthentication(ClientOptions.Builder builder) {
+ * super.setAuthentication(builder); // Keep existing auth
+ * builder.addHeader("X-API-Key", this.apiKey);
+ * }
+ * }
+ */
+ protected void setAuthentication(ClientOptions.Builder builder) {
+ if (this.token != null) {
+ builder.addHeader("Authorization", "Bearer " + this.token);
+ }
+ }
+
+ /**
+ * Sets the request timeout configuration.
+ * Override this method to customize timeout behavior.
+ *
+ * @param builder The ClientOptions.Builder to configure
+ */
+ protected void setTimeouts(ClientOptions.Builder builder) {
+ if (this.timeout.isPresent()) {
+ builder.timeout(this.timeout.get());
+ }
+ }
+
+ /**
+ * Sets the retry configuration for failed requests.
+ * Override this method to implement custom retry strategies.
+ *
+ * @param builder The ClientOptions.Builder to configure
+ */
+ protected void setRetries(ClientOptions.Builder builder) {
+ if (this.maxRetries.isPresent()) {
+ builder.maxRetries(this.maxRetries.get());
+ }
+ }
+
+ /**
+ * Sets the OkHttp client configuration.
+ * Override this method to customize HTTP client behavior (interceptors, connection pools, etc).
+ *
+ * @param builder The ClientOptions.Builder to configure
+ */
+ protected void setHttpClient(ClientOptions.Builder builder) {
+ if (this.httpClient != null) {
+ builder.httpClient(this.httpClient);
+ }
+ }
+
+ /**
+ * Override this method to add any additional configuration to the client.
+ * This method is called at the end of the configuration chain, allowing you to add
+ * custom headers, modify settings, or perform any other client customization.
+ *
+ * @param builder The ClientOptions.Builder to configure
+ *
+ * Example:
+ * {@code
+ * @Override
+ * protected void setAdditional(ClientOptions.Builder builder) {
+ * builder.addHeader("X-Request-ID", () -> UUID.randomUUID().toString());
+ * builder.addHeader("X-Client-Version", "1.0.0");
+ * }
+ * }
+ */
+ protected void setAdditional(ClientOptions.Builder builder) {}
+
+ /**
+ * Override this method to add custom validation logic before the client is built.
+ * This method is called at the beginning of the build() method to ensure the configuration is valid.
+ * Throw an exception to prevent client creation if validation fails.
+ *
+ * Example:
+ * {@code
+ * @Override
+ * protected void validateConfiguration() {
+ * super.validateConfiguration(); // Run parent validations
+ * if (tenantId == null || tenantId.isEmpty()) {
+ * throw new IllegalStateException("tenantId is required");
+ * }
+ * }
+ * }
+ */
+ protected void validateConfiguration() {}
+
public Intercom build() {
if (token == null) {
throw new RuntimeException("Please provide token or set the INTERCOM_API_KEY environment variable.");
}
- this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + this.token);
- clientOptionsBuilder.environment(this.environment);
- return new Intercom(clientOptionsBuilder.build());
+ validateConfiguration();
+ return new Intercom(buildClientOptions());
}
}
diff --git a/src/main/java/com/intercom/api/core/ApiVersion.java b/src/main/java/com/intercom/api/core/ApiVersion.java
index e0f2c7b..86f308c 100644
--- a/src/main/java/com/intercom/api/core/ApiVersion.java
+++ b/src/main/java/com/intercom/api/core/ApiVersion.java
@@ -9,6 +9,8 @@
public final class ApiVersion {
public static final ApiVersion _2_1 = new ApiVersion(Value._2_1, "2.1");
+ public static final ApiVersion _2_14 = new ApiVersion(Value._2_14, "2.14");
+
public static final ApiVersion _2_2 = new ApiVersion(Value._2_2, "2.2");
public static final ApiVersion _1_0 = new ApiVersion(Value._1_0, "1.0");
@@ -41,8 +43,12 @@ public final class ApiVersion {
public static final ApiVersion UNSTABLE = new ApiVersion(Value.UNSTABLE, "Unstable");
+ public static final ApiVersion _2_12 = new ApiVersion(Value._2_12, "2.12");
+
public static final ApiVersion _2_0 = new ApiVersion(Value._2_0, "2.0");
+ public static final ApiVersion _2_13 = new ApiVersion(Value._2_13, "2.13");
+
private final Value value;
private final String string;
@@ -76,6 +82,8 @@ public
* {@code Stream} assumes that data is being pushed to the provided {@link Reader} asynchronously and utilizes a
* {@code Scanner} to block during iteration if the next object is not available.
+ * Iterable stream for parsing JSON and Server-Sent Events (SSE) data.
+ * Supports both newline-delimited JSON and SSE with optional stream termination.
*
* @param
- * Will block and wait for input if the stream has not ended and the next object is not yet available.
- *
- * @return {@code true} if there are more elements, {@code false} otherwise.
- */
- @Override
- public boolean hasNext() {
- return scanner.hasNext();
+ if (streamType == StreamType.SSE) {
+ return new SSEIterator();
+ } else {
+ return new JsonIterator();
+ }
+ }
+
+ private final class JsonIterator implements Iterator
+ * Will block and wait for input if the stream has not ended and the next object is not yet available.
+ *
+ * @return {@code true} if there are more elements, {@code false} otherwise.
+ */
+ @Override
+ public boolean hasNext() {
+ if (isStreamClosed()) {
+ return false;
+ }
+ return scanner.hasNext();
+ }
+
+ /**
+ * Returns the next element in the stream.
+ *
+ * Will block and wait for input if the stream has not ended and the next object is not yet available.
+ *
+ * @return The next element in the stream.
+ * @throws NoSuchElementException If there are no more elements in the stream.
+ */
+ @Override
+ public T next() {
+ if (isStreamClosed()) {
+ throw new NoSuchElementException("Stream is closed");
+ }
+
+ if (!scanner.hasNext()) {
+ throw new NoSuchElementException();
+ } else {
+ try {
+ T parsedResponse =
+ ObjectMappers.JSON_MAPPER.readValue(scanner.next().trim(), valueType);
+ return parsedResponse;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ private final class SSEIterator implements Iterator
- * Will block and wait for input if the stream has not ended and the next object is not yet available.
- *
- * @return The next element in the stream.
- * @throws NoSuchElementException If there are no more elements in the stream.
- */
- @Override
- public T next() {
- if (!scanner.hasNext()) {
- throw new NoSuchElementException();
- } else {
+ try {
+ while (sseScanner.hasNextLine()) {
+ String line = sseScanner.nextLine();
+
+ if (line.trim().isEmpty()) {
+ if (eventDataBuffer.length() > 0) {
+ try {
+ nextItem = ObjectMappers.JSON_MAPPER.readValue(eventDataBuffer.toString(), valueType);
+ hasNextItem = true;
+ eventDataBuffer.setLength(0);
+ currentEventType = null;
+ return true;
+ } catch (Exception parseEx) {
+ System.err.println("Failed to parse SSE event: " + parseEx.getMessage());
+ eventDataBuffer.setLength(0);
+ currentEventType = null;
+ continue;
+ }
+ }
+ continue;
+ }
+
+ if (line.startsWith(DATA_PREFIX)) {
+ String dataContent = line.substring(DATA_PREFIX.length());
+ if (dataContent.startsWith(" ")) {
+ dataContent = dataContent.substring(1);
+ }
+
+ if (eventDataBuffer.length() == 0
+ && streamTerminator != null
+ && dataContent.trim().equals(streamTerminator)) {
+ endOfStream = true;
+ return false;
+ }
+
+ if (eventDataBuffer.length() > 0) {
+ eventDataBuffer.append('\n');
+ }
+ eventDataBuffer.append(dataContent);
+ } else if (line.startsWith("event:")) {
+ String eventValue = line.length() > 6 ? line.substring(6) : "";
+ if (eventValue.startsWith(" ")) {
+ eventValue = eventValue.substring(1);
+ }
+ currentEventType = eventValue;
+ } else if (line.startsWith("id:")) {
+ // Event ID field (ignored)
+ } else if (line.startsWith("retry:")) {
+ // Retry field (ignored)
+ } else if (line.startsWith(":")) {
+ // Comment line (ignored)
+ }
+ }
+
+ if (eventDataBuffer.length() > 0) {
try {
- T parsedResponse = ObjectMappers.JSON_MAPPER.readValue(
- scanner.next().trim(), valueType);
- return parsedResponse;
- } catch (Exception e) {
- throw new RuntimeException(e);
+ nextItem = ObjectMappers.JSON_MAPPER.readValue(eventDataBuffer.toString(), valueType);
+ hasNextItem = true;
+ eventDataBuffer.setLength(0);
+ currentEventType = null;
+ return true;
+ } catch (Exception parseEx) {
+ System.err.println("Failed to parse final SSE event: " + parseEx.getMessage());
+ eventDataBuffer.setLength(0);
+ currentEventType = null;
}
}
- }
- /**
- * Removing elements from {@code Stream} is not supported.
- *
- * @throws UnsupportedOperationException Always, as removal is not supported.
- */
- @Override
- public void remove() {
- throw new UnsupportedOperationException();
+ endOfStream = true;
+ return false;
+
+ } catch (Exception e) {
+ System.err.println("Failed to parse SSE stream: " + e.getMessage());
+ endOfStream = true;
+ return false;
}
- };
+ }
}
}
diff --git a/src/main/java/com/intercom/api/core/pagination/AsyncCustomPager.java b/src/main/java/com/intercom/api/core/pagination/AsyncCustomPager.java
new file mode 100644
index 0000000..001643f
--- /dev/null
+++ b/src/main/java/com/intercom/api/core/pagination/AsyncCustomPager.java
@@ -0,0 +1,164 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.intercom.api.core.pagination;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionStage;
+
+/**
+ * Skeleton implementation for custom asynchronous bidirectional pagination.
+ *
+ * THIS CLASS MUST BE IMPLEMENTED BY THE USER.
+ *
+ * This file is added to .fernignore and will not be regenerated.
+ * Replace this skeleton implementation with your custom async pagination logic
+ * that handles your API's specific pagination structure (e.g., HATEOAS links).
+ *
+ * Example implementation for HATEOAS-style async pagination:
+ * If you are building a custom "Log in with Intercom" flow for your site, and you call the If you are building a custom "Log in with Intercom" flow for your site, and you call the If you are building a custom "Log in with Intercom" flow for your site, and you call the If you are building a custom "Log in with Intercom" flow for your site, and you call the If you are building a custom "Log in with Intercom" flow for your site, and you call the If you are building a custom "Log in with Intercom" flow for your site, and you call the If you are building a custom "Log in with Intercom" flow for your site, and you call the If you are building a custom "Log in with Intercom" flow for your site, and you call the {@code
+ * public class AsyncCustomPager
+ *
+ * @param > getAllItemsAsync() {
+ throw new UnsupportedOperationException("AsyncCustomPager.getAllItemsAsync() must be implemented. "
+ + "This method should asynchronously fetch all pages and return all items.");
+ }
+
+ /**
+ * Process each page asynchronously as it arrives.
+ *
+ * @param pageProcessor Function to process each page
+ * @return CompletableFuture that completes when all pages are processed
+ */
+ public CompletableFuture
, CompletionStage
{@code
+ * public class CustomPager
+ *
+ * @param > items, Supplier extends SyncPage
> items, Object response, Supplier extends SyncPage
/me endpoint to identify the logged-in user, you should not accept any sign-ins from users with unverified email addresses as it poses a potential impersonation security risk./me endpoint to identify the logged-in user, you should not accept any sign-ins from users with unverified email addresses as it poses a potential impersonation security risk./me endpoint to identify the logged-in user, you should not accept any sign-ins from users with unverified email addresses as it poses a potential impersonation security risk./me endpoint to identify the logged-in user, you should not accept any sign-ins from users with unverified email addresses as it poses a potential impersonation security risk./me endpoint to identify the logged-in user, you should not accept any sign-ins from users with unverified email addresses as it poses a potential impersonation security risk./me endpoint to identify the logged-in user, you should not accept any sign-ins from users with unverified email addresses as it poses a potential impersonation security risk./me endpoint to identify the logged-in user, you should not accept any sign-ins from users with unverified email addresses as it poses a potential impersonation security risk./me endpoint to identify the logged-in user, you should not accept any sign-ins from users with unverified email addresses as it poses a potential impersonation security risk.