public class CosmosContainer extends Object
Modifier and Type | Method and Description |
---|---|
<T> CosmosItemResponse<T> |
createItem(T item)
Creates a new item synchronously and returns its respective Cosmos item response.
|
<T> CosmosItemResponse<T> |
createItem(T item,
CosmosItemRequestOptions options)
Creates a new item synchronously and returns its respective Cosmos item response
while specifying additional options.
|
<T> CosmosItemResponse<T> |
createItem(T item,
PartitionKey partitionKey,
CosmosItemRequestOptions options)
Creates a new item synchronously and returns its respective Cosmos item response
while specifying additional options.
|
CosmosContainerResponse |
delete()
Deletes the current cosmos container.
|
CosmosContainerResponse |
delete(CosmosContainerRequestOptions options)
Deletes the current Cosmos container while specifying additional options such as If-Match.
|
CosmosItemResponse<Object> |
deleteItem(String itemId,
PartitionKey partitionKey,
CosmosItemRequestOptions options)
Deletes an item in the current container.
|
<T> CosmosItemResponse<Object> |
deleteItem(T item,
CosmosItemRequestOptions options)
Deletes an item in the current container.
|
String |
getId()
Gets the current container id.
|
CosmosScripts |
getScripts()
Gets the Cosmos scripts using the current container as context.
|
<T> CosmosPagedIterable<T> |
queryItems(SqlQuerySpec querySpec,
CosmosQueryRequestOptions options,
Class<T> classType)
Query items in the current container returning the results as
CosmosPagedIterable . |
<T> CosmosPagedIterable<T> |
queryItems(String query,
CosmosQueryRequestOptions options,
Class<T> classType)
Query items in the current container returning the results as
CosmosPagedIterable . |
CosmosContainerResponse |
read()
Reads the current container.
|
CosmosContainerResponse |
read(CosmosContainerRequestOptions options)
Reads the current container while specifying additional options such as If-Match.
|
<T> CosmosPagedIterable<T> |
readAllItems(PartitionKey partitionKey,
Class<T> classType)
Reads all the items of a logical partition returning the results as
CosmosPagedIterable . |
<T> CosmosPagedIterable<T> |
readAllItems(PartitionKey partitionKey,
CosmosQueryRequestOptions options,
Class<T> classType)
Reads all the items of a logical partition returning the results as
CosmosPagedIterable . |
<T> CosmosItemResponse<T> |
readItem(String itemId,
PartitionKey partitionKey,
Class<T> itemType)
Reads an item in the current container.
|
<T> CosmosItemResponse<T> |
readItem(String itemId,
PartitionKey partitionKey,
CosmosItemRequestOptions options,
Class<T> itemType)
Reads an item in the current container while specifying additional options.
|
<T> FeedResponse<T> |
readMany(List<CosmosItemIdentity> itemIdentityList,
Class<T> classType)
Reads many documents.
|
<T> FeedResponse<T> |
readMany(List<CosmosItemIdentity> itemIdentityList,
String sessionToken,
Class<T> classType)
Reads many documents.
|
ThroughputResponse |
readThroughput()
Gets the throughput for the current container.
|
CosmosContainerResponse |
replace(CosmosContainerProperties containerProperties)
Replaces the current container properties.
|
CosmosContainerResponse |
replace(CosmosContainerProperties containerProperties,
CosmosContainerRequestOptions options)
Replaces the current container properties while specifying additional options such as If-Match.
|
<T> CosmosItemResponse<T> |
replaceItem(T item,
String itemId,
PartitionKey partitionKey,
CosmosItemRequestOptions options)
Replaces an item in the current container.
|
ThroughputResponse |
replaceThroughput(ThroughputProperties throughputProperties)
Sets the throughput for the current container.
|
<T> CosmosItemResponse<T> |
upsertItem(T item)
Upserts an Cosmos item in the current container.
|
<T> CosmosItemResponse<T> |
upsertItem(T item,
CosmosItemRequestOptions options)
Upserts a item Cosmos sync item while specifying additional options.
|
<T> CosmosItemResponse<T> |
upsertItem(T item,
PartitionKey partitionKey,
CosmosItemRequestOptions options)
Upserts a item Cosmos sync item while specifying additional options.
|
public String getId()
public CosmosContainerResponse read()
public CosmosContainerResponse read(CosmosContainerRequestOptions options)
options
- the options.public CosmosContainerResponse delete(CosmosContainerRequestOptions options)
options
- the options.public CosmosContainerResponse delete()
public CosmosContainerResponse replace(CosmosContainerProperties containerProperties)
containerProperties
- the container properties.public CosmosContainerResponse replace(CosmosContainerProperties containerProperties, CosmosContainerRequestOptions options)
containerProperties
- the container properties.options
- the options.public ThroughputResponse replaceThroughput(ThroughputProperties throughputProperties)
throughputProperties
- the throughput properties.public ThroughputResponse readThroughput()
public <T> CosmosItemResponse<T> createItem(T item)
T
- the type parameteritem
- the itempublic <T> CosmosItemResponse<T> createItem(T item, PartitionKey partitionKey, CosmosItemRequestOptions options)
T
- the type parameter.item
- the item.partitionKey
- the partition key.options
- the options.public <T> CosmosItemResponse<T> createItem(T item, CosmosItemRequestOptions options)
The partition key value will be automatically extracted from the item's content.
T
- the type parameter.item
- the item.options
- the options.public <T> CosmosItemResponse<T> upsertItem(T item)
T
- the type parameter.item
- the item.public <T> CosmosItemResponse<T> upsertItem(T item, CosmosItemRequestOptions options)
T
- the type parameter.item
- the item.options
- the options.public <T> CosmosItemResponse<T> upsertItem(T item, PartitionKey partitionKey, CosmosItemRequestOptions options)
T
- the type parameter.item
- the item.partitionKey
- the partitionKey.options
- the options.public <T> CosmosPagedIterable<T> queryItems(String query, CosmosQueryRequestOptions options, Class<T> classType)
CosmosPagedIterable
.T
- the type parameter.query
- the query.options
- the options.classType
- the class type.CosmosPagedIterable
.public <T> CosmosPagedIterable<T> queryItems(SqlQuerySpec querySpec, CosmosQueryRequestOptions options, Class<T> classType)
CosmosPagedIterable
.T
- the type parameter.querySpec
- the query spec.options
- the options.classType
- the class type.CosmosPagedIterable
.@Beta(value=V4_4_0) public <T> FeedResponse<T> readMany(List<CosmosItemIdentity> itemIdentityList, Class<T> classType)
T
- the type parameteritemIdentityList
- CosmosItem id and partition key tuple of items that that needs to be readclassType
- class type@Beta(value=V4_4_0) public <T> FeedResponse<T> readMany(List<CosmosItemIdentity> itemIdentityList, String sessionToken, Class<T> classType)
T
- the type parameteritemIdentityList
- CosmosItem id and partition key tuple of items that that needs to be readsessionToken
- the optional Session token - null if the read can be made without specific session tokenclassType
- class typepublic <T> CosmosPagedIterable<T> readAllItems(PartitionKey partitionKey, Class<T> classType)
CosmosPagedIterable
.T
- the type parameter.partitionKey
- the partition key value of the documents that need to be readclassType
- the class type.CosmosPagedIterable
.public <T> CosmosPagedIterable<T> readAllItems(PartitionKey partitionKey, CosmosQueryRequestOptions options, Class<T> classType)
CosmosPagedIterable
.
T
- the type parameter.partitionKey
- the partition key value of the documents that need to be readoptions
- the feed options.classType
- the class type.CosmosPagedIterable
.public <T> CosmosItemResponse<T> readItem(String itemId, PartitionKey partitionKey, Class<T> itemType)
T
- the type parameter.itemId
- the item id.partitionKey
- the partition key.itemType
- the class type of item.public <T> CosmosItemResponse<T> readItem(String itemId, PartitionKey partitionKey, CosmosItemRequestOptions options, Class<T> itemType)
T
- the type parameter.itemId
- the item id.partitionKey
- the partition key.options
- the options.itemType
- the class type of item.public <T> CosmosItemResponse<T> replaceItem(T item, String itemId, PartitionKey partitionKey, CosmosItemRequestOptions options)
T
- the type parameter.item
- the item.itemId
- the item id.partitionKey
- the partition key.options
- the options.public CosmosItemResponse<Object> deleteItem(String itemId, PartitionKey partitionKey, CosmosItemRequestOptions options)
itemId
- the item id.partitionKey
- the partition key.options
- the options.public <T> CosmosItemResponse<Object> deleteItem(T item, CosmosItemRequestOptions options)
T
- the type parameter.item
- the item to be deleted.options
- the options.public CosmosScripts getScripts()
Copyright © 2020 Microsoft Corporation. All rights reserved.