├── modules ├── examples │ ├── output │ │ ├── DeleteDoc.txt │ │ ├── DeleteDoc2.txt │ │ ├── CreateDbAndDoc.txt │ │ ├── UpdateDoc.txt │ │ ├── UpdateDoc2.txt │ │ └── GetInfoFromExistingDatabase.txt │ └── src │ │ └── main │ │ └── java │ │ └── features │ │ ├── Start.java │ │ └── StartOneOff.java ├── common │ └── src │ │ └── main │ │ ├── resources │ │ └── cloudant-parent.properties │ │ └── java │ │ └── com │ │ └── ibm │ │ └── cloud │ │ └── cloudant │ │ ├── security │ │ └── package-info.java │ │ ├── common │ │ └── package-info.java │ │ └── internal │ │ └── package-info.java └── cloudant │ └── src │ ├── main │ └── java │ │ └── com │ │ └── ibm │ │ └── cloud │ │ └── cloudant │ │ ├── v1 │ │ ├── package-info.java │ │ └── model │ │ │ ├── PostApiKeysOptions.java │ │ │ ├── GetActiveTasksOptions.java │ │ │ ├── GetUpInformationOptions.java │ │ │ ├── HeadUpInformationOptions.java │ │ │ ├── GetCorsInformationOptions.java │ │ │ ├── GetServerInformationOptions.java │ │ │ ├── GetSessionInformationOptions.java │ │ │ ├── GetActivityTrackerEventsOptions.java │ │ │ ├── GetMembershipInformationOptions.java │ │ │ ├── Ok.java │ │ │ ├── GetCurrentDatabasesInformationOptions.java │ │ │ ├── GetCapacityDatabasesInformationOptions.java │ │ │ ├── GetCurrentThroughputInformationOptions.java │ │ │ ├── GetCapacityThroughputInformationOptions.java │ │ │ ├── Change.java │ │ │ ├── DatabasesCountInformation.java │ │ │ ├── UuidsResult.java │ │ │ ├── BulkGetResult.java │ │ │ ├── SearchAnalyzeResult.java │ │ │ ├── DatabaseInformationProps.java │ │ │ ├── CurrentDatabasesInformation.java │ │ │ ├── SearchIndexDiskSize.java │ │ │ ├── CapacityDatabasesInformationCurrent.java │ │ │ ├── CapacityDatabasesInformation.java │ │ │ ├── CurrentThroughputInformation.java │ │ │ ├── ViewQueriesResult.java │ │ │ ├── CapacityThroughputInformationTarget.java │ │ │ ├── CapacityThroughputInformationCurrent.java │ │ │ ├── AllDocsQueriesResult.java │ │ │ ├── ShardsInformation.java │ │ │ ├── PartitionInformationIndexesIndexes.java │ │ │ ├── DocsResultRowValue.java │ │ │ ├── DocumentShardInfo.java │ │ │ ├── PartitionedIndexesDetailedInformation.java │ │ │ ├── BulkGetResultDocument.java │ │ │ ├── PartitionInformationSizes.java │ │ │ ├── DbUpdates.java │ │ │ ├── BulkGetResultItem.java │ │ │ ├── DesignDocumentInformation.java │ │ │ ├── IndexCandidate.java │ │ │ ├── ApiKeysResult.java │ │ │ ├── SchedulerJobsResult.java │ │ │ ├── IndexesInformation.java │ │ │ ├── SearchInfoResult.java │ │ │ ├── SchedulerDocsResult.java │ │ │ ├── SearchDiskSizeInformation.java │ │ │ └── RevsDiff.java │ │ └── features │ │ ├── package-info.java │ │ └── pagination │ │ ├── package-info.java │ │ ├── BookmarkPageIterator.java │ │ ├── FindBasePageIterator.java │ │ ├── SearchBasePageIterator.java │ │ ├── FindPager.java │ │ ├── AllDocsPageIterator.java │ │ └── SearchPageIterator.java │ └── test │ └── java │ └── com │ └── ibm │ └── cloud │ └── cloudant │ └── v1 │ └── model │ ├── OkTest.java │ ├── ChangeTest.java │ ├── UuidsResultTest.java │ ├── RevsDiffTest.java │ ├── DbEventTest.java │ ├── PostApiKeysOptionsTest.java │ ├── ShardsInformationTest.java │ ├── SearchAnalyzeResultTest.java │ ├── SearchIndexDiskSizeTest.java │ ├── GetActiveTasksOptionsTest.java │ ├── DbUpdatesTest.java │ ├── GetUpInformationOptionsTest.java │ ├── IndexResultTest.java │ ├── DocumentShardInfoTest.java │ ├── HeadUpInformationOptionsTest.java │ ├── ServerVendorTest.java │ ├── ApiKeysResultTest.java │ ├── DocsResultRowValueTest.java │ ├── GetCorsInformationOptionsTest.java │ ├── GetUuidsOptionsTest.java │ ├── DatabaseInformationPropsTest.java │ └── UpInformationTest.java ├── .github ├── dco.yml ├── dependabot.yml ├── workflows │ ├── docs.yml │ ├── codeql.yml │ └── test.yml ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md └── pull_request_template.md ├── docs └── README.md ├── .whitesource ├── examples └── snippets │ ├── getAllDbs │ └── example_request.java │ ├── postApiKeys │ └── example_request.java │ ├── getActiveTasks │ └── example_request.java │ ├── getCorsInformation │ └── example_request.java │ ├── getServerInformation │ └── example_request.java │ ├── getActivityTrackerEvents │ └── example_request.java │ ├── getMembershipInformation │ └── example_request.java │ ├── getCapacityThroughputInformation │ └── example_request.java │ ├── getCurrentThroughputInformation │ └── example_request.java │ ├── getSessionInformation │ └── example_request.java │ ├── headDatabase │ └── example_request.java │ ├── getUuids │ └── example_request.java │ ├── postChanges │ ├── example_request.java │ └── example_request_as_a_stream.java │ ├── putDatabase │ └── example_request.java │ ├── deleteDatabase │ └── example_request.java │ ├── getSecurity │ └── example_request.java │ ├── headSchedulerJob │ └── example_request.java │ ├── getDocument │ └── example_request.java │ ├── postDesignDocs │ └── example_request.java │ ├── getSchedulerJobs │ └── example_request.java │ ├── getDesignDocument │ └── example_request.java │ ├── getLocalDocument │ └── example_request.java │ ├── getSchedulerJob │ └── example_request.java │ ├── postAllDocs │ ├── example_request.java │ └── example_request_as_a_stream.java │ ├── getShardsInformation │ └── example_request.java │ ├── getDatabaseInformation │ └── example_request.java │ ├── getIndexesInformation │ └── example_request.java │ ├── getDbUpdates │ └── example_request.java │ ├── getSchedulerDocument │ └── example_request.java │ ├── putCorsConfiguration │ └── example_request.java │ ├── deleteLocalDocument │ └── example_request.java │ ├── getReplicationDocument │ └── example_request.java │ ├── getDocumentShardsInfo │ └── example_request.java │ ├── postSearchAnalyze │ └── example_request.java │ ├── postDbsInfo │ └── example_request.java │ ├── deleteDocument │ └── example_request.java │ ├── getSchedulerDocs │ └── example_request.java │ ├── putCapacityThroughputConfiguration │ └── example_request.java │ ├── postPartitionAllDocs │ └── example_request.java │ ├── getPartitionInformation │ └── example_request.java │ ├── deleteDesignDocument │ └── example_request.java │ ├── deleteReplicationDocument │ └── example_request.java │ ├── getDesignDocumentInformation │ └── example_request.java │ ├── postActivityTrackerEvents │ └── example_request.java │ ├── headDocument │ └── example_request.java │ ├── deleteIndex │ └── example_request.java │ ├── postView │ └── example_request.java │ ├── headReplicationDocument │ └── example_request.java │ ├── headDesignDocument │ └── example_request.java │ ├── postSearch │ └── example_request.java │ ├── postExplain │ └── example_request.java │ ├── getSearchInfo │ └── example_request.java │ ├── postBulkGet │ ├── alternative_example_request_for_open_revs_all.java │ ├── alternative_example_request_for_atts_since.java │ └── example_request.java │ ├── postDocument │ ├── example_request_as_a_stream.java │ └── example_request.java │ ├── deleteAttachment │ └── example_request.java │ ├── postPartitionExplain │ └── example_request.java │ ├── postPartitionView │ └── example_request.java │ ├── putDocument │ └── example_request.java │ ├── headUpInformation │ └── example_request.java │ ├── postPartitionSearch │ └── example_request.java │ ├── postAllDocsQueries │ └── example_request.java │ ├── postPartitionFind │ └── example_request.java │ ├── postDesignDocsQueries │ └── example_request.java │ ├── postFind │ ├── example_request_for_text_index_type.java │ └── example_request_for_json_index_type.java │ ├── getUpInformation │ └── example_request.java │ ├── headAttachment │ └── example_request.java │ ├── postIndex │ ├── example_request_using_json_type_index.java │ └── example_request_using_text_type_index.java │ ├── putAttachment │ └── example_request.java │ ├── getAttachment │ └── example_request.java │ ├── postRevsDiff │ └── example_request.java │ ├── postViewQueries │ └── example_request.java │ ├── putLocalDocument │ └── example_request.java │ ├── postBulkDocs │ ├── example_request_delete_documents.java │ ├── example_request_as_a_stream.java │ └── example_request_create_documents.java │ └── putSecurity │ └── example_request.java ├── checkstyle-suppressions.xml ├── .gitignore ├── .releaserc ├── scripts ├── setup_wiremock.sh ├── setup_couch.sh └── javadoc │ └── generate-index-html.sh ├── SECURITY.md ├── config └── java.header ├── .bumpversion.toml └── CONTRIBUTING.md /modules/examples/output/DeleteDoc.txt: -------------------------------------------------------------------------------- 1 | You have deleted the document. 2 | -------------------------------------------------------------------------------- /modules/examples/output/DeleteDoc2.txt: -------------------------------------------------------------------------------- 1 | Cannot delete document because either "orders" database or the "example" document was not found. 2 | -------------------------------------------------------------------------------- /.github/dco.yml: -------------------------------------------------------------------------------- 1 | # This enables DCO bot - https://github.com/probot/dco for more details. 2 | # Exclude org members from DCO sign-off on commits 3 | require: 4 | members: false 5 | -------------------------------------------------------------------------------- /modules/common/src/main/resources/cloudant-parent.properties: -------------------------------------------------------------------------------- 1 | title = ${git-repository-name} 2 | gitCommit = ${buildNumber} 3 | buildTimestamp = ${timestamp} 4 | version = ${project.version} 5 | -------------------------------------------------------------------------------- /modules/examples/output/CreateDbAndDoc.txt: -------------------------------------------------------------------------------- 1 | "orders" database created. 2 | You have created the document. Response body: 3 | { 4 | "id": "example", 5 | "rev": "1-1b403633540686aa32d013fda9041a5d", 6 | "ok": true 7 | } 8 | -------------------------------------------------------------------------------- /modules/examples/output/UpdateDoc.txt: -------------------------------------------------------------------------------- 1 | You have updated the document: 2 | { 3 | "_id": "example", 4 | "_rev": "2-4e2178e85cffb32d38ba4e451f6ca376", 5 | "address": "19 Front Street, Darlington, DL5 1TY", 6 | "name": "Bob Smith" 7 | } 8 | -------------------------------------------------------------------------------- /modules/examples/output/UpdateDoc2.txt: -------------------------------------------------------------------------------- 1 | You have updated the document: 2 | { 3 | "_id": "example", 4 | "_rev": "3-4f1787d7a0520f825bd36822d7be627a", 5 | "address": "19 Front Street, Darlington, DL5 1TY", 6 | "name": "Bob Smith" 7 | } 8 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # IBM Cloudant Java SDK Version 0.10.13 Detailed Documentation 2 | 3 | ## Table of Contents 4 | 5 | ### [Authentication](Authentication.md) 6 | 7 | ### [Changes Follower](Changes_Follower.md) 8 | 9 | ### [Examples](Examples.md) 10 | 11 | ### [Pagination](Pagination.md) 12 | -------------------------------------------------------------------------------- /modules/examples/output/GetInfoFromExistingDatabase.txt: -------------------------------------------------------------------------------- 1 | Server Version: 3.2.1 2 | Document count in "orders" database is 1. 3 | Document retrieved from database: 4 | { 5 | "_id": "example", 6 | "_rev": "1-1b403633540686aa32d013fda9041a5d", 7 | "joined": "2019-01-24T10:42:59.000Z", 8 | "name": "Bob Smith" 9 | } 10 | -------------------------------------------------------------------------------- /.whitesource: -------------------------------------------------------------------------------- 1 | { 2 | "settingsInheritedFrom": "whitesource-config/whitesource-config@master", 3 | "issueSettings": { 4 | "issueRepoName": "sdks" 5 | }, 6 | "scanSettings": { 7 | "javaVersion": "17", 8 | "python.requirementsFileIncludes": "pyproject.toml,requirements-dev.txt,requirements-docs.txt" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/snippets/getAllDbs/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | 4 | import java.util.List; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | List response = 9 | service.getAllDbs().execute().getResult(); 10 | 11 | System.out.println(response); 12 | -------------------------------------------------------------------------------- /examples/snippets/postApiKeys/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.ApiKeysResult; 4 | // section: code 5 | Cloudant service = Cloudant.newInstance(); 6 | 7 | ApiKeysResult response = 8 | service.postApiKeys().execute().getResult(); 9 | 10 | System.out.println(response); 11 | -------------------------------------------------------------------------------- /examples/snippets/getActiveTasks/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.ActiveTask; 4 | // section: code 5 | Cloudant service = Cloudant.newInstance(); 6 | 7 | List response = 8 | service.getActiveTasks().execute().getResult(); 9 | 10 | System.out.println(response); 11 | -------------------------------------------------------------------------------- /examples/snippets/getCorsInformation/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.CorsInformation; 4 | // section: code 5 | Cloudant service = Cloudant.newInstance(); 6 | 7 | CorsInformation response = 8 | service.getCorsInformation().execute().getResult(); 9 | 10 | System.out.println(response); 11 | -------------------------------------------------------------------------------- /examples/snippets/getServerInformation/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.ServerInformation; 4 | // section: code 5 | Cloudant service = Cloudant.newInstance(); 6 | 7 | ServerInformation response = 8 | service.getServerInformation().execute().getResult(); 9 | 10 | System.out.println(response); 11 | -------------------------------------------------------------------------------- /examples/snippets/getActivityTrackerEvents/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.ActivityTrackerEvents; 4 | // section: code 5 | Cloudant service = Cloudant.newInstance(); 6 | 7 | ActivityTrackerEvents response = 8 | service.getActivityTrackerEvents().execute().getResult(); 9 | 10 | System.out.println(response); 11 | -------------------------------------------------------------------------------- /examples/snippets/getMembershipInformation/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.MembershipInformation; 4 | // section: code 5 | Cloudant service = Cloudant.newInstance(); 6 | 7 | MembershipInformation response = 8 | service.getMembershipInformation().execute().getResult(); 9 | 10 | System.out.println(response); 11 | -------------------------------------------------------------------------------- /examples/snippets/getCapacityThroughputInformation/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.CapacityThroughputInformation; 4 | // section: code 5 | Cloudant service = Cloudant.newInstance(); 6 | 7 | CapacityThroughputInformation response = 8 | service.getCapacityThroughputInformation().execute().getResult(); 9 | 10 | System.out.println(response); 11 | -------------------------------------------------------------------------------- /examples/snippets/getCurrentThroughputInformation/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.CurrentThroughputInformation; 4 | // section: code 5 | Cloudant service = Cloudant.newInstance(); 6 | 7 | CurrentThroughputInformation response = 8 | service.getCurrentThroughputInformation().execute().getResult(); 9 | 10 | System.out.println(response); 11 | -------------------------------------------------------------------------------- /examples/snippets/getSessionInformation/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.SessionInformation; 4 | // section: code 5 | Cloudant service = Cloudant.newInstance(); 6 | 7 | SessionInformation response = 8 | service.getSessionInformation().execute().getResult(); 9 | 10 | System.out.println(response); 11 | // section: markdown 12 | // For more details on Session Authentication, see [Authentication.](#authentication) 13 | -------------------------------------------------------------------------------- /examples/snippets/headDatabase/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.HeadDatabaseOptions; 4 | // section: code 5 | Cloudant service = Cloudant.newInstance(); 6 | 7 | HeadDatabaseOptions databaseOptions = 8 | new HeadDatabaseOptions.Builder() 9 | .db("products") 10 | .build(); 11 | 12 | int statusCode = 13 | service.headDatabase(databaseOptions).execute().getStatusCode(); 14 | 15 | System.out.println(statusCode); 16 | -------------------------------------------------------------------------------- /examples/snippets/getUuids/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.GetUuidsOptions; 4 | import com.ibm.cloud.cloudant.v1.model.UuidsResult; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | GetUuidsOptions uuidsOptions = new GetUuidsOptions.Builder() 9 | .count(10) 10 | .build(); 11 | 12 | UuidsResult response = 13 | service.getUuids(uuidsOptions).execute() 14 | .getResult(); 15 | 16 | System.out.println(response); 17 | -------------------------------------------------------------------------------- /checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 10 | 12 | 14 | 15 | -------------------------------------------------------------------------------- /examples/snippets/postChanges/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.ChangesResult; 4 | import com.ibm.cloud.cloudant.v1.model.PostChangesOptions; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | PostChangesOptions changesOptions = new PostChangesOptions.Builder() 9 | .db("orders") 10 | .build(); 11 | 12 | ChangesResult response = 13 | service.postChanges(changesOptions).execute() 14 | .getResult(); 15 | 16 | System.out.println(response); 17 | -------------------------------------------------------------------------------- /examples/snippets/putDatabase/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.Ok; 4 | import com.ibm.cloud.cloudant.v1.model.PutDatabaseOptions; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | PutDatabaseOptions databaseOptions = new PutDatabaseOptions.Builder() 9 | .db("events") 10 | .partitioned(true) 11 | .build(); 12 | 13 | Ok response = 14 | service.putDatabase(databaseOptions).execute() 15 | .getResult(); 16 | 17 | System.out.println(response); 18 | -------------------------------------------------------------------------------- /examples/snippets/deleteDatabase/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.DeleteDatabaseOptions; 4 | import com.ibm.cloud.cloudant.v1.model.Ok; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | DeleteDatabaseOptions databaseOptions = 9 | new DeleteDatabaseOptions.Builder() 10 | .db("products") 11 | .build(); 12 | 13 | Ok response = 14 | service.deleteDatabase(databaseOptions).execute() 15 | .getResult(); 16 | 17 | System.out.println(response); 18 | -------------------------------------------------------------------------------- /examples/snippets/getSecurity/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.GetSecurityOptions; 4 | import com.ibm.cloud.cloudant.v1.model.Security; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | GetSecurityOptions securityOptions = 9 | new GetSecurityOptions.Builder() 10 | .db("products") 11 | .build(); 12 | 13 | Security response = 14 | service.getSecurity(securityOptions).execute() 15 | .getResult(); 16 | 17 | System.out.println(response); 18 | -------------------------------------------------------------------------------- /examples/snippets/headSchedulerJob/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.HeadSchedulerJobOptions; 4 | // section: code 5 | Cloudant service = Cloudant.newInstance(); 6 | 7 | HeadSchedulerJobOptions schedulerJobOptions = 8 | new HeadSchedulerJobOptions.Builder() 9 | .jobId("7b94915cd8c4a0173c77c55cd0443939+continuous") 10 | .build(); 11 | 12 | int statusCode = 13 | service.headSchedulerJob(schedulerJobOptions).execute() 14 | .getStatusCode(); 15 | 16 | System.out.println(statusCode); 17 | -------------------------------------------------------------------------------- /examples/snippets/getDocument/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.Document; 4 | import com.ibm.cloud.cloudant.v1.model.GetDocumentOptions; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | GetDocumentOptions documentOptions = 9 | new GetDocumentOptions.Builder() 10 | .db("products") 11 | .docId("1000042") 12 | .build(); 13 | 14 | Document response = 15 | service.getDocument(documentOptions).execute() 16 | .getResult(); 17 | 18 | System.out.println(response); 19 | -------------------------------------------------------------------------------- /examples/snippets/postDesignDocs/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.AllDocsResult; 4 | import com.ibm.cloud.cloudant.v1.model.PostDesignDocsOptions; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | PostDesignDocsOptions docsOptions = 9 | new PostDesignDocsOptions.Builder() 10 | .descending(true) 11 | .db("users") 12 | .build(); 13 | 14 | AllDocsResult response = 15 | service.postDesignDocs(docsOptions).execute() 16 | .getResult(); 17 | 18 | System.out.println(response); 19 | -------------------------------------------------------------------------------- /examples/snippets/getSchedulerJobs/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.GetSchedulerJobsOptions; 4 | import com.ibm.cloud.cloudant.v1.model.SchedulerJobsResult; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | GetSchedulerJobsOptions schedulerJobsOptions = 9 | new GetSchedulerJobsOptions.Builder() 10 | .limit(100) 11 | .build(); 12 | 13 | SchedulerJobsResult response = 14 | service.getSchedulerJobs(schedulerJobsOptions).execute() 15 | .getResult(); 16 | 17 | System.out.println(response); 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | 25 | /**/target/ 26 | /**/test-output/ 27 | .settings/ 28 | .classpath 29 | .project 30 | .factorypath 31 | *-apiref.json 32 | 33 | .idea 34 | .openapi-generator/ 35 | .openapi-generator-ignore 36 | 37 | # credentials files 38 | *.env 39 | 40 | package-lock.json 41 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | pull-request-branch-name: 8 | separator: "-" 9 | - package-ecosystem: "maven" 10 | directory: "/" 11 | open-pull-requests-limit: 10 12 | schedule: 13 | interval: "daily" 14 | pull-request-branch-name: 15 | separator: "-" 16 | # Custom settings 17 | - package-ecosystem: "github-actions" 18 | directory: "/" 19 | schedule: 20 | interval: "weekly" 21 | target-branch: "gh-pages" 22 | pull-request-branch-name: 23 | separator: "-" 24 | 25 | -------------------------------------------------------------------------------- /examples/snippets/getDesignDocument/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.DesignDocument; 4 | import com.ibm.cloud.cloudant.v1.model.GetDesignDocumentOptions; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | GetDesignDocumentOptions designDocumentOptions = new GetDesignDocumentOptions.Builder() 9 | .db("products") 10 | .ddoc("appliances") 11 | .build(); 12 | 13 | DesignDocument response = 14 | service.getDesignDocument(designDocumentOptions).execute() 15 | .getResult(); 16 | 17 | System.out.println(response); 18 | -------------------------------------------------------------------------------- /examples/snippets/getLocalDocument/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.Document; 4 | import com.ibm.cloud.cloudant.v1.model.GetLocalDocumentOptions; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | GetLocalDocumentOptions documentOptions = 9 | new GetLocalDocumentOptions.Builder() 10 | .db("orders") 11 | .docId("local-0007741142412418284") 12 | .build(); 13 | 14 | Document response = 15 | service.getLocalDocument(documentOptions).execute() 16 | .getResult(); 17 | 18 | System.out.println(response); 19 | -------------------------------------------------------------------------------- /examples/snippets/getSchedulerJob/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.GetSchedulerJobOptions; 4 | import com.ibm.cloud.cloudant.v1.model.SchedulerJob; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | GetSchedulerJobOptions schedulerJobOptions = 9 | new GetSchedulerJobOptions.Builder() 10 | .jobId("7b94915cd8c4a0173c77c55cd0443939+continuous") 11 | .build(); 12 | 13 | SchedulerJob response = 14 | service.getSchedulerJob(schedulerJobOptions).execute() 15 | .getResult(); 16 | 17 | System.out.println(response); 18 | -------------------------------------------------------------------------------- /examples/snippets/postAllDocs/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.AllDocsResult; 4 | import com.ibm.cloud.cloudant.v1.model.PostAllDocsOptions; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | PostAllDocsOptions docsOptions = 9 | new PostAllDocsOptions.Builder() 10 | .db("orders") 11 | .includeDocs(true) 12 | .startKey("abc") 13 | .limit(10) 14 | .build(); 15 | 16 | AllDocsResult response = 17 | service.postAllDocs(docsOptions).execute().getResult(); 18 | 19 | System.out.println(response); 20 | -------------------------------------------------------------------------------- /.github/workflows/docs.yml: -------------------------------------------------------------------------------- 1 | name: docs 2 | on: 3 | pull_request: 4 | branches: ['main'] 5 | permissions: {} 6 | jobs: 7 | docs: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout code 11 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 12 | with: 13 | persist-credentials: false 14 | - name: Setup java 25 15 | uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0 16 | with: 17 | distribution: 'semeru' 18 | java-version: '25' 19 | cache: 'maven' 20 | check-latest: false 21 | - name: Build docs 22 | run: mvn javadoc:aggregate 23 | -------------------------------------------------------------------------------- /examples/snippets/getShardsInformation/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.GetShardsInformationOptions; 4 | import com.ibm.cloud.cloudant.v1.model.ShardsInformation; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | GetShardsInformationOptions shardsInformationOptions = 9 | new GetShardsInformationOptions.Builder() 10 | .db("products") 11 | .build(); 12 | 13 | ShardsInformation response = 14 | service.getShardsInformation(shardsInformationOptions) 15 | .execute().getResult(); 16 | 17 | System.out.println(response); 18 | -------------------------------------------------------------------------------- /.releaserc: -------------------------------------------------------------------------------- 1 | { 2 | "debug": true, 3 | "tagFormat": "${version}", 4 | "plugins": [ 5 | "@semantic-release/commit-analyzer", 6 | "@semantic-release/release-notes-generator", 7 | "@semantic-release/changelog", 8 | [ 9 | "@semantic-release/exec", 10 | { 11 | "prepareCmd": "bump2version --allow-dirty --current-version ${lastRelease.version} --new-version ${nextRelease.version} patch" 12 | } 13 | ], 14 | [ 15 | "@semantic-release/git", 16 | { 17 | "message": "chore(release): ${nextRelease.version} release notes\n\n${nextRelease.notes}" 18 | } 19 | ], 20 | "@semantic-release/github" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /examples/snippets/getDatabaseInformation/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.DatabaseInformation; 4 | import com.ibm.cloud.cloudant.v1.model.GetDatabaseInformationOptions; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | GetDatabaseInformationOptions databaseInfoOptions = 9 | new GetDatabaseInformationOptions.Builder() 10 | .db("products") 11 | .build(); 12 | 13 | DatabaseInformation response = 14 | service.getDatabaseInformation(databaseInfoOptions).execute() 15 | .getResult(); 16 | 17 | System.out.println(response); 18 | -------------------------------------------------------------------------------- /examples/snippets/getIndexesInformation/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.GetIndexesInformationOptions; 4 | import com.ibm.cloud.cloudant.v1.model.IndexesInformation; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | GetIndexesInformationOptions indexesInformationOptions = 9 | new GetIndexesInformationOptions.Builder() 10 | .db("users") 11 | .build(); 12 | 13 | IndexesInformation response = 14 | service.getIndexesInformation(indexesInformationOptions).execute() 15 | .getResult(); 16 | 17 | System.out.println(response); 18 | -------------------------------------------------------------------------------- /examples/snippets/getDbUpdates/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.DbUpdates; 4 | import com.ibm.cloud.cloudant.v1.model.GetDbUpdatesOptions; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | GetDbUpdatesOptions dbUpdatesOptions = new GetDbUpdatesOptions.Builder() 9 | .feed("normal") 10 | .since("now") 11 | .build(); 12 | 13 | DbUpdates response = 14 | service.getDbUpdates(dbUpdatesOptions).execute() 15 | .getResult(); 16 | 17 | System.out.println(response); 18 | // section: markdown 19 | // This request requires `server_admin` access. 20 | -------------------------------------------------------------------------------- /examples/snippets/getSchedulerDocument/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.GetSchedulerDocumentOptions; 4 | import com.ibm.cloud.cloudant.v1.model.SchedulerDocument; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | GetSchedulerDocumentOptions schedulerDocumentOptions = 9 | new GetSchedulerDocumentOptions.Builder() 10 | .docId("repldoc-example") 11 | .build(); 12 | 13 | SchedulerDocument response = 14 | service.getSchedulerDocument(schedulerDocumentOptions).execute() 15 | .getResult(); 16 | 17 | System.out.println(response); 18 | -------------------------------------------------------------------------------- /examples/snippets/putCorsConfiguration/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.Ok; 4 | import com.ibm.cloud.cloudant.v1.model.PutCorsConfigurationOptions; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | PutCorsConfigurationOptions configurationOptions = 9 | new PutCorsConfigurationOptions.Builder() 10 | .addOrigins("https://example.com") 11 | .enableCors(true) 12 | .build(); 13 | 14 | Ok response = 15 | service.putCorsConfiguration(configurationOptions).execute() 16 | .getResult(); 17 | 18 | System.out.println(response); 19 | -------------------------------------------------------------------------------- /examples/snippets/deleteLocalDocument/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.DeleteLocalDocumentOptions; 4 | import com.ibm.cloud.cloudant.v1.model.DocumentResult; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | DeleteLocalDocumentOptions documentOptions = 9 | new DeleteLocalDocumentOptions.Builder() 10 | .db("orders") 11 | .docId("local-0007741142412418284") 12 | .build(); 13 | 14 | DocumentResult response = 15 | service.deleteLocalDocument(documentOptions).execute() 16 | .getResult(); 17 | 18 | System.out.println(response); 19 | -------------------------------------------------------------------------------- /examples/snippets/getReplicationDocument/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.GetReplicationDocumentOptions; 4 | import com.ibm.cloud.cloudant.v1.model.ReplicationDocument; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | GetReplicationDocumentOptions replicationDocOptions = 9 | new GetReplicationDocumentOptions.Builder() 10 | .docId("repldoc-example") 11 | .build(); 12 | 13 | ReplicationDocument response = 14 | service.getReplicationDocument(replicationDocOptions).execute() 15 | .getResult(); 16 | 17 | System.out.println(response); 18 | -------------------------------------------------------------------------------- /scripts/setup_wiremock.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -ev 4 | 5 | printenv | grep "^WIREMOCK_" > wiremock.env 6 | # setup env file for gen ITs 7 | echo -e "CLOUDANT_AUTH_TYPE=noauth\nCLOUDANT_URL=$WIREMOCK_URL" >> cloudant_v1.env 8 | 9 | # use image at ARTIFACTORY_DOCKER_REPO_VIRTUAL registry if set, otherwise use default registry 10 | timeout 120 bash -c 'while [[ "$(curl -s --location -o /dev/null -w ''%{http_code}'' ${WIREMOCK_URL}/__admin)" != "200" ]]; do sleep 2; done' || false 11 | curl "$WIREMOCK_URL"/__admin/mappings/import -X POST -d @stubs/mappings.json 12 | curl "$WIREMOCK_URL"/__admin/mappings/import -X POST -d @stubs/gen-its-mappings.json 13 | echo "Wiremock started" 14 | -------------------------------------------------------------------------------- /examples/snippets/getDocumentShardsInfo/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.DocumentShardInfo; 4 | import com.ibm.cloud.cloudant.v1.model.GetDocumentShardsInfoOptions; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | GetDocumentShardsInfoOptions shardsInfoOptions = 9 | new GetDocumentShardsInfoOptions.Builder() 10 | .db("products") 11 | .docId("1000042") 12 | .build(); 13 | 14 | DocumentShardInfo response = 15 | service.getDocumentShardsInfo(shardsInfoOptions).execute() 16 | .getResult(); 17 | 18 | System.out.println(response); 19 | -------------------------------------------------------------------------------- /examples/snippets/postSearchAnalyze/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.PostSearchAnalyzeOptions; 4 | import com.ibm.cloud.cloudant.v1.model.SearchAnalyzeResult; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | PostSearchAnalyzeOptions searchAnalyzerOptions = 9 | new PostSearchAnalyzeOptions.Builder() 10 | .analyzer("english") 11 | .text("running is fun") 12 | .build(); 13 | 14 | SearchAnalyzeResult response = 15 | service.postSearchAnalyze(searchAnalyzerOptions).execute() 16 | .getResult(); 17 | 18 | System.out.println(response); 19 | -------------------------------------------------------------------------------- /examples/snippets/postDbsInfo/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.DbsInfoResult; 4 | import com.ibm.cloud.cloudant.v1.model.PostDbsInfoOptions; 5 | 6 | import java.util.Arrays; 7 | import java.util.List; 8 | // section: code 9 | Cloudant service = Cloudant.newInstance(); 10 | 11 | PostDbsInfoOptions dbsInfoOptions = 12 | new PostDbsInfoOptions.Builder() 13 | .keys(Arrays.asList("products", "users", "orders")) 14 | .build(); 15 | 16 | List response = 17 | service.postDbsInfo(dbsInfoOptions).execute() 18 | .getResult(); 19 | 20 | System.out.println(response); 21 | -------------------------------------------------------------------------------- /examples/snippets/deleteDocument/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.DeleteDocumentOptions; 4 | import com.ibm.cloud.cloudant.v1.model.DocumentResult; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | DeleteDocumentOptions documentOptions = 9 | new DeleteDocumentOptions.Builder() 10 | .db("orders") 11 | .docId("order00058") 12 | .rev("1-00000000000000000000000000000000") 13 | .build(); 14 | 15 | DocumentResult response = 16 | service.deleteDocument(documentOptions).execute() 17 | .getResult(); 18 | 19 | System.out.println(response); 20 | -------------------------------------------------------------------------------- /examples/snippets/getSchedulerDocs/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.GetSchedulerDocsOptions; 4 | import com.ibm.cloud.cloudant.v1.model.SchedulerDocsResult; 5 | 6 | import java.util.Arrays; 7 | // section: code 8 | Cloudant service = Cloudant.newInstance(); 9 | 10 | GetSchedulerDocsOptions schedulerDocsOptions = new GetSchedulerDocsOptions.Builder() 11 | .limit(100) 12 | .states(Arrays.asList("completed")) 13 | .build(); 14 | 15 | SchedulerDocsResult response = 16 | service.getSchedulerDocs(schedulerDocsOptions).execute() 17 | .getResult(); 18 | 19 | System.out.println(response); 20 | -------------------------------------------------------------------------------- /examples/snippets/putCapacityThroughputConfiguration/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.CapacityThroughputInformation; 4 | import com.ibm.cloud.cloudant.v1.model.PutCapacityThroughputConfigurationOptions; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | PutCapacityThroughputConfigurationOptions options = 9 | new PutCapacityThroughputConfigurationOptions.Builder() 10 | .blocks(1) 11 | .build(); 12 | 13 | CapacityThroughputInformation response = 14 | service.putCapacityThroughputConfiguration(options).execute().getResult(); 15 | 16 | System.out.println(response); 17 | -------------------------------------------------------------------------------- /examples/snippets/postPartitionAllDocs/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.AllDocsResult; 4 | import com.ibm.cloud.cloudant.v1.model.PostPartitionAllDocsOptions; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | PostPartitionAllDocsOptions allDocsOptions = 9 | new PostPartitionAllDocsOptions.Builder() 10 | .db("events") 11 | .partitionKey("ns1HJS13AMkK") 12 | .includeDocs(true) 13 | .build(); 14 | 15 | AllDocsResult response = 16 | service.postPartitionAllDocs(allDocsOptions).execute() 17 | .getResult(); 18 | 19 | System.out.println(response); 20 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | | Version | Supported | 6 | | ------- | ------------------ | 7 | | latest | :white_check_mark: | 8 | 9 | ## Reporting a Vulnerability 10 | 11 | If you believe you have found a vulnerability please report it responsibly. IBM has documented the process for reporting vulnerabilities at https://www.ibm.com/trust/security-psirt. 12 | 13 | ## Vulnerabilities in dependencies 14 | 15 | The SDK is regularly scanned for known CVEs in dependencies and updates to versions with remediations are applied and released as soon as possible. 16 | Reporting known CVEs in dependencies in this repository is not necessary and will not lead to a faster resolution. 17 | -------------------------------------------------------------------------------- /examples/snippets/getPartitionInformation/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.GetPartitionInformationOptions; 4 | import com.ibm.cloud.cloudant.v1.model.PartitionInformation; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | GetPartitionInformationOptions informationOptions = 9 | new GetPartitionInformationOptions.Builder() 10 | .db("events") 11 | .partitionKey("ns1HJS13AMkK") 12 | .build(); 13 | 14 | PartitionInformation response = 15 | service.getPartitionInformation(informationOptions).execute() 16 | .getResult(); 17 | 18 | System.out.println(response); 19 | -------------------------------------------------------------------------------- /scripts/setup_couch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -ev 4 | 5 | printenv | grep "^SERVER_" >> cloudant_v1.env 6 | # if you change the image version please regenerate example output captures 7 | # use image at ARTIFACTORY_DOCKER_REPO_VIRTUAL registry if set, otherwise use default registry 8 | 9 | # shellcheck disable=SC2016 10 | timeout 120 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' ${SERVER_URL}/_up)" != "200" ]]; do sleep 5; done' || false 11 | curl -XPUT -u "$SERVER_USERNAME":"$SERVER_PASSWORD" "$SERVER_URL"/_users 12 | curl -XPUT -u "$SERVER_USERNAME":"$SERVER_PASSWORD" "$SERVER_URL"/stores 13 | curl -XPOST -u "$SERVER_USERNAME":"$SERVER_PASSWORD" -H "Content-type: application/json" -d '{}' "$SERVER_URL"/stores 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | 12 | 13 | **Describe the solution you'd like** 14 | 15 | 16 | **Describe alternatives you've considered** 17 | 18 | 19 | **Additional context** 20 | 21 | -------------------------------------------------------------------------------- /examples/snippets/deleteDesignDocument/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.DeleteDesignDocumentOptions; 4 | import com.ibm.cloud.cloudant.v1.model.DocumentResult; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | DeleteDesignDocumentOptions designDocumentOptions = 9 | new DeleteDesignDocumentOptions.Builder() 10 | .db("products") 11 | .ddoc("appliances") 12 | .rev("1-00000000000000000000000000000000") 13 | .build(); 14 | 15 | DocumentResult response = 16 | service.deleteDesignDocument(designDocumentOptions).execute() 17 | .getResult(); 18 | 19 | System.out.println(response); 20 | -------------------------------------------------------------------------------- /examples/snippets/deleteReplicationDocument/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.DeleteReplicationDocumentOptions; 4 | import com.ibm.cloud.cloudant.v1.model.DocumentResult; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | DeleteReplicationDocumentOptions replicationDocOptions = 9 | new DeleteReplicationDocumentOptions.Builder() 10 | .docId("repldoc-example") 11 | .rev("1-00000000000000000000000000000000") 12 | .build(); 13 | 14 | DocumentResult response = 15 | service.deleteReplicationDocument(replicationDocOptions).execute() 16 | .getResult(); 17 | 18 | System.out.println(response); 19 | -------------------------------------------------------------------------------- /examples/snippets/getDesignDocumentInformation/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.DesignDocumentInformation; 4 | import com.ibm.cloud.cloudant.v1.model.GetDesignDocumentInformationOptions; 5 | 6 | 7 | // section: code 8 | Cloudant service = Cloudant.newInstance(); 9 | 10 | GetDesignDocumentInformationOptions informationOptions = 11 | new GetDesignDocumentInformationOptions.Builder() 12 | .db("products") 13 | .ddoc("appliances") 14 | .build(); 15 | 16 | DesignDocumentInformation response = 17 | service.getDesignDocumentInformation(informationOptions).execute() 18 | .getResult(); 19 | 20 | System.out.println(response); 21 | -------------------------------------------------------------------------------- /config/java.header: -------------------------------------------------------------------------------- 1 | ^\/\*+$ 2 | ^ \* (© Copyright IBM Corporation 20\d\d(?:, 20\d\d)?\. All Rights Reserved\.|\(C\) Copyright IBM Corp. 20\d\d\.)$ 3 | ^ \*$ 4 | ^ \* Licensed under the Apache License, Version 2\.0 \(the "License"\); you may not use this file except in compliance with$ 5 | ^ \* the License\. You may obtain a copy of the License at$ 6 | ^ \*$ 7 | ^ \* http:\/\/www\.apache\.org\/licenses\/LICENSE-2\.0$ 8 | ^ \*$ 9 | ^ \* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on$ 10 | ^ \* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\. See the License for the$ 11 | ^ \* specific language governing permissions and limitations under the License\.$ 12 | ^ \*\/$ 13 | -------------------------------------------------------------------------------- /examples/snippets/postActivityTrackerEvents/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.ActivityTrackerEvents; 4 | import com.ibm.cloud.cloudant.v1.model.Ok; 5 | import com.ibm.cloud.cloudant.v1.model.PostActivityTrackerEventsOptions; 6 | // section: code 7 | Cloudant service = Cloudant.newInstance(); 8 | 9 | PostActivityTrackerEventsOptions options = 10 | new PostActivityTrackerEventsOptions.Builder() 11 | .addTypes(ActivityTrackerEvents.Types.MANAGEMENT) 12 | .addTypes(ActivityTrackerEvents.Types.DATA) 13 | .build(); 14 | 15 | Ok response = 16 | service.postActivityTrackerEvents(options).execute().getResult(); 17 | 18 | System.out.println(response); 19 | -------------------------------------------------------------------------------- /examples/snippets/headDocument/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.sdk.core.http.Headers; 3 | 4 | import com.ibm.cloud.cloudant.v1.Cloudant; 5 | import com.ibm.cloud.cloudant.v1.model.HeadDocumentOptions; 6 | // section: code 7 | Cloudant service = Cloudant.newInstance(); 8 | HeadDocumentOptions documentOptions = 9 | new HeadDocumentOptions.Builder() 10 | .db("orders") 11 | .docId("order00058") 12 | .build(); 13 | 14 | int statusCode = 15 | service.headDocument(documentOptions).execute() 16 | .getStatusCode(); 17 | Headers headers = 18 | service.headDocument(documentOptions).execute() 19 | .getHeaders(); 20 | 21 | System.out.println(statusCode); 22 | System.out.println(headers.values("ETag")); 23 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | /** 15 | * Cloudant v1. 16 | */ 17 | package com.ibm.cloud.cloudant.v1; 18 | -------------------------------------------------------------------------------- /examples/snippets/deleteIndex/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.DeleteIndexOptions; 4 | import com.ibm.cloud.cloudant.v1.model.Ok; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | DeleteIndexOptions indexOptions = new DeleteIndexOptions.Builder() 9 | .db("users") 10 | .ddoc("json-index") 11 | .index("getUserByName") 12 | .type("json") 13 | .build(); 14 | 15 | Ok response = 16 | service.deleteIndex(indexOptions).execute() 17 | .getResult(); 18 | 19 | System.out.println(response); 20 | // section: markdown 21 | // This example will fail if `getUserByName` index doesn't exist. To create the index, see [Create a new index on a database.](#postindex) 22 | -------------------------------------------------------------------------------- /examples/snippets/postChanges/example_request_as_a_stream.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.PostChangesOptions; 4 | 5 | import java.io.InputStream; 6 | import java.io.File; 7 | import java.nio.file.StandardCopyOption; 8 | // section: code 9 | Cloudant service = Cloudant.newInstance(); 10 | 11 | PostChangesOptions changesOptions = new PostChangesOptions.Builder() 12 | .db("orders") 13 | .build(); 14 | 15 | File file = new File("result.json"); 16 | 17 | try (InputStream response = 18 | service.postChangesAsStream(changesOptions).execute() 19 | .getResult()) { 20 | java.nio.file.Files.copy( 21 | response, 22 | file.toPath(), 23 | StandardCopyOption.REPLACE_EXISTING); 24 | } 25 | -------------------------------------------------------------------------------- /examples/snippets/postView/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.PostViewOptions; 4 | import com.ibm.cloud.cloudant.v1.model.ViewResult; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | PostViewOptions viewOptions = new PostViewOptions.Builder() 9 | .db("users") 10 | .ddoc("allusers") 11 | .view("getVerifiedEmails") 12 | .build(); 13 | 14 | ViewResult response = 15 | service.postView(viewOptions).execute() 16 | .getResult(); 17 | 18 | System.out.println(response); 19 | // section: markdown 20 | // This example requires the `getVerifiedEmails` view to exist. To create the design document with this view, see [Create or modify a design document.](#putdesigndocument) 21 | -------------------------------------------------------------------------------- /examples/snippets/headReplicationDocument/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.sdk.core.http.Headers; 3 | 4 | import com.ibm.cloud.cloudant.v1.Cloudant; 5 | import com.ibm.cloud.cloudant.v1.model.HeadReplicationDocumentOptions; 6 | // section: code 7 | Cloudant service = Cloudant.newInstance(); 8 | 9 | HeadReplicationDocumentOptions replicationDocOptions = 10 | new HeadReplicationDocumentOptions.Builder() 11 | .docId("repldoc-example") 12 | .build(); 13 | 14 | int statusCode = 15 | service.headReplicationDocument(replicationDocOptions).execute().getStatusCode(); 16 | 17 | Headers headers = 18 | service.headReplicationDocument(replicationDocOptions).execute().getHeaders(); 19 | 20 | System.out.println(statusCode); 21 | System.out.println(headers.values("ETag")); 22 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/features/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2022. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | /** 15 | * Helper utilities for working with the changes feed. 16 | */ 17 | package com.ibm.cloud.cloudant.features; 18 | -------------------------------------------------------------------------------- /examples/snippets/headDesignDocument/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.sdk.core.http.Headers; 3 | 4 | import com.ibm.cloud.cloudant.v1.Cloudant; 5 | import com.ibm.cloud.cloudant.v1.model.HeadDesignDocumentOptions; 6 | // section: code 7 | Cloudant service = Cloudant.newInstance(); 8 | 9 | HeadDesignDocumentOptions designDocumentOptions = 10 | new HeadDesignDocumentOptions.Builder() 11 | .db("events") 12 | .ddoc("checkout") 13 | .build(); 14 | 15 | int statusCode = 16 | service.headDesignDocument(designDocumentOptions).execute() 17 | .getStatusCode(); 18 | 19 | Headers headers = 20 | service.headDesignDocument(designDocumentOptions).execute() 21 | .getHeaders(); 22 | 23 | System.out.println(statusCode); 24 | System.out.println(headers.values("ETag")); 25 | -------------------------------------------------------------------------------- /examples/snippets/postSearch/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.PostSearchOptions; 4 | import com.ibm.cloud.cloudant.v1.model.SearchResult; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | PostSearchOptions searchOptions = new PostSearchOptions.Builder() 9 | .db("users") 10 | .ddoc("allusers") 11 | .index("activeUsers") 12 | .query("name:Jane* AND active:True") 13 | .build(); 14 | 15 | SearchResult response = 16 | service.postSearch(searchOptions).execute() 17 | .getResult(); 18 | 19 | System.out.println(response); 20 | // section: markdown 21 | // This example requires the `activeUsers` Cloudant Search index to exist. To create the design document with this index, see [Create or modify a design document.](#putdesigndocument) 22 | -------------------------------------------------------------------------------- /examples/snippets/postExplain/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.ExplainResult; 4 | import com.ibm.cloud.cloudant.v1.model.PostExplainOptions; 5 | 6 | import java.util.Collections; 7 | import java.util.Map; 8 | // section: code 9 | Cloudant service = Cloudant.newInstance(); 10 | 11 | Map selector = Collections.singletonMap( 12 | "type", 13 | Collections.singletonMap("$eq", "user")); 14 | 15 | PostExplainOptions explainOptions = 16 | new PostExplainOptions.Builder() 17 | .db("users") 18 | .executionStats(true) 19 | .limit(10) 20 | .selector(selector) 21 | .build(); 22 | 23 | ExplainResult response = 24 | service.postExplain(explainOptions).execute() 25 | .getResult(); 26 | 27 | System.out.println(response); 28 | -------------------------------------------------------------------------------- /examples/snippets/getSearchInfo/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.GetSearchInfoOptions; 4 | import com.ibm.cloud.cloudant.v1.model.SearchInfoResult; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | GetSearchInfoOptions infoOptions = 9 | new GetSearchInfoOptions.Builder() 10 | .db("events") 11 | .ddoc("checkout") 12 | .index("findByDate") 13 | .build(); 14 | 15 | SearchInfoResult response = 16 | service.getSearchInfo(infoOptions).execute() 17 | .getResult(); 18 | 19 | System.out.println(response); 20 | // section: markdown 21 | // This example requires the `findByDate` Cloudant Search partitioned index to exist. To create the design document with this index, see [Create or modify a design document.](#putdesigndocument) 22 | -------------------------------------------------------------------------------- /modules/common/src/main/java/com/ibm/cloud/cloudant/security/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * © Copyright IBM Corporation 2020. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | /** 15 | * This package contains security related API classes. 16 | * 17 | * @since 0.0 18 | * @version 0.0 19 | */ 20 | package com.ibm.cloud.cloudant.security; 21 | -------------------------------------------------------------------------------- /.bumpversion.toml: -------------------------------------------------------------------------------- 1 | [tool.bumpversion] 2 | current_version = "0.10.13" 3 | commit = true 4 | message = "Update version {current_version} -> {new_version}" 5 | parse = "^(?P0|[1-9]\\d*)\\.(?P0|[1-9]\\d*)\\.(?P0|[1-9]\\d*)(?:-(?P(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+(?P[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$" 6 | serialize = [ 7 | "{major}.{minor}.{patch}-{prerelease}+{buildmetadata}", 8 | "{major}.{minor}.{patch}-{prerelease}", 9 | "{major}.{minor}.{patch}+{buildmetadata}", 10 | "{major}.{minor}.{patch}", 11 | ] 12 | 13 | [[tool.bumpversion.files]] 14 | filename = "README.md" 15 | search = "{current_version}" 16 | replace = "{new_version}" 17 | 18 | [[tool.bumpversion.files]] 19 | glob = "docs/*.md" 20 | ignore_missing_version = true 21 | search = "{current_version}" 22 | replace = "{new_version}" 23 | -------------------------------------------------------------------------------- /examples/snippets/postAllDocs/example_request_as_a_stream.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.PostAllDocsOptions; 4 | 5 | import java.io.InputStream; 6 | import java.io.File; 7 | import java.nio.file.StandardCopyOption; 8 | // section: code 9 | Cloudant service = Cloudant.newInstance(); 10 | 11 | PostAllDocsOptions docsOptions = 12 | new PostAllDocsOptions.Builder() 13 | .db("orders") 14 | .includeDocs(true) 15 | .startKey("abc") 16 | .limit(10) 17 | .build(); 18 | 19 | File file = new File("result.json"); 20 | 21 | try (InputStream response = 22 | service.postAllDocsAsStream(docsOptions).execute() 23 | .getResult()) { 24 | java.nio.file.Files.copy( 25 | response, 26 | file.toPath(), 27 | StandardCopyOption.REPLACE_EXISTING); 28 | } 29 | -------------------------------------------------------------------------------- /examples/snippets/postBulkGet/alternative_example_request_for_open_revs_all.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.BulkGetQueryDocument; 4 | import com.ibm.cloud.cloudant.v1.model.BulkGetResult; 5 | import com.ibm.cloud.cloudant.v1.model.PostBulkGetOptions; 6 | 7 | import java.util.Arrays; 8 | // section: code 9 | Cloudant service = Cloudant.newInstance(); 10 | 11 | BulkGetQueryDocument bulkGetDoc = 12 | new BulkGetQueryDocument.Builder() 13 | .id("order00067") 14 | .build(); 15 | 16 | PostBulkGetOptions postBulkGetOptions = 17 | new PostBulkGetOptions.Builder() 18 | .db("orders") 19 | .docs(Arrays.asList(bulkGetDoc)) 20 | .build(); 21 | 22 | BulkGetResult response = 23 | service.postBulkGet(postBulkGetOptions).execute() 24 | .getResult(); 25 | 26 | System.out.println(response); 27 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/features/pagination/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * © Copyright IBM Corporation 2025. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | /** 15 | * Feature for paginating operation requests. 16 | * 17 | * Accessed via the {@link Pagination} class. 18 | * 19 | */ 20 | package com.ibm.cloud.cloudant.features.pagination; 21 | -------------------------------------------------------------------------------- /examples/snippets/postDocument/example_request_as_a_stream.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import java.io.FileInputStream; 3 | 4 | import com.ibm.cloud.cloudant.v1.Cloudant; 5 | import com.ibm.cloud.cloudant.v1.model.Document; 6 | import com.ibm.cloud.cloudant.v1.model.DocumentResult; 7 | import com.ibm.cloud.cloudant.v1.model.PostDocumentOptions; 8 | // section: code 9 | Cloudant service = Cloudant.newInstance(); 10 | 11 | try (FileInputStream productsDocumentStream = new FileInputStream("products_doc.json")) { 12 | PostDocumentOptions documentOptions = 13 | new PostDocumentOptions.Builder() 14 | .db("products") 15 | .contentType("application/json") 16 | .body(productsDocumentStream) 17 | .build(); 18 | 19 | DocumentResult response = 20 | service.postDocument(documentOptions).execute() 21 | .getResult(); 22 | 23 | System.out.println(response); 24 | } 25 | -------------------------------------------------------------------------------- /examples/snippets/deleteAttachment/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.DeleteAttachmentOptions; 4 | import com.ibm.cloud.cloudant.v1.model.DocumentResult; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | DeleteAttachmentOptions attachmentOptions = 9 | new DeleteAttachmentOptions.Builder() 10 | .db("products") 11 | .docId("1000042") 12 | .attachmentName("product_details.txt") 13 | .rev("4-33333333333333333333333333333333") 14 | .build(); 15 | 16 | DocumentResult response = 17 | service.deleteAttachment(attachmentOptions).execute() 18 | .getResult(); 19 | 20 | System.out.println(response); 21 | // section: markdown 22 | // This example requires the `product_details.txt` attachment in `1000042` document to exist. To create the attachment, see [Create or modify an attachment.](#putattachment) 23 | -------------------------------------------------------------------------------- /examples/snippets/postPartitionExplain/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.ExplainResult; 4 | import com.ibm.cloud.cloudant.v1.model.PostPartitionExplainOptions; 5 | 6 | import java.util.Collections; 7 | import java.util.Map; 8 | // section: code 9 | Cloudant service = Cloudant.newInstance(); 10 | 11 | Map selector = Collections.singletonMap( 12 | "userId", 13 | Collections.singletonMap("$eq", "abc123")); 14 | 15 | PostPartitionExplainOptions explainOptions = 16 | new PostPartitionExplainOptions.Builder() 17 | .db("events") 18 | .executionStats(true) 19 | .limit(10) 20 | .partitionKey("ns1HJS13AMkK") 21 | .selector(selector) 22 | .build(); 23 | 24 | ExplainResult response = 25 | service.postPartitionExplain(explainOptions).execute() 26 | .getResult(); 27 | 28 | System.out.println(response); 29 | -------------------------------------------------------------------------------- /examples/snippets/postPartitionView/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.PostPartitionViewOptions; 4 | import com.ibm.cloud.cloudant.v1.model.ViewResult; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | PostPartitionViewOptions viewOptions = 9 | new PostPartitionViewOptions.Builder() 10 | .db("events") 11 | .ddoc("checkout") 12 | .includeDocs(true) 13 | .limit(10) 14 | .partitionKey("ns1HJS13AMkK") 15 | .view("byProductId") 16 | .build(); 17 | 18 | ViewResult response = 19 | service.postPartitionView(viewOptions).execute() 20 | .getResult(); 21 | 22 | System.out.println(response); 23 | // section: markdown 24 | // This example requires the `byProductId` partitioned view to exist. To create the design document with this view, see [Create or modify a design document.](#putdesigndocument) 25 | -------------------------------------------------------------------------------- /examples/snippets/postBulkGet/alternative_example_request_for_atts_since.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.BulkGetQueryDocument; 4 | import com.ibm.cloud.cloudant.v1.model.BulkGetResult; 5 | import com.ibm.cloud.cloudant.v1.model.PostBulkGetOptions; 6 | 7 | import java.util.Arrays; 8 | // section: code 9 | Cloudant service = Cloudant.newInstance(); 10 | 11 | BulkGetQueryDocument bulkGetQueryDocument = 12 | new BulkGetQueryDocument.Builder() 13 | .id("order00058") 14 | .addAttsSince("1-00000000000000000000000000000000") 15 | .build(); 16 | 17 | PostBulkGetOptions postBulkGetOptions = 18 | new PostBulkGetOptions.Builder() 19 | .db("orders") 20 | .docs(Arrays.asList(bulkGetQueryDocument)).build(); 21 | 22 | BulkGetResult response = 23 | service.postBulkGet(postBulkGetOptions).execute() 24 | .getResult(); 25 | 26 | System.out.println(response); 27 | -------------------------------------------------------------------------------- /modules/common/src/main/java/com/ibm/cloud/cloudant/common/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * © Copyright IBM Corporation 2020. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | /** 15 | * This package contains non-API classes used by 16 | * the service client to customize requests. User code should 17 | * not directly call these classes. 18 | * 19 | * @since 0.0 20 | * @version 0.0 21 | */ 22 | package com.ibm.cloud.cloudant.common; 23 | -------------------------------------------------------------------------------- /examples/snippets/putDocument/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.Document; 4 | import com.ibm.cloud.cloudant.v1.model.DocumentResult; 5 | import com.ibm.cloud.cloudant.v1.model.PutDocumentOptions; 6 | // section: code 7 | Cloudant service = Cloudant.newInstance(); 8 | 9 | Document eventDoc = new Document(); 10 | eventDoc.put("type", "event"); 11 | eventDoc.put("userId", "abc123"); 12 | eventDoc.put("eventType", "addedToBasket"); 13 | eventDoc.put("productId", "1000042"); 14 | eventDoc.put("date", "2019-01-28T10:44:22.000Z"); 15 | 16 | PutDocumentOptions documentOptions = 17 | new PutDocumentOptions.Builder() 18 | .db("events") 19 | .docId("ns1HJS13AMkK:0007241142412418284") 20 | .document(eventDoc) 21 | .build(); 22 | 23 | DocumentResult response = 24 | service.putDocument(documentOptions).execute() 25 | .getResult(); 26 | 27 | System.out.println(response); 28 | -------------------------------------------------------------------------------- /examples/snippets/headUpInformation/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.sdk.core.http.Response; 4 | import com.ibm.cloud.sdk.core.service.exception.ServiceResponseException; 5 | import com.ibm.cloud.sdk.core.service.exception.ServiceUnavailableException; 6 | // section: code 7 | Cloudant service = Cloudant.newInstance(); 8 | 9 | try { 10 | // Execute the health check 11 | Response response = service.headUpInformation().execute(); 12 | // Check the status code to determine service health 13 | System.out.println("Service is up and healthy"); 14 | } catch (ServiceUnavailableException e) { 15 | System.out.println("Service unavailable:" + " \"" + e.getMessage() + "\" " + "Status code: " 16 | + e.getStatusCode()); 17 | } catch (ServiceResponseException e) { 18 | System.out.println("Issue performing health check: \"" + e.getMessage() + "\" Status code: " 19 | + e.getStatusCode()); 20 | } 21 | -------------------------------------------------------------------------------- /examples/snippets/postPartitionSearch/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.PostPartitionSearchOptions; 4 | import com.ibm.cloud.cloudant.v1.model.SearchResult; 5 | // section: code 6 | Cloudant service = Cloudant.newInstance(); 7 | 8 | PostPartitionSearchOptions searchOptions = 9 | new PostPartitionSearchOptions.Builder() 10 | .db("events") 11 | .partitionKey("ns1HJS13AMkK") 12 | .ddoc("checkout") 13 | .index("findByDate") 14 | .query("date:[2019-01-01T12:00:00.000Z TO 2019-01-31T12:00:00.000Z]") 15 | .build(); 16 | 17 | SearchResult response = 18 | service.postPartitionSearch(searchOptions).execute() 19 | .getResult(); 20 | 21 | System.out.println(response); 22 | // section: markdown 23 | // This example requires the `findByDate` Cloudant Search partitioned index to exist. To create the design document with this index, see [Create or modify a design document.](#putdesigndocument) 24 | -------------------------------------------------------------------------------- /examples/snippets/postAllDocsQueries/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.AllDocsQuery; 4 | import com.ibm.cloud.cloudant.v1.model.AllDocsQueriesResult; 5 | import com.ibm.cloud.cloudant.v1.model.PostAllDocsQueriesOptions; 6 | 7 | import java.util.Arrays; 8 | // section: code 9 | Cloudant service = Cloudant.newInstance(); 10 | 11 | AllDocsQuery query1 = new AllDocsQuery.Builder() 12 | .keys(Arrays.asList("1000042", 13 | "1000043")) 14 | .build(); 15 | 16 | AllDocsQuery query2 = new AllDocsQuery.Builder() 17 | .limit(3) 18 | .skip(2) 19 | .build(); 20 | 21 | PostAllDocsQueriesOptions queriesOptions = 22 | new PostAllDocsQueriesOptions.Builder() 23 | .queries(Arrays.asList(query1, query2)) 24 | .db("products") 25 | .build(); 26 | 27 | AllDocsQueriesResult response = 28 | service.postAllDocsQueries(queriesOptions).execute() 29 | .getResult(); 30 | 31 | System.out.println(response); 32 | -------------------------------------------------------------------------------- /examples/snippets/postPartitionFind/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.FindResult; 4 | import com.ibm.cloud.cloudant.v1.model.PostPartitionFindOptions; 5 | 6 | import java.util.Arrays; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | // section: code 10 | Cloudant service = Cloudant.newInstance(); 11 | 12 | Map typeEqualsProduct = new HashMap<>(); 13 | typeEqualsProduct.put("$eq", "abc123"); 14 | 15 | Map selector = new HashMap<>(); 16 | selector.put("userId", typeEqualsProduct); 17 | 18 | PostPartitionFindOptions findOptions = 19 | new PostPartitionFindOptions.Builder() 20 | .db("events") 21 | .partitionKey("ns1HJS13AMkK") 22 | .fields(Arrays.asList("productId", "eventType", "date")) 23 | .selector(selector) 24 | .build(); 25 | 26 | FindResult response = 27 | service.postPartitionFind(findOptions).execute() 28 | .getResult(); 29 | 30 | System.out.println(response); 31 | -------------------------------------------------------------------------------- /modules/common/src/main/java/com/ibm/cloud/cloudant/internal/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * © Copyright IBM Corporation 2020. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | /** 15 | * This package contains classes used internally by the IBM Cloudant Java SDK. This package is not 16 | * API and should not be used by user code even when the classes, methods, or fields have public 17 | * visibility modifiers. 18 | * 19 | * @since 0.0 20 | * @version 0.0 21 | */ 22 | package com.ibm.cloud.cloudant.internal; 23 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/PostApiKeysOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * The postApiKeys options. 20 | */ 21 | public class PostApiKeysOptions extends GenericModel { 22 | 23 | /** 24 | * Construct a new instance of PostApiKeysOptions. 25 | */ 26 | public PostApiKeysOptions() { 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" 2 | on: 3 | push: 4 | branches: ['main'] 5 | pull_request: 6 | branches: ['main'] 7 | schedule: 8 | - cron: '56 3 * * 2' 9 | permissions: {} 10 | jobs: 11 | analyze: 12 | name: Analyze 13 | runs-on: ubuntu-latest 14 | permissions: 15 | security-events: write 16 | strategy: 17 | fail-fast: false 18 | matrix: 19 | language: ['java-kotlin'] 20 | steps: 21 | - name: Checkout repository 22 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 23 | - name: Initialize CodeQL 24 | uses: github/codeql-action/init@1b168cd39490f61582a9beae412bb7057a6b2c4e # v3.29.5 25 | with: 26 | languages: ${{ matrix.language }} 27 | - name: Autobuild 28 | uses: github/codeql-action/autobuild@1b168cd39490f61582a9beae412bb7057a6b2c4e # v3.29.5 29 | - name: Perform CodeQL Analysis 30 | uses: github/codeql-action/analyze@1b168cd39490f61582a9beae412bb7057a6b2c4e # v3.29.5 31 | with: 32 | category: "/language:${{matrix.language}}" 33 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/GetActiveTasksOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * The getActiveTasks options. 20 | */ 21 | public class GetActiveTasksOptions extends GenericModel { 22 | 23 | /** 24 | * Construct a new instance of GetActiveTasksOptions. 25 | */ 26 | public GetActiveTasksOptions() { 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /examples/snippets/postDesignDocsQueries/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.AllDocsQueriesResult; 4 | import com.ibm.cloud.cloudant.v1.model.AllDocsQuery; 5 | import com.ibm.cloud.cloudant.v1.model.PostDesignDocsQueriesOptions; 6 | 7 | import java.util.Arrays; 8 | // section: code 9 | Cloudant service = Cloudant.newInstance(); 10 | 11 | AllDocsQuery query1 = new AllDocsQuery.Builder() 12 | .descending(true) 13 | .includeDocs(true) 14 | .limit(10) 15 | .build(); 16 | AllDocsQuery query2 = new AllDocsQuery.Builder() 17 | .inclusiveEnd(true) 18 | .startKey("_design/allusers") 19 | .skip(1) 20 | .build(); 21 | 22 | PostDesignDocsQueriesOptions queriesOptions = 23 | new PostDesignDocsQueriesOptions.Builder() 24 | .db("users") 25 | .queries(Arrays.asList(query1, query2)) 26 | .build(); 27 | 28 | AllDocsQueriesResult response = 29 | service.postDesignDocsQueries(queriesOptions).execute() 30 | .getResult(); 31 | 32 | System.out.println(response); 33 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/GetUpInformationOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * The getUpInformation options. 20 | */ 21 | public class GetUpInformationOptions extends GenericModel { 22 | 23 | /** 24 | * Construct a new instance of GetUpInformationOptions. 25 | */ 26 | public GetUpInformationOptions() { 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /examples/snippets/postFind/example_request_for_text_index_type.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.FindResult; 4 | import com.ibm.cloud.cloudant.v1.model.PostFindOptions; 5 | 6 | import java.util.Arrays; 7 | import java.util.Collections; 8 | import java.util.Map; 9 | // section: code 10 | Cloudant service = Cloudant.newInstance(); 11 | 12 | Map selector = Collections.singletonMap( 13 | "address", 14 | Collections.singletonMap("$exists", true)); 15 | 16 | PostFindOptions findOptions = new PostFindOptions.Builder() 17 | .db("users") 18 | .selector(selector) 19 | .fields(Arrays.asList("_id", "type", "name", "email", "address")) 20 | .limit(3) 21 | .build(); 22 | 23 | FindResult response = 24 | service.postFind(findOptions).execute() 25 | .getResult(); 26 | 27 | System.out.println(response); 28 | // section: markdown 29 | // This example requires the `getUserByAddress` Cloudant Query "text" index to exist. To create the index, see [Create a new index on a database.](#postindex) 30 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/HeadUpInformationOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * The headUpInformation options. 20 | */ 21 | public class HeadUpInformationOptions extends GenericModel { 22 | 23 | /** 24 | * Construct a new instance of HeadUpInformationOptions. 25 | */ 26 | public HeadUpInformationOptions() { 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/GetCorsInformationOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * The getCorsInformation options. 20 | */ 21 | public class GetCorsInformationOptions extends GenericModel { 22 | 23 | /** 24 | * Construct a new instance of GetCorsInformationOptions. 25 | */ 26 | public GetCorsInformationOptions() { 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /examples/snippets/getUpInformation/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.UpInformation; 4 | import com.ibm.cloud.sdk.core.http.Response; 5 | import com.ibm.cloud.sdk.core.service.exception.ServiceResponseException; 6 | import com.ibm.cloud.sdk.core.service.exception.ServiceUnavailableException; 7 | // section: code 8 | Cloudant service = Cloudant.newInstance(); 9 | 10 | try { 11 | // Execute the health check 12 | Response response = service.getUpInformation().execute(); 13 | // Check the status code to determine service health 14 | System.out.println("Service is up and healthy"); 15 | System.out.println(response.getResult()); 16 | } catch (ServiceUnavailableException e) { 17 | System.out.println("Service unavailable:" + " \"" + e.getMessage() + "\" " + "Status code: " 18 | + e.getStatusCode()); 19 | } catch (ServiceResponseException e) { 20 | System.out.println("Issue performing health check: \"" + e.getMessage() + "\" Status code: " 21 | + e.getStatusCode()); 22 | } 23 | -------------------------------------------------------------------------------- /examples/snippets/headAttachment/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.sdk.core.http.Headers; 3 | 4 | import com.ibm.cloud.cloudant.v1.Cloudant; 5 | import com.ibm.cloud.cloudant.v1.model.HeadAttachmentOptions; 6 | // section: code 7 | Cloudant service = Cloudant.newInstance(); 8 | 9 | HeadAttachmentOptions attachmentOptions = 10 | new HeadAttachmentOptions.Builder() 11 | .db("products") 12 | .docId("1000042") 13 | .attachmentName("product_details.txt") 14 | .build(); 15 | 16 | int statusCode = 17 | service.headAttachment(attachmentOptions).execute() 18 | .getStatusCode(); 19 | 20 | Headers headers = 21 | service.headAttachment(attachmentOptions).execute() 22 | .getHeaders(); 23 | 24 | System.out.println(statusCode); 25 | System.out.println(headers.values("Content-Length")); 26 | System.out.println(headers.values("Content-Type")); 27 | // section: markdown 28 | // This example requires the `product_details.txt` attachment in `1000042` document to exist. To create the attachment, see [Create or modify an attachment.](#putattachment) 29 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/GetServerInformationOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * The getServerInformation options. 20 | */ 21 | public class GetServerInformationOptions extends GenericModel { 22 | 23 | /** 24 | * Construct a new instance of GetServerInformationOptions. 25 | */ 26 | public GetServerInformationOptions() { 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /examples/snippets/postIndex/example_request_using_json_type_index.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.IndexDefinition; 4 | import com.ibm.cloud.cloudant.v1.model.IndexField; 5 | import com.ibm.cloud.cloudant.v1.model.IndexResult; 6 | import com.ibm.cloud.cloudant.v1.model.PostIndexOptions; 7 | // section: code 8 | Cloudant service = Cloudant.newInstance(); 9 | // Type "json" index fields require an object that maps the name of a field to a sort direction. 10 | 11 | IndexField field = new IndexField.Builder() 12 | .add("email", "asc") 13 | .build(); 14 | 15 | IndexDefinition indexDefinition = new IndexDefinition.Builder() 16 | .addFields(field) 17 | .build(); 18 | 19 | PostIndexOptions indexOptions = new PostIndexOptions.Builder() 20 | .db("users") 21 | .ddoc("json-index") 22 | .index(indexDefinition) 23 | .name("getUserByEmail") 24 | .type("json") 25 | .build(); 26 | 27 | IndexResult response = 28 | service.postIndex(indexOptions).execute() 29 | .getResult(); 30 | 31 | System.out.println(response); 32 | -------------------------------------------------------------------------------- /examples/snippets/putAttachment/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.DocumentResult; 4 | import com.ibm.cloud.cloudant.v1.model.PutAttachmentOptions; 5 | 6 | import java.io.ByteArrayInputStream; 7 | import java.io.InputStream; 8 | import java.nio.charset.StandardCharsets; 9 | // section: code 10 | Cloudant service = Cloudant.newInstance(); 11 | 12 | String detailedDescription = "This appliance includes..."; 13 | 14 | InputStream detailedDescriptionStream = 15 | new ByteArrayInputStream(detailedDescription 16 | .getBytes(StandardCharsets.UTF_8)); 17 | 18 | PutAttachmentOptions attachmentOptions = 19 | new PutAttachmentOptions.Builder() 20 | .db("products") 21 | .docId("1000042") 22 | .attachmentName("product_details.txt") 23 | .attachment(detailedDescriptionStream) 24 | .contentType("text/plain") 25 | .build(); 26 | 27 | DocumentResult response = 28 | service.putAttachment(attachmentOptions).execute() 29 | .getResult(); 30 | 31 | System.out.println(response); 32 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/GetSessionInformationOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * The getSessionInformation options. 20 | */ 21 | public class GetSessionInformationOptions extends GenericModel { 22 | 23 | /** 24 | * Construct a new instance of GetSessionInformationOptions. 25 | */ 26 | public GetSessionInformationOptions() { 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/GetActivityTrackerEventsOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * The getActivityTrackerEvents options. 20 | */ 21 | public class GetActivityTrackerEventsOptions extends GenericModel { 22 | 23 | /** 24 | * Construct a new instance of GetActivityTrackerEventsOptions. 25 | */ 26 | public GetActivityTrackerEventsOptions() { 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/GetMembershipInformationOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * The getMembershipInformation options. 20 | */ 21 | public class GetMembershipInformationOptions extends GenericModel { 22 | 23 | /** 24 | * Construct a new instance of GetMembershipInformationOptions. 25 | */ 26 | public GetMembershipInformationOptions() { 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/Ok.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * Schema for an OK result. 20 | */ 21 | public class Ok extends GenericModel { 22 | 23 | protected Boolean ok; 24 | 25 | protected Ok() { } 26 | 27 | /** 28 | * Gets the ok. 29 | * 30 | * ok. 31 | * 32 | * @return the ok 33 | */ 34 | public Boolean isOk() { 35 | return ok; 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /examples/snippets/postIndex/example_request_using_text_type_index.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.IndexDefinition; 4 | import com.ibm.cloud.cloudant.v1.model.IndexField; 5 | import com.ibm.cloud.cloudant.v1.model.IndexResult; 6 | import com.ibm.cloud.cloudant.v1.model.PostIndexOptions; 7 | // section: code 8 | Cloudant service = Cloudant.newInstance(); 9 | 10 | // Type "text" index fields require an object with a name and type properties for the field. 11 | IndexField field = new IndexField.Builder() 12 | .name("address") 13 | .type(IndexField.Type.STRING) 14 | .build(); 15 | 16 | IndexDefinition indexDefinition = new IndexDefinition.Builder() 17 | .addFields(field) 18 | .build(); 19 | 20 | PostIndexOptions indexOptions = new PostIndexOptions.Builder() 21 | .db("users") 22 | .ddoc("text-index") 23 | .index(indexDefinition) 24 | .name("getUserByAddress") 25 | .type("text") 26 | .build(); 27 | 28 | IndexResult response = 29 | service.postIndex(indexOptions).execute() 30 | .getResult(); 31 | 32 | System.out.println(response); 33 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/GetCurrentDatabasesInformationOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * The getCurrentDatabasesInformation options. 20 | */ 21 | public class GetCurrentDatabasesInformationOptions extends GenericModel { 22 | 23 | /** 24 | * Construct a new instance of GetCurrentDatabasesInformationOptions. 25 | */ 26 | public GetCurrentDatabasesInformationOptions() { 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /examples/snippets/postBulkGet/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.BulkGetQueryDocument; 4 | import com.ibm.cloud.cloudant.v1.model.BulkGetResult; 5 | import com.ibm.cloud.cloudant.v1.model.PostBulkGetOptions; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | // section: code 10 | Cloudant service = Cloudant.newInstance(); 11 | 12 | String docId = "order00067"; 13 | List bulkGetDocs = new ArrayList<>(); 14 | 15 | bulkGetDocs.add( 16 | new BulkGetQueryDocument.Builder() 17 | .id(docId) 18 | .rev("3-22222222222222222222222222222222") 19 | .build()); 20 | bulkGetDocs.add( 21 | new BulkGetQueryDocument.Builder() 22 | .id(docId) 23 | .rev("4-33333333333333333333333333333333") 24 | .build()); 25 | 26 | PostBulkGetOptions bulkGetOptions = new PostBulkGetOptions.Builder() 27 | .db("orders") 28 | .docs(bulkGetDocs) 29 | .build(); 30 | 31 | BulkGetResult response = 32 | service.postBulkGet(bulkGetOptions).execute() 33 | .getResult(); 34 | 35 | System.out.println(response); 36 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/GetCapacityDatabasesInformationOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * The getCapacityDatabasesInformation options. 20 | */ 21 | public class GetCapacityDatabasesInformationOptions extends GenericModel { 22 | 23 | /** 24 | * Construct a new instance of GetCapacityDatabasesInformationOptions. 25 | */ 26 | public GetCapacityDatabasesInformationOptions() { 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/GetCurrentThroughputInformationOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * The getCurrentThroughputInformation options. 20 | */ 21 | public class GetCurrentThroughputInformationOptions extends GenericModel { 22 | 23 | /** 24 | * Construct a new instance of GetCurrentThroughputInformationOptions. 25 | */ 26 | public GetCurrentThroughputInformationOptions() { 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/GetCapacityThroughputInformationOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * The getCapacityThroughputInformation options. 20 | */ 21 | public class GetCapacityThroughputInformationOptions extends GenericModel { 22 | 23 | /** 24 | * Construct a new instance of GetCapacityThroughputInformationOptions. 25 | */ 26 | public GetCapacityThroughputInformationOptions() { 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /examples/snippets/getAttachment/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.GetAttachmentOptions; 4 | 5 | import java.io.BufferedReader; 6 | import java.io.InputStream; 7 | import java.io.InputStreamReader; 8 | import java.util.stream.Collectors; 9 | // section: code 10 | Cloudant service = Cloudant.newInstance(); 11 | 12 | GetAttachmentOptions attachmentOptions = 13 | new GetAttachmentOptions.Builder() 14 | .db("products") 15 | .docId("1000042") 16 | .attachmentName("product_details.txt") 17 | .build(); 18 | 19 | try(InputStream streamResult = 20 | service.getAttachment(attachmentOptions).execute() 21 | .getResult()) { 22 | String response = 23 | new BufferedReader(new InputStreamReader(streamResult)) 24 | .lines().collect(Collectors.joining("\n")); 25 | 26 | System.out.println(response); 27 | } 28 | 29 | // section: markdown 30 | // This example requires the `product_details.txt` attachment in `1000042` document to exist. To create the attachment, see [Create or modify an attachment.](#putattachment) 31 | -------------------------------------------------------------------------------- /examples/snippets/postFind/example_request_for_json_index_type.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.FindResult; 4 | import com.ibm.cloud.cloudant.v1.model.PostFindOptions; 5 | 6 | import java.util.Arrays; 7 | import java.util.Collections; 8 | import java.util.Map; 9 | // section: code 10 | Cloudant service = Cloudant.newInstance(); 11 | 12 | Map selector = Collections.singletonMap( 13 | "email_verified", 14 | Collections.singletonMap("$eq", true)); 15 | 16 | Map fieldSort = Collections.singletonMap("email", "desc"); 17 | 18 | PostFindOptions findOptions = new PostFindOptions.Builder() 19 | .db("users") 20 | .selector(selector) 21 | .fields(Arrays.asList("_id", "type", "name", "email")) 22 | .addSort(fieldSort) 23 | .limit(3) 24 | .build(); 25 | 26 | FindResult response = 27 | service.postFind(findOptions).execute() 28 | .getResult(); 29 | 30 | System.out.println(response); 31 | // section: markdown 32 | // This example requires the `getUserByEmail` Cloudant Query "json" index to exist. To create the index, see [Create a new index on a database.](#postindex) 33 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/Change.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * Schema for a document leaf with single field rev. 20 | */ 21 | public class Change extends GenericModel { 22 | 23 | protected String rev; 24 | 25 | protected Change() { } 26 | 27 | /** 28 | * Gets the rev. 29 | * 30 | * Schema for a document revision identifier. 31 | * 32 | * @return the rev 33 | */ 34 | public String getRev() { 35 | return rev; 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /examples/snippets/postRevsDiff/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.PostRevsDiffOptions; 4 | import com.ibm.cloud.cloudant.v1.model.RevsDiff; 5 | 6 | import java.util.Collections; 7 | import java.util.List; 8 | import java.util.Map; 9 | import java.util.Arrays; 10 | // section: code 11 | Cloudant service = Cloudant.newInstance(); 12 | 13 | Map> docRevisions = 14 | Collections.singletonMap("order00077", Arrays.asList( 15 | "1-00000000000000000000000000000000", // missing revision 16 | "2-11111111111111111111111111111111", // missing revision 17 | "3-22222222222222222222222222222222" // possible ancestor revision 18 | )); 19 | 20 | PostRevsDiffOptions revsDiffOptions = 21 | new PostRevsDiffOptions.Builder() 22 | .db("orders") 23 | .documentRevisions(docRevisions) 24 | .build(); 25 | 26 | Map response = 27 | service.postRevsDiff(revsDiffOptions).execute() 28 | .getResult(); 29 | 30 | System.out.println(response); 31 | // section: markdown 32 | // This example requires the example revisions in the POST body to be replaced with valid revisions. 33 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a bug report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | 12 | 13 | **To Reproduce** 14 | 15 | 16 | **Expected behavior** 17 | 18 | 19 | **Screenshots** 20 | 21 | 22 | **Must gather (please complete the following information):** 23 | - SDK Version [e.g. 1.2.1] 24 | - Java Version [e.g. IBM Semeru Runtime Open Edition 25.0.0.0 (build 25+36-LTS)] 25 | - Name of service that you're trying to use (if applicable) 26 | - Name of operation that you're trying to invoke (if applicable) 27 | 28 | **Additional context** 29 | 31 | -------------------------------------------------------------------------------- /scripts/javadoc/generate-index-html.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | # based on https://odoepner.wordpress.com/2012/02/17/shell-script-to-generate-simple-index-html/ 4 | 5 | echo ' 6 | 7 | 8 | 9 | 10 | 11 | IBM Cloudant SDK for Java 12 | 13 | 14 | 15 |
16 | 19 | 20 |

Cloudant API Docs 21 | | GitHub 22 |

23 | 24 |

Javadoc by release:

25 | 28 |
29 | 30 | ' 31 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/DatabasesCountInformation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * Schema for databases count. 20 | */ 21 | public class DatabasesCountInformation extends GenericModel { 22 | 23 | protected Long total; 24 | 25 | protected DatabasesCountInformation() { } 26 | 27 | /** 28 | * Gets the total. 29 | * 30 | * The total number of databases. 31 | * 32 | * @return the total 33 | */ 34 | public Long getTotal() { 35 | return total; 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /examples/snippets/postViewQueries/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.PostViewQueriesOptions; 4 | import com.ibm.cloud.cloudant.v1.model.ViewQueriesResult; 5 | import com.ibm.cloud.cloudant.v1.model.ViewQuery; 6 | 7 | import java.util.Arrays; 8 | // section: code 9 | Cloudant service = Cloudant.newInstance(); 10 | 11 | ViewQuery query1 = new ViewQuery.Builder() 12 | .includeDocs(true) 13 | .limit(5) 14 | .build(); 15 | 16 | ViewQuery query2 = new ViewQuery.Builder() 17 | .descending(true) 18 | .skip(1) 19 | .build(); 20 | 21 | PostViewQueriesOptions queriesOptions = 22 | new PostViewQueriesOptions.Builder() 23 | .db("users") 24 | .ddoc("allusers") 25 | .queries(Arrays.asList(query1, query2)) 26 | .view("getVerifiedEmails") 27 | .build(); 28 | 29 | ViewQueriesResult response = 30 | service.postViewQueries(queriesOptions).execute() 31 | .getResult(); 32 | 33 | System.out.println(response); 34 | // section: markdown 35 | // This example requires the `getVerifiedEmails` view to exist. To create the design document with this view, see [Create or modify a design document.](#putdesigndocument) 36 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/UuidsResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import java.util.List; 17 | 18 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 19 | 20 | /** 21 | * Schema for a set of uuids generated by the server. 22 | */ 23 | public class UuidsResult extends GenericModel { 24 | 25 | protected List uuids; 26 | 27 | protected UuidsResult() { } 28 | 29 | /** 30 | * Gets the uuids. 31 | * 32 | * uuids. 33 | * 34 | * @return the uuids 35 | */ 36 | public List getUuids() { 37 | return uuids; 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/BulkGetResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import java.util.List; 17 | 18 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 19 | 20 | /** 21 | * Schema for the results object of a bulk get operation. 22 | */ 23 | public class BulkGetResult extends GenericModel { 24 | 25 | protected List results; 26 | 27 | protected BulkGetResult() { } 28 | 29 | /** 30 | * Gets the results. 31 | * 32 | * Results. 33 | * 34 | * @return the results 35 | */ 36 | public List getResults() { 37 | return results; 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/SearchAnalyzeResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import java.util.List; 17 | 18 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 19 | 20 | /** 21 | * Schema for the output of testing search analyzer tokenization. 22 | */ 23 | public class SearchAnalyzeResult extends GenericModel { 24 | 25 | protected List tokens; 26 | 27 | protected SearchAnalyzeResult() { } 28 | 29 | /** 30 | * Gets the tokens. 31 | * 32 | * tokens. 33 | * 34 | * @return the tokens 35 | */ 36 | public List getTokens() { 37 | return tokens; 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /examples/snippets/postDocument/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.Document; 4 | import com.ibm.cloud.cloudant.v1.model.DocumentResult; 5 | import com.ibm.cloud.cloudant.v1.model.PostDocumentOptions; 6 | // section: code 7 | Cloudant service = Cloudant.newInstance(); 8 | 9 | Document productsDocument = new Document(); 10 | productsDocument.setId("1000042"); 11 | productsDocument.put("type", "product"); 12 | productsDocument.put("productId", "1000042"); 13 | productsDocument.put("brand", "Salter"); 14 | productsDocument.put("name", "Digital Kitchen Scales"); 15 | productsDocument.put("description", "Slim Colourful Design Electronic" 16 | + "Cooking Appliance for Home / Kitchen, Weigh up to 5kg + Aquatronic" 17 | + "for Liquids ml + fl. oz. 15Yr Guarantee - Green"); 18 | productsDocument.put("price", 14.99); 19 | productsDocument.put("image", "assets/img/0gmsnghhew.jpg"); 20 | 21 | PostDocumentOptions documentOptions = 22 | new PostDocumentOptions.Builder() 23 | .db("products") 24 | .document(productsDocument) 25 | .build(); 26 | 27 | DocumentResult response = 28 | service.postDocument(documentOptions).execute() 29 | .getResult(); 30 | 31 | System.out.println(response); 32 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/DatabaseInformationProps.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * Schema for database properties. 20 | */ 21 | public class DatabaseInformationProps extends GenericModel { 22 | 23 | protected Boolean partitioned; 24 | 25 | protected DatabaseInformationProps() { } 26 | 27 | /** 28 | * Gets the partitioned. 29 | * 30 | * The value is `true` for a partitioned database. 31 | * 32 | * @return the partitioned 33 | */ 34 | public Boolean isPartitioned() { 35 | return partitioned; 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /examples/snippets/putLocalDocument/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.Document; 4 | import com.ibm.cloud.cloudant.v1.model.DocumentResult; 5 | import com.ibm.cloud.cloudant.v1.model.PutLocalDocumentOptions; 6 | // section: code 7 | Cloudant service = Cloudant.newInstance(); 8 | 9 | Document orderDocument = new Document(); 10 | orderDocument.put("type", "order"); 11 | orderDocument.put("user", "Bob Smith"); 12 | orderDocument.put("orderId", "0007741142412418284"); 13 | orderDocument.put("userId", "abc123"); 14 | orderDocument.put("total", 214.98); 15 | orderDocument.put("deliveryAddress", "19 Front Street, Darlington, DL5 1TY"); 16 | orderDocument.put("delivered", true); 17 | orderDocument.put("courier", "UPS"); 18 | orderDocument.put("courierId", "15125425151261289"); 19 | orderDocument.put("date", "2019-01-28T10:44:22.000Z"); 20 | 21 | PutLocalDocumentOptions documentOptions = 22 | new PutLocalDocumentOptions.Builder() 23 | .db("orders") 24 | .docId("local-0007741142412418284") 25 | .document(orderDocument) 26 | .build(); 27 | 28 | DocumentResult response = 29 | service.putLocalDocument(documentOptions).execute() 30 | .getResult(); 31 | 32 | System.out.println(response); 33 | -------------------------------------------------------------------------------- /examples/snippets/postBulkDocs/example_request_delete_documents.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.BulkDocs; 4 | import com.ibm.cloud.cloudant.v1.model.Document; 5 | import com.ibm.cloud.cloudant.v1.model.DocumentResult; 6 | import com.ibm.cloud.cloudant.v1.model.PostBulkDocsOptions; 7 | 8 | import java.util.Arrays; 9 | import java.util.List; 10 | // section: code 11 | Cloudant service = Cloudant.newInstance(); 12 | 13 | Document eventDoc1 = new Document(); 14 | eventDoc1.setId("ns1HJS13AMkK:0007241142412418284"); 15 | eventDoc1.setRev("1-00000000000000000000000000000000"); 16 | eventDoc1.setDeleted(true); 17 | 18 | Document eventDoc2 = new Document(); 19 | eventDoc2.setId("H8tDIwfadxp9:0007241142412418285"); 20 | eventDoc1.setRev("1-00000000000000000000000000000000"); 21 | eventDoc1.setDeleted(true); 22 | 23 | BulkDocs bulkDocs = new BulkDocs.Builder() 24 | .docs(Arrays.asList(eventDoc1, eventDoc2)) 25 | .build(); 26 | 27 | PostBulkDocsOptions bulkDocsOptions = new PostBulkDocsOptions.Builder() 28 | .db("events") 29 | .bulkDocs(bulkDocs) 30 | .build(); 31 | 32 | List response = 33 | service.postBulkDocs(bulkDocsOptions).execute() 34 | .getResult(); 35 | 36 | System.out.println(response); 37 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/CurrentDatabasesInformation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * Schema for information about the current database counts. 20 | */ 21 | public class CurrentDatabasesInformation extends GenericModel { 22 | 23 | protected DatabasesCountInformation databases; 24 | 25 | protected CurrentDatabasesInformation() { } 26 | 27 | /** 28 | * Gets the databases. 29 | * 30 | * Schema for databases count. 31 | * 32 | * @return the databases 33 | */ 34 | public DatabasesCountInformation getDatabases() { 35 | return databases; 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/SearchIndexDiskSize.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.google.gson.annotations.SerializedName; 17 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 18 | 19 | /** 20 | * Schema for search index disk size. 21 | */ 22 | public class SearchIndexDiskSize extends GenericModel { 23 | 24 | @SerializedName("disk_size") 25 | protected Long diskSize; 26 | 27 | protected SearchIndexDiskSize() { } 28 | 29 | /** 30 | * Gets the diskSize. 31 | * 32 | * The size of the search index on disk. 33 | * 34 | * @return the diskSize 35 | */ 36 | public Long getDiskSize() { 37 | return diskSize; 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/CapacityDatabasesInformationCurrent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * Schema for information about the current database capacity. 20 | */ 21 | public class CapacityDatabasesInformationCurrent extends GenericModel { 22 | 23 | protected DatabasesCountInformation databases; 24 | 25 | protected CapacityDatabasesInformationCurrent() { } 26 | 27 | /** 28 | * Gets the databases. 29 | * 30 | * Schema for databases count. 31 | * 32 | * @return the databases 33 | */ 34 | public DatabasesCountInformation getDatabases() { 35 | return databases; 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/CapacityDatabasesInformation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * Schema for information about maximum total database count. 20 | */ 21 | public class CapacityDatabasesInformation extends GenericModel { 22 | 23 | protected CapacityDatabasesInformationCurrent current; 24 | 25 | protected CapacityDatabasesInformation() { } 26 | 27 | /** 28 | * Gets the current. 29 | * 30 | * Schema for information about the current database capacity. 31 | * 32 | * @return the current 33 | */ 34 | public CapacityDatabasesInformationCurrent getCurrent() { 35 | return current; 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Questions 2 | If you are having problems using the APIs or have a question about IBM Cloud services, 3 | please ask a question at 4 | [Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-cloud). 5 | 6 | # Issues 7 | If you encounter an issue with the project, you are welcome to submit a 8 | [bug report](https://github.com/IBM/cloudant-java-sdk/issues). 9 | Before that, please search for similar issues. It's possible that someone has already reported the problem. 10 | 11 | # PRs 12 | We ask that an **issue is always opened prior to a PR** to give us the 13 | opportunity to discuss the best place for the change before investing 14 | your effort on a patch that we may not be able to accept. 15 | 16 | The code in the repository is partly generated from the Cloudant OpenAPI 17 | specification. This means PRs to code, tests and sometimes even markdown 18 | are often inappropriate and we may need to make changes to the specification 19 | instead. Please, first [look at the list of files](.github/CODEOWNERS) that 20 | _should not_ be modified. 21 | 22 | Before submitting your pull request, please ensure you've reviewed and adhere to our [AI policy](AI_CODE_POLICY.md). 23 | 24 | # General Information 25 | For general guidance on contributing to this project, please see the 26 | [general guidance for contributing](https://github.com/IBM/ibm-cloud-sdk-common/blob/main/CONTRIBUTING_java.md). 27 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/CurrentThroughputInformation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * Schema for information about current consumption of a provisioned throughput capacity. 20 | */ 21 | public class CurrentThroughputInformation extends GenericModel { 22 | 23 | protected CurrentThroughputInformationThroughput throughput; 24 | 25 | protected CurrentThroughputInformation() { } 26 | 27 | /** 28 | * Gets the throughput. 29 | * 30 | * Detailed information about current consumption. 31 | * 32 | * @return the throughput 33 | */ 34 | public CurrentThroughputInformationThroughput getThroughput() { 35 | return throughput; 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/ViewQueriesResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import java.util.List; 17 | 18 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 19 | 20 | /** 21 | * Schema for the results of a queries view operation. 22 | */ 23 | public class ViewQueriesResult extends GenericModel { 24 | 25 | protected List results; 26 | 27 | protected ViewQueriesResult() { } 28 | 29 | /** 30 | * Gets the results. 31 | * 32 | * An array of result objects - one for each query. Each result object contains the same fields as the response to a 33 | * regular view request. 34 | * 35 | * @return the results 36 | */ 37 | public List getResults() { 38 | return results; 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/CapacityThroughputInformationTarget.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * Detailed information about target throughput capacity. 20 | */ 21 | public class CapacityThroughputInformationTarget extends GenericModel { 22 | 23 | protected ThroughputInformation throughput; 24 | 25 | protected CapacityThroughputInformationTarget() { } 26 | 27 | /** 28 | * Gets the throughput. 29 | * 30 | * Schema for detailed information about throughput capacity with breakdown by specific throughput requests classes. 31 | * 32 | * @return the throughput 33 | */ 34 | public ThroughputInformation getThroughput() { 35 | return throughput; 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /examples/snippets/postBulkDocs/example_request_as_a_stream.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.DocumentResult; 4 | import com.ibm.cloud.cloudant.v1.model.PostBulkDocsOptions; 5 | 6 | import java.util.List; 7 | import java.io.File; 8 | import java.io.FileInputStream; 9 | // section: code 10 | Cloudant service = Cloudant.newInstance(); 11 | 12 | File file = new File("upload.json"); 13 | FileInputStream inputStream = new FileInputStream(file); 14 | 15 | PostBulkDocsOptions bulkDocsOptions = new PostBulkDocsOptions.Builder() 16 | .db("events") 17 | .body(inputStream) 18 | .build(); 19 | 20 | List response = 21 | service.postBulkDocs(bulkDocsOptions).execute() 22 | .getResult(); 23 | 24 | System.out.println(response); 25 | // section: markdown 26 | // Content of upload.json 27 | // section: code 28 | { 29 | "docs": [ 30 | { 31 | "_id": "ns1HJS13AMkK:0007241142412418284", 32 | "type": "event", 33 | "userId": "abc123", 34 | "eventType": "addedToBasket", 35 | "productId": "1000042", 36 | "date": "2019-01-28T10:44:22.000Z" 37 | }, 38 | { 39 | "_id": "H8tDIwfadxp9:0007241142412418285", 40 | "type": "event", 41 | "userId": "abc234", 42 | "eventType": "addedToBasket", 43 | "productId": "1000050", 44 | "date": "2019-01-25T20:00:00.000Z" 45 | } 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/CapacityThroughputInformationCurrent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * Detailed information about provisioned throughput capacity. 20 | */ 21 | public class CapacityThroughputInformationCurrent extends GenericModel { 22 | 23 | protected ThroughputInformation throughput; 24 | 25 | protected CapacityThroughputInformationCurrent() { } 26 | 27 | /** 28 | * Gets the throughput. 29 | * 30 | * Schema for detailed information about throughput capacity with breakdown by specific throughput requests classes. 31 | * 32 | * @return the throughput 33 | */ 34 | public ThroughputInformation getThroughput() { 35 | return throughput; 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/AllDocsQueriesResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import java.util.List; 17 | 18 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 19 | 20 | /** 21 | * Schema for the result of an all documents queries operation. 22 | */ 23 | public class AllDocsQueriesResult extends GenericModel { 24 | 25 | protected List results; 26 | 27 | protected AllDocsQueriesResult() { } 28 | 29 | /** 30 | * Gets the results. 31 | * 32 | * An array of result objects - one for each query. Each result object contains the same fields as the response to a 33 | * regular `/_all_docs` request. 34 | * 35 | * @return the results 36 | */ 37 | public List getResults() { 38 | return results; 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/ShardsInformation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import java.util.List; 17 | import java.util.Map; 18 | 19 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 20 | 21 | /** 22 | * Schema for a shards object that maps the hash value range for each shard to the array of nodes that contain a copy of 23 | * that shard. 24 | */ 25 | public class ShardsInformation extends GenericModel { 26 | 27 | protected Map> shards; 28 | 29 | protected ShardsInformation() { } 30 | 31 | /** 32 | * Gets the shards. 33 | * 34 | * Mapping of shard hash value range to a list of nodes. 35 | * 36 | * @return the shards 37 | */ 38 | public Map> getShards() { 39 | return shards; 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/features/pagination/BookmarkPageIterator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * © Copyright IBM Corporation 2025. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.features.pagination; 15 | 16 | import java.util.function.BiFunction; 17 | import java.util.function.Function; 18 | import com.ibm.cloud.cloudant.v1.Cloudant; 19 | 20 | abstract class BookmarkPageIterator extends BasePageIterator { 21 | 22 | BookmarkPageIterator(Cloudant client, O options, OptionsHandler optsHandler) { 23 | super(client, options, optsHandler); 24 | } 25 | 26 | abstract Function bookmarkGetter(); 27 | 28 | abstract BiFunction bookmarkSetter(); 29 | 30 | @Override 31 | final void setNextPageOptions(B builder, R result) { 32 | String bookmark = bookmarkGetter().apply(result); 33 | bookmarkSetter().apply(builder, bookmark); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/OkTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.Ok; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the Ok model. 27 | */ 28 | public class OkTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testOk() throws Throwable { 34 | Ok okModel = new Ok(); 35 | assertNull(okModel.isOk()); 36 | } 37 | } -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/PartitionInformationIndexesIndexes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * The count breakdown of partitioned indexes. 20 | */ 21 | public class PartitionInformationIndexesIndexes extends GenericModel { 22 | 23 | protected Long search; 24 | protected Long view; 25 | 26 | protected PartitionInformationIndexesIndexes() { } 27 | 28 | /** 29 | * Gets the search. 30 | * 31 | * Number of partitioned search indexes. 32 | * 33 | * @return the search 34 | */ 35 | public Long getSearch() { 36 | return search; 37 | } 38 | 39 | /** 40 | * Gets the view. 41 | * 42 | * Number of partitioned view indexes. 43 | * 44 | * @return the view 45 | */ 46 | public Long getView() { 47 | return view; 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/DocsResultRowValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * Value of built-in `/_all_docs` style view. 20 | */ 21 | public class DocsResultRowValue extends GenericModel { 22 | 23 | protected Boolean deleted; 24 | protected String rev; 25 | 26 | protected DocsResultRowValue() { } 27 | 28 | /** 29 | * Gets the deleted. 30 | * 31 | * If `true` then the document is deleted. Not present for undeleted documents. 32 | * 33 | * @return the deleted 34 | */ 35 | public Boolean isDeleted() { 36 | return deleted; 37 | } 38 | 39 | /** 40 | * Gets the rev. 41 | * 42 | * Schema for a document revision identifier. 43 | * 44 | * @return the rev 45 | */ 46 | public String getRev() { 47 | return rev; 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/DocumentShardInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import java.util.List; 17 | 18 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 19 | 20 | /** 21 | * Schema for document shard information. 22 | */ 23 | public class DocumentShardInfo extends GenericModel { 24 | 25 | protected List nodes; 26 | protected String range; 27 | 28 | protected DocumentShardInfo() { } 29 | 30 | /** 31 | * Gets the nodes. 32 | * 33 | * List of nodes serving a replica of the shard. 34 | * 35 | * @return the nodes 36 | */ 37 | public List getNodes() { 38 | return nodes; 39 | } 40 | 41 | /** 42 | * Gets the range. 43 | * 44 | * The shard range in which the document is stored. 45 | * 46 | * @return the range 47 | */ 48 | public String getRange() { 49 | return range; 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/PartitionedIndexesDetailedInformation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * Number of partitioned indexes by type. 20 | */ 21 | public class PartitionedIndexesDetailedInformation extends GenericModel { 22 | 23 | protected Long search; 24 | protected Long view; 25 | 26 | protected PartitionedIndexesDetailedInformation() { } 27 | 28 | /** 29 | * Gets the search. 30 | * 31 | * Number of partitioned indexes of search type. 32 | * 33 | * @return the search 34 | */ 35 | public Long getSearch() { 36 | return search; 37 | } 38 | 39 | /** 40 | * Gets the view. 41 | * 42 | * Number of partitioned indexes of view type. 43 | * 44 | * @return the view 45 | */ 46 | public Long getView() { 47 | return view; 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/ChangeTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.Change; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the Change model. 27 | */ 28 | public class ChangeTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testChange() throws Throwable { 34 | Change changeModel = new Change(); 35 | assertNull(changeModel.getRev()); 36 | } 37 | } -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/features/pagination/FindBasePageIterator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * © Copyright IBM Corporation 2025. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.features.pagination; 15 | 16 | import java.util.List; 17 | import java.util.function.Function; 18 | import com.ibm.cloud.cloudant.v1.Cloudant; 19 | import com.ibm.cloud.cloudant.v1.model.Document; 20 | import com.ibm.cloud.cloudant.v1.model.FindResult; 21 | 22 | abstract class FindBasePageIterator extends BookmarkPageIterator { 23 | 24 | FindBasePageIterator(Cloudant client, O options, OptionsHandler optsHandler) { 25 | super(client, options, optsHandler); 26 | } 27 | 28 | @Override 29 | final Function> itemsGetter() { 30 | return FindResult::getDocs; 31 | } 32 | 33 | @Override 34 | final Function bookmarkGetter() { 35 | return FindResult::getBookmark; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/BulkGetResultDocument.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * Schema for BulkGetResult object containing a successfully retrieved document or error information. 20 | */ 21 | public class BulkGetResultDocument extends GenericModel { 22 | 23 | protected DocumentResult error; 24 | protected Document ok; 25 | 26 | protected BulkGetResultDocument() { } 27 | 28 | /** 29 | * Gets the error. 30 | * 31 | * Schema for the result of a document modification. 32 | * 33 | * @return the error 34 | */ 35 | public DocumentResult getError() { 36 | return error; 37 | } 38 | 39 | /** 40 | * Gets the ok. 41 | * 42 | * Schema for a document. 43 | * 44 | * @return the ok 45 | */ 46 | public Document getOk() { 47 | return ok; 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/PartitionInformationSizes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * The size of active and external data, in bytes. 20 | */ 21 | public class PartitionInformationSizes extends GenericModel { 22 | 23 | protected Long active; 24 | protected Long external; 25 | 26 | protected PartitionInformationSizes() { } 27 | 28 | /** 29 | * Gets the active. 30 | * 31 | * The size of live data inside the database, in bytes. 32 | * 33 | * @return the active 34 | */ 35 | public Long getActive() { 36 | return active; 37 | } 38 | 39 | /** 40 | * Gets the external. 41 | * 42 | * The uncompressed size of database contents in bytes. 43 | * 44 | * @return the external 45 | */ 46 | public Long getExternal() { 47 | return external; 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/DbUpdates.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import java.util.List; 17 | 18 | import com.google.gson.annotations.SerializedName; 19 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 20 | 21 | /** 22 | * Schema for database updates. 23 | */ 24 | public class DbUpdates extends GenericModel { 25 | 26 | @SerializedName("last_seq") 27 | protected String lastSeq; 28 | protected List results; 29 | 30 | protected DbUpdates() { } 31 | 32 | /** 33 | * Gets the lastSeq. 34 | * 35 | * Last sequence number. 36 | * 37 | * @return the lastSeq 38 | */ 39 | public String getLastSeq() { 40 | return lastSeq; 41 | } 42 | 43 | /** 44 | * Gets the results. 45 | * 46 | * results. 47 | * 48 | * @return the results 49 | */ 50 | public List getResults() { 51 | return results; 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /examples/snippets/postBulkDocs/example_request_create_documents.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.BulkDocs; 4 | import com.ibm.cloud.cloudant.v1.model.Document; 5 | import com.ibm.cloud.cloudant.v1.model.DocumentResult; 6 | import com.ibm.cloud.cloudant.v1.model.PostBulkDocsOptions; 7 | 8 | import java.util.Arrays; 9 | import java.util.List; 10 | // section: code 11 | Cloudant service = Cloudant.newInstance(); 12 | 13 | Document eventDoc1 = new Document(); 14 | eventDoc1.setId("ns1HJS13AMkK:0007241142412418284"); 15 | eventDoc1.put("type", "event"); 16 | eventDoc1.put("userId", "abc123"); 17 | eventDoc1.put("eventType", "addedToBasket"); 18 | eventDoc1.put("productId", "1000042"); 19 | eventDoc1.put("date", "2019-01-28T10:44:22.000Z"); 20 | 21 | Document eventDoc2 = new Document(); 22 | eventDoc2.setId("H8tDIwfadxp9:0007241142412418285"); 23 | eventDoc2.put("type", "event"); 24 | eventDoc2.put("userId", "abc234"); 25 | eventDoc2.put("eventType", "addedToBasket"); 26 | eventDoc2.put("productId", "1000050"); 27 | eventDoc2.put("date", "2019-01-28T10:44:22.000Z"); 28 | 29 | BulkDocs bulkDocs = new BulkDocs.Builder() 30 | .docs(Arrays.asList(eventDoc1, eventDoc2)) 31 | .build(); 32 | 33 | PostBulkDocsOptions bulkDocsOptions = new PostBulkDocsOptions.Builder() 34 | .db("events") 35 | .bulkDocs(bulkDocs) 36 | .build(); 37 | 38 | List response = 39 | service.postBulkDocs(bulkDocsOptions).execute() 40 | .getResult(); 41 | 42 | System.out.println(response); 43 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/BulkGetResultItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import java.util.List; 17 | 18 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 19 | 20 | /** 21 | * Schema for the document revisions information from a bulk get operation. 22 | */ 23 | public class BulkGetResultItem extends GenericModel { 24 | 25 | protected List docs; 26 | protected String id; 27 | 28 | protected BulkGetResultItem() { } 29 | 30 | /** 31 | * Gets the docs. 32 | * 33 | * Array of document revisions or error information. 34 | * 35 | * @return the docs 36 | */ 37 | public List getDocs() { 38 | return docs; 39 | } 40 | 41 | /** 42 | * Gets the id. 43 | * 44 | * Schema for a document ID. 45 | * 46 | * @return the id 47 | */ 48 | public String getId() { 49 | return id; 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/features/pagination/SearchBasePageIterator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * © Copyright IBM Corporation 2025. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.features.pagination; 15 | 16 | import java.util.List; 17 | import java.util.function.Function; 18 | import com.ibm.cloud.cloudant.v1.Cloudant; 19 | import com.ibm.cloud.cloudant.v1.model.SearchResult; 20 | import com.ibm.cloud.cloudant.v1.model.SearchResultRow; 21 | 22 | abstract class SearchBasePageIterator extends BookmarkPageIterator { 23 | 24 | SearchBasePageIterator(Cloudant client, O options, OptionsHandler optsHandler) { 25 | super(client, options, optsHandler); 26 | } 27 | 28 | @Override 29 | final Function> itemsGetter() { 30 | return SearchResult::getRows; 31 | } 32 | 33 | @Override 34 | final Function bookmarkGetter() { 35 | return SearchResult::getBookmark; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/UuidsResultTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.UuidsResult; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the UuidsResult model. 27 | */ 28 | public class UuidsResultTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testUuidsResult() throws Throwable { 34 | UuidsResult uuidsResultModel = new UuidsResult(); 35 | assertNull(uuidsResultModel.getUuids()); 36 | } 37 | } -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/DesignDocumentInformation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.google.gson.annotations.SerializedName; 17 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 18 | 19 | /** 20 | * Schema for information about a design document. 21 | */ 22 | public class DesignDocumentInformation extends GenericModel { 23 | 24 | protected String name; 25 | @SerializedName("view_index") 26 | protected DesignDocumentViewIndex viewIndex; 27 | 28 | protected DesignDocumentInformation() { } 29 | 30 | /** 31 | * Gets the name. 32 | * 33 | * name. 34 | * 35 | * @return the name 36 | */ 37 | public String getName() { 38 | return name; 39 | } 40 | 41 | /** 42 | * Gets the viewIndex. 43 | * 44 | * View index information. 45 | * 46 | * @return the viewIndex 47 | */ 48 | public DesignDocumentViewIndex getViewIndex() { 49 | return viewIndex; 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/RevsDiffTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.RevsDiff; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the RevsDiff model. 27 | */ 28 | public class RevsDiffTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testRevsDiff() throws Throwable { 34 | RevsDiff revsDiffModel = new RevsDiff(); 35 | assertNull(revsDiffModel.getMissing()); 36 | assertNull(revsDiffModel.getPossibleAncestors()); 37 | } 38 | } -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/IndexCandidate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * Schema for an index that was not chosen for serving the query with the reason for the exclusion. 20 | */ 21 | public class IndexCandidate extends GenericModel { 22 | 23 | protected IndexAnalysis analysis; 24 | protected IndexInformation index; 25 | 26 | protected IndexCandidate() { } 27 | 28 | /** 29 | * Gets the analysis. 30 | * 31 | * Schema for detailed explanation of why the specific index was excluded by the query planner. 32 | * 33 | * @return the analysis 34 | */ 35 | public IndexAnalysis getAnalysis() { 36 | return analysis; 37 | } 38 | 39 | /** 40 | * Gets the index. 41 | * 42 | * Schema for information about an index. 43 | * 44 | * @return the index 45 | */ 46 | public IndexInformation getIndex() { 47 | return index; 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /modules/examples/src/main/java/features/Start.java: -------------------------------------------------------------------------------- 1 | /** 2 | * © Copyright IBM Corporation 2023. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package features; 14 | 15 | import java.util.stream.Stream; 16 | import com.ibm.cloud.cloudant.features.ChangesFollower; 17 | import com.ibm.cloud.cloudant.v1.Cloudant; 18 | import com.ibm.cloud.cloudant.v1.model.ChangesResultItem; 19 | import com.ibm.cloud.cloudant.v1.model.PostChangesOptions; 20 | 21 | public class Start { 22 | public static void main(String[] args) { 23 | 24 | Cloudant client = Cloudant.newInstance(); 25 | 26 | PostChangesOptions options = new PostChangesOptions.Builder("example") 27 | .build(); 28 | ChangesFollower changesFollower = new ChangesFollower(client, options); 29 | Stream changesItems = changesFollower.start(); 30 | // Note: java.util.Stream will not do anything until attached to a terminal operation. 31 | // Invoke a Stream terminal operation to commence the flow of changes. 32 | // e.g. changesItems.collect(...) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/features/pagination/FindPager.java: -------------------------------------------------------------------------------- 1 | /** 2 | * © Copyright IBM Corporation 2025. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.features.pagination; 15 | 16 | import java.util.function.BiFunction; 17 | import com.ibm.cloud.cloudant.v1.Cloudant; 18 | import com.ibm.cloud.cloudant.v1.model.FindResult; 19 | import com.ibm.cloud.cloudant.v1.model.PostFindOptions; 20 | import com.ibm.cloud.cloudant.v1.model.PostFindOptions.Builder; 21 | import com.ibm.cloud.sdk.core.http.ServiceCall; 22 | 23 | final class FindPager extends FindBasePageIterator { 24 | 25 | FindPager(Cloudant client, PostFindOptions options) { 26 | super(client, options, OptionsHandler.POST_FIND); 27 | } 28 | 29 | @Override 30 | BiFunction bookmarkSetter() { 31 | return Builder::bookmark; 32 | } 33 | 34 | @Override 35 | BiFunction> nextRequestFunction() { 36 | return Cloudant::postFind; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/ApiKeysResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 17 | 18 | /** 19 | * Schema for api keys. 20 | */ 21 | public class ApiKeysResult extends GenericModel { 22 | 23 | protected Boolean ok; 24 | protected String key; 25 | protected String password; 26 | 27 | protected ApiKeysResult() { } 28 | 29 | /** 30 | * Gets the ok. 31 | * 32 | * ok. 33 | * 34 | * @return the ok 35 | */ 36 | public Boolean isOk() { 37 | return ok; 38 | } 39 | 40 | /** 41 | * Gets the key. 42 | * 43 | * The generated api key. 44 | * 45 | * @return the key 46 | */ 47 | public String getKey() { 48 | return key; 49 | } 50 | 51 | /** 52 | * Gets the password. 53 | * 54 | * The password associated with the api key. 55 | * 56 | * @return the password 57 | */ 58 | public String getPassword() { 59 | return password; 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/DbEventTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.DbEvent; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the DbEvent model. 27 | */ 28 | public class DbEventTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testDbEvent() throws Throwable { 34 | DbEvent dbEventModel = new DbEvent(); 35 | assertNull(dbEventModel.getDbName()); 36 | assertNull(dbEventModel.getSeq()); 37 | assertNull(dbEventModel.getType()); 38 | } 39 | } -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/PostApiKeysOptionsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.PostApiKeysOptions; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the PostApiKeysOptions model. 27 | */ 28 | public class PostApiKeysOptionsTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testPostApiKeysOptions() throws Throwable { 34 | PostApiKeysOptions postApiKeysOptionsModel = new PostApiKeysOptions(); 35 | assertNotNull(postApiKeysOptionsModel); 36 | } 37 | } -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/ShardsInformationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.ShardsInformation; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the ShardsInformation model. 27 | */ 28 | public class ShardsInformationTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testShardsInformation() throws Throwable { 34 | ShardsInformation shardsInformationModel = new ShardsInformation(); 35 | assertNull(shardsInformationModel.getShards()); 36 | } 37 | } -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/SchedulerJobsResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import java.util.List; 17 | 18 | import com.google.gson.annotations.SerializedName; 19 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 20 | 21 | /** 22 | * Schema for a listing of replication scheduler jobs. 23 | */ 24 | public class SchedulerJobsResult extends GenericModel { 25 | 26 | @SerializedName("total_rows") 27 | protected Long totalRows; 28 | protected List jobs; 29 | 30 | protected SchedulerJobsResult() { } 31 | 32 | /** 33 | * Gets the totalRows. 34 | * 35 | * Total number of replication jobs. 36 | * 37 | * @return the totalRows 38 | */ 39 | public Long getTotalRows() { 40 | return totalRows; 41 | } 42 | 43 | /** 44 | * Gets the jobs. 45 | * 46 | * Array of replication job objects. 47 | * 48 | * @return the jobs 49 | */ 50 | public List getJobs() { 51 | return jobs; 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /modules/examples/src/main/java/features/StartOneOff.java: -------------------------------------------------------------------------------- 1 | /** 2 | * © Copyright IBM Corporation 2023. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package features; 14 | 15 | import java.util.stream.Stream; 16 | import com.ibm.cloud.cloudant.features.ChangesFollower; 17 | import com.ibm.cloud.cloudant.v1.Cloudant; 18 | import com.ibm.cloud.cloudant.v1.model.ChangesResultItem; 19 | import com.ibm.cloud.cloudant.v1.model.PostChangesOptions; 20 | 21 | public class StartOneOff { 22 | public static void main(String[] args) { 23 | 24 | Cloudant client = Cloudant.newInstance(); 25 | 26 | PostChangesOptions options = new PostChangesOptions.Builder("example") 27 | .build(); 28 | ChangesFollower changesFollower = new ChangesFollower(client, options); 29 | Stream changesItems = changesFollower.startOneOff(); 30 | // Note: java.util.Stream will not do anything until attached to a terminal operation. 31 | // Invoke a Stream terminal operation to commence the flow of changes. 32 | // e.g. changesItems.collect(...) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/IndexesInformation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import java.util.List; 17 | 18 | import com.google.gson.annotations.SerializedName; 19 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 20 | 21 | /** 22 | * Schema for information about the indexes in a database. 23 | */ 24 | public class IndexesInformation extends GenericModel { 25 | 26 | @SerializedName("total_rows") 27 | protected Long totalRows; 28 | protected List indexes; 29 | 30 | protected IndexesInformation() { } 31 | 32 | /** 33 | * Gets the totalRows. 34 | * 35 | * Total number of query indexes in the database. 36 | * 37 | * @return the totalRows 38 | */ 39 | public Long getTotalRows() { 40 | return totalRows; 41 | } 42 | 43 | /** 44 | * Gets the indexes. 45 | * 46 | * Indexes. 47 | * 48 | * @return the indexes 49 | */ 50 | public List getIndexes() { 51 | return indexes; 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/SearchAnalyzeResultTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.SearchAnalyzeResult; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the SearchAnalyzeResult model. 27 | */ 28 | public class SearchAnalyzeResultTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testSearchAnalyzeResult() throws Throwable { 34 | SearchAnalyzeResult searchAnalyzeResultModel = new SearchAnalyzeResult(); 35 | assertNull(searchAnalyzeResultModel.getTokens()); 36 | } 37 | } -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/SearchIndexDiskSizeTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.SearchIndexDiskSize; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the SearchIndexDiskSize model. 27 | */ 28 | public class SearchIndexDiskSizeTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testSearchIndexDiskSize() throws Throwable { 34 | SearchIndexDiskSize searchIndexDiskSizeModel = new SearchIndexDiskSize(); 35 | assertNull(searchIndexDiskSizeModel.getDiskSize()); 36 | } 37 | } -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## PR summary 2 | 3 | 4 | 5 | Fixes: 6 | 7 | **Note: An existing issue is [required](https://github.com/IBM/cloudant-java-sdk/blob/main/CONTRIBUTING.md#PRs) before opening a PR.** 8 | 9 | ## PR Checklist 10 | 11 | Please make sure that your PR fulfills the following requirements: 12 | 13 | - [ ] The commit message follows the 14 | [Angular Commit Message Guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines). 15 | - [ ] Tests for the changes have been added (for bug fixes / features) 16 | - [ ] Docs have been added / updated (for bug fixes / features) 17 | 18 | ## PR Type 19 | 20 | - [ ] Bugfix 21 | - [ ] Feature 22 | - [ ] Code style update (formatting, local variables) 23 | - [ ] Refactoring (no functional changes, no api changes) 24 | - [ ] New tests 25 | - [ ] Build/CI related changes 26 | - [ ] Documentation content changes 27 | - [ ] Other (please describe) 28 | 29 | ## What is the current behavior? 30 | 31 | 32 | ## What is the new behavior? 33 | 34 | 35 | ## Does this PR introduce a breaking change? 36 | 37 | - [ ] Yes 38 | - [ ] No 39 | 40 | 42 | 43 | ## Other information 44 | 45 | 47 | -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/GetActiveTasksOptionsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.GetActiveTasksOptions; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the GetActiveTasksOptions model. 27 | */ 28 | public class GetActiveTasksOptionsTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testGetActiveTasksOptions() throws Throwable { 34 | GetActiveTasksOptions getActiveTasksOptionsModel = new GetActiveTasksOptions(); 35 | assertNotNull(getActiveTasksOptionsModel); 36 | } 37 | } -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | on: 3 | push: 4 | branches: ['main'] 5 | pull_request: 6 | branches-ignore: ['gh-pages'] 7 | permissions: {} 8 | env: 9 | SERVER_AUTH_TYPE: basic 10 | SERVER_URL: http://127.0.0.1:5984 11 | SERVER_USERNAME: admin 12 | SERVER_PASSWORD: password 13 | WIREMOCK_URL: http://127.0.0.1:8080 14 | WIREMOCK_PORT: 8080 15 | jobs: 16 | test: 17 | strategy: 18 | matrix: 19 | java: ['11', '17', '21', '25'] 20 | runs-on: ubuntu-latest 21 | services: 22 | couchdb: 23 | image: apache/couchdb:3 24 | env: 25 | COUCHDB_USER: ${{ env.SERVER_USERNAME }} 26 | COUCHDB_PASSWORD: ${{ env.SERVER_PASSWORD }} 27 | options: --name couchdb 28 | ports: 29 | - 5984:5984 30 | wiremock: 31 | image: wiremock/wiremock 32 | options: --name wiremock 33 | ports: 34 | - 8080:8080 35 | steps: 36 | - name: Checkout code 37 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 38 | with: 39 | persist-credentials: false 40 | - name: Setup java ${{ matrix.java }} 41 | uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0 42 | with: 43 | distribution: 'semeru' 44 | java-version: ${{ matrix.java }} 45 | cache: 'maven' 46 | check-latest: false 47 | - name: Setup CouchDB 48 | shell: bash 49 | run: ${GITHUB_WORKSPACE}/scripts/setup_couch.sh 50 | - name: Setup Wiremock 51 | shell: bash 52 | run: ${GITHUB_WORKSPACE}/scripts/setup_wiremock.sh 53 | - name: Run tests 54 | run: mvn --batch-mode verify 55 | -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/DbUpdatesTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.DbEvent; 17 | import com.ibm.cloud.cloudant.v1.model.DbUpdates; 18 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 19 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 20 | import java.io.InputStream; 21 | import java.util.HashMap; 22 | import java.util.List; 23 | import org.testng.annotations.Test; 24 | import static org.testng.Assert.*; 25 | 26 | /** 27 | * Unit test class for the DbUpdates model. 28 | */ 29 | public class DbUpdatesTest { 30 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 31 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 32 | 33 | @Test 34 | public void testDbUpdates() throws Throwable { 35 | DbUpdates dbUpdatesModel = new DbUpdates(); 36 | assertNull(dbUpdatesModel.getLastSeq()); 37 | assertNull(dbUpdatesModel.getResults()); 38 | } 39 | } -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/SearchInfoResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.google.gson.annotations.SerializedName; 17 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 18 | 19 | /** 20 | * Schema for search index information. 21 | */ 22 | public class SearchInfoResult extends GenericModel { 23 | 24 | protected String name; 25 | @SerializedName("search_index") 26 | protected SearchIndexInfo searchIndex; 27 | 28 | protected SearchInfoResult() { } 29 | 30 | /** 31 | * Gets the name. 32 | * 33 | * The name of the search index prefixed by the design document ID where the index is stored. 34 | * 35 | * @return the name 36 | */ 37 | public String getName() { 38 | return name; 39 | } 40 | 41 | /** 42 | * Gets the searchIndex. 43 | * 44 | * Schema for metadata information about a search index. 45 | * 46 | * @return the searchIndex 47 | */ 48 | public SearchIndexInfo getSearchIndex() { 49 | return searchIndex; 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /examples/snippets/putSecurity/example_request.java: -------------------------------------------------------------------------------- 1 | // section: code imports 2 | import com.ibm.cloud.cloudant.v1.Cloudant; 3 | import com.ibm.cloud.cloudant.v1.model.Ok; 4 | import com.ibm.cloud.cloudant.v1.model.PutSecurityOptions; 5 | import com.ibm.cloud.cloudant.v1.model.SecurityObject; 6 | 7 | import java.util.Arrays; 8 | // section: code 9 | Cloudant service = Cloudant.newInstance(); 10 | 11 | SecurityObject members = new SecurityObject.Builder() 12 | .names(Arrays.asList("user1", "user2")) 13 | .roles(Arrays.asList("developers")) 14 | .build(); 15 | 16 | PutSecurityOptions securityOptions = 17 | new PutSecurityOptions.Builder() 18 | .db("products") 19 | .members(members) 20 | .build(); 21 | 22 | Ok response = 23 | service.putSecurity(securityOptions).execute() 24 | .getResult(); 25 | 26 | System.out.println(response); 27 | // section: markdown 28 | // The `nobody` username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but didn't identify itself, the task can continue only if the `nobody` user has the role `_reader`. 29 | // section: markdown 30 | // If instead of using Cloudant's security model for managing permissions you opt to use the Apache CouchDB `_users` database (that is using legacy credentials _and_ the `couchdb_auth_only:true` option) then be aware that the user must already exist in `_users` database before adding permissions. For information on the `_users` database, see Using the `_users` database with Cloudant. 31 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/features/pagination/AllDocsPageIterator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * © Copyright IBM Corporation 2025. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.features.pagination; 15 | 16 | import java.util.function.BiFunction; 17 | import com.ibm.cloud.cloudant.v1.Cloudant; 18 | import com.ibm.cloud.cloudant.v1.model.AllDocsResult; 19 | import com.ibm.cloud.cloudant.v1.model.PostAllDocsOptions; 20 | import com.ibm.cloud.cloudant.v1.model.PostAllDocsOptions.Builder; 21 | import com.ibm.cloud.sdk.core.http.ServiceCall; 22 | 23 | final class AllDocsPageIterator extends AllDocsBasePageIterator { 24 | 25 | AllDocsPageIterator(Cloudant client, PostAllDocsOptions options) { 26 | super(client, options, OptionsHandler.POST_ALL_DOCS); 27 | } 28 | 29 | @Override 30 | BiFunction> nextRequestFunction() { 31 | return Cloudant::postAllDocs; 32 | } 33 | 34 | @Override 35 | BiFunction nextKeySetter() { 36 | return Builder::startKey; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/GetUpInformationOptionsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.GetUpInformationOptions; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the GetUpInformationOptions model. 27 | */ 28 | public class GetUpInformationOptionsTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testGetUpInformationOptions() throws Throwable { 34 | GetUpInformationOptions getUpInformationOptionsModel = new GetUpInformationOptions(); 35 | assertNotNull(getUpInformationOptionsModel); 36 | } 37 | } -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/IndexResultTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.IndexResult; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the IndexResult model. 27 | */ 28 | public class IndexResultTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testIndexResult() throws Throwable { 34 | IndexResult indexResultModel = new IndexResult(); 35 | assertNull(indexResultModel.getId()); 36 | assertNull(indexResultModel.getName()); 37 | assertNull(indexResultModel.getResult()); 38 | } 39 | } -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/features/pagination/SearchPageIterator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * © Copyright IBM Corporation 2025. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.features.pagination; 15 | 16 | import java.util.function.BiFunction; 17 | import com.ibm.cloud.cloudant.v1.Cloudant; 18 | import com.ibm.cloud.cloudant.v1.model.PostSearchOptions; 19 | import com.ibm.cloud.cloudant.v1.model.PostSearchOptions.Builder; 20 | import com.ibm.cloud.cloudant.v1.model.SearchResult; 21 | import com.ibm.cloud.sdk.core.http.ServiceCall; 22 | 23 | final class SearchPageIterator extends SearchBasePageIterator { 24 | 25 | SearchPageIterator(Cloudant client, PostSearchOptions options) { 26 | super(client, options, OptionsHandler.POST_SEARCH); 27 | } 28 | 29 | @Override 30 | BiFunction bookmarkSetter() { 31 | return Builder::bookmark; 32 | } 33 | 34 | @Override 35 | BiFunction> nextRequestFunction() { 36 | return Cloudant::postSearch; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/SchedulerDocsResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import java.util.List; 17 | 18 | import com.google.gson.annotations.SerializedName; 19 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 20 | 21 | /** 22 | * Schema for a listing of replication scheduler documents. 23 | */ 24 | public class SchedulerDocsResult extends GenericModel { 25 | 26 | @SerializedName("total_rows") 27 | protected Long totalRows; 28 | protected List docs; 29 | 30 | protected SchedulerDocsResult() { } 31 | 32 | /** 33 | * Gets the totalRows. 34 | * 35 | * Total number of replication scheduler documents. 36 | * 37 | * @return the totalRows 38 | */ 39 | public Long getTotalRows() { 40 | return totalRows; 41 | } 42 | 43 | /** 44 | * Gets the docs. 45 | * 46 | * Array of replication scheduler doc objects. 47 | * 48 | * @return the docs 49 | */ 50 | public List getDocs() { 51 | return docs; 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/SearchDiskSizeInformation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.google.gson.annotations.SerializedName; 17 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 18 | 19 | /** 20 | * Schema for search index disk size. 21 | */ 22 | public class SearchDiskSizeInformation extends GenericModel { 23 | 24 | protected String name; 25 | @SerializedName("search_index") 26 | protected SearchIndexDiskSize searchIndex; 27 | 28 | protected SearchDiskSizeInformation() { } 29 | 30 | /** 31 | * Gets the name. 32 | * 33 | * The name of the search index prefixed by the design document ID where the index is stored. 34 | * 35 | * @return the name 36 | */ 37 | public String getName() { 38 | return name; 39 | } 40 | 41 | /** 42 | * Gets the searchIndex. 43 | * 44 | * Schema for search index disk size. 45 | * 46 | * @return the searchIndex 47 | */ 48 | public SearchIndexDiskSize getSearchIndex() { 49 | return searchIndex; 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /modules/cloudant/src/main/java/com/ibm/cloud/cloudant/v1/model/RevsDiff.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import java.util.List; 17 | 18 | import com.google.gson.annotations.SerializedName; 19 | import com.ibm.cloud.sdk.core.service.model.GenericModel; 20 | 21 | /** 22 | * Schema for information about missing revs and possible ancestors. 23 | */ 24 | public class RevsDiff extends GenericModel { 25 | 26 | protected List missing; 27 | @SerializedName("possible_ancestors") 28 | protected List possibleAncestors; 29 | 30 | protected RevsDiff() { } 31 | 32 | /** 33 | * Gets the missing. 34 | * 35 | * List of missing revisions. 36 | * 37 | * @return the missing 38 | */ 39 | public List getMissing() { 40 | return missing; 41 | } 42 | 43 | /** 44 | * Gets the possibleAncestors. 45 | * 46 | * List of possible ancestor revisions. 47 | * 48 | * @return the possibleAncestors 49 | */ 50 | public List getPossibleAncestors() { 51 | return possibleAncestors; 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/DocumentShardInfoTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.DocumentShardInfo; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the DocumentShardInfo model. 27 | */ 28 | public class DocumentShardInfoTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testDocumentShardInfo() throws Throwable { 34 | DocumentShardInfo documentShardInfoModel = new DocumentShardInfo(); 35 | assertNull(documentShardInfoModel.getNodes()); 36 | assertNull(documentShardInfoModel.getRange()); 37 | } 38 | } -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/HeadUpInformationOptionsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.HeadUpInformationOptions; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the HeadUpInformationOptions model. 27 | */ 28 | public class HeadUpInformationOptionsTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testHeadUpInformationOptions() throws Throwable { 34 | HeadUpInformationOptions headUpInformationOptionsModel = new HeadUpInformationOptions(); 35 | assertNotNull(headUpInformationOptionsModel); 36 | } 37 | } -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/ServerVendorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.ServerVendor; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the ServerVendor model. 27 | */ 28 | public class ServerVendorTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testServerVendor() throws Throwable { 34 | ServerVendor serverVendorModel = new ServerVendor(); 35 | assertNull(serverVendorModel.getName()); 36 | assertNull(serverVendorModel.getVariant()); 37 | assertNull(serverVendorModel.getVersion()); 38 | } 39 | } -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/ApiKeysResultTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.ApiKeysResult; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the ApiKeysResult model. 27 | */ 28 | public class ApiKeysResultTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testApiKeysResult() throws Throwable { 34 | ApiKeysResult apiKeysResultModel = new ApiKeysResult(); 35 | assertNull(apiKeysResultModel.isOk()); 36 | assertNull(apiKeysResultModel.getKey()); 37 | assertNull(apiKeysResultModel.getPassword()); 38 | } 39 | } -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/DocsResultRowValueTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.DocsResultRowValue; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the DocsResultRowValue model. 27 | */ 28 | public class DocsResultRowValueTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testDocsResultRowValue() throws Throwable { 34 | DocsResultRowValue docsResultRowValueModel = new DocsResultRowValue(); 35 | assertNull(docsResultRowValueModel.isDeleted()); 36 | assertNull(docsResultRowValueModel.getRev()); 37 | } 38 | } -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/GetCorsInformationOptionsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.GetCorsInformationOptions; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the GetCorsInformationOptions model. 27 | */ 28 | public class GetCorsInformationOptionsTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testGetCorsInformationOptions() throws Throwable { 34 | GetCorsInformationOptions getCorsInformationOptionsModel = new GetCorsInformationOptions(); 35 | assertNotNull(getCorsInformationOptionsModel); 36 | } 37 | } -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/GetUuidsOptionsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.GetUuidsOptions; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the GetUuidsOptions model. 27 | */ 28 | public class GetUuidsOptionsTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testGetUuidsOptions() throws Throwable { 34 | GetUuidsOptions getUuidsOptionsModel = new GetUuidsOptions.Builder() 35 | .count(Long.valueOf("1")) 36 | .build(); 37 | assertEquals(getUuidsOptionsModel.count(), Long.valueOf("1")); 38 | } 39 | } -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/DatabaseInformationPropsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.DatabaseInformationProps; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the DatabaseInformationProps model. 27 | */ 28 | public class DatabaseInformationPropsTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testDatabaseInformationProps() throws Throwable { 34 | DatabaseInformationProps databaseInformationPropsModel = new DatabaseInformationProps(); 35 | assertNull(databaseInformationPropsModel.isPartitioned()); 36 | } 37 | } -------------------------------------------------------------------------------- /modules/cloudant/src/test/java/com/ibm/cloud/cloudant/v1/model/UpInformationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright IBM Corp. 2025. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.ibm.cloud.cloudant.v1.model; 15 | 16 | import com.ibm.cloud.cloudant.v1.model.UpInformation; 17 | import com.ibm.cloud.cloudant.v1.utils.TestUtilities; 18 | import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 19 | import java.io.InputStream; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import org.testng.annotations.Test; 23 | import static org.testng.Assert.*; 24 | 25 | /** 26 | * Unit test class for the UpInformation model. 27 | */ 28 | public class UpInformationTest { 29 | final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); 30 | final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); 31 | 32 | @Test 33 | public void testUpInformation() throws Throwable { 34 | UpInformation upInformationModel = new UpInformation(); 35 | assertNull(upInformationModel.getCluster()); 36 | assertNull(upInformationModel.getSeeds()); 37 | assertNull(upInformationModel.getStatus()); 38 | } 39 | } --------------------------------------------------------------------------------