AzureCommunicationChatServiceImpl.java
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.communication.chat.implementation;
import com.azure.communication.chat.implementation.models.AddChatThreadMembersOptions;
import com.azure.communication.chat.implementation.models.ChatMessage;
import com.azure.communication.chat.implementation.models.ChatMessagesCollection;
import com.azure.communication.chat.implementation.models.ChatThread;
import com.azure.communication.chat.implementation.models.ChatThreadMember;
import com.azure.communication.chat.implementation.models.ChatThreadMembersCollection;
import com.azure.communication.chat.implementation.models.ChatThreadsInfoCollection;
import com.azure.communication.chat.implementation.models.CreateChatThreadOptions;
import com.azure.communication.chat.implementation.models.MultiStatusResponse;
import com.azure.communication.chat.implementation.models.ReadReceipt;
import com.azure.communication.chat.implementation.models.ReadReceiptsCollection;
import com.azure.communication.chat.implementation.models.SendReadReceiptRequest;
import com.azure.communication.chat.models.ChatThreadInfo;
import com.azure.communication.chat.models.ErrorException;
import com.azure.communication.chat.models.SendChatMessageOptions;
import com.azure.communication.chat.models.SendChatMessageResult;
import com.azure.communication.chat.models.UpdateChatMessageOptions;
import com.azure.communication.chat.models.UpdateChatThreadOptions;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.Patch;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
import com.azure.core.http.policy.CookiePolicy;
import com.azure.core.http.policy.RetryPolicy;
import com.azure.core.http.policy.UserAgentPolicy;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.serializer.JacksonAdapter;
import com.azure.core.util.serializer.SerializerAdapter;
import java.time.OffsetDateTime;
import reactor.core.publisher.Mono;
/** Initializes a new instance of the AzureCommunicationChatService type. */
public final class AzureCommunicationChatServiceImpl {
/** The proxy service used to perform REST calls. */
private final AzureCommunicationChatServiceService service;
/** The endpoint of the Azure Communication resource. */
private final String endpoint;
/**
* Gets The endpoint of the Azure Communication resource.
*
* @return the endpoint value.
*/
public String getEndpoint() {
return this.endpoint;
}
/** Api Version. */
private final String apiVersion;
/**
* Gets Api Version.
*
* @return the apiVersion value.
*/
public String getApiVersion() {
return this.apiVersion;
}
/** The HTTP pipeline to send requests through. */
private final HttpPipeline httpPipeline;
/**
* Gets The HTTP pipeline to send requests through.
*
* @return the httpPipeline value.
*/
public HttpPipeline getHttpPipeline() {
return this.httpPipeline;
}
/** The serializer to serialize an object into a string. */
private final SerializerAdapter serializerAdapter;
/**
* Gets The serializer to serialize an object into a string.
*
* @return the serializerAdapter value.
*/
public SerializerAdapter getSerializerAdapter() {
return this.serializerAdapter;
}
/** Initializes an instance of AzureCommunicationChatService client. */
AzureCommunicationChatServiceImpl(String endpoint) {
this(
new HttpPipelineBuilder()
.policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy())
.build(),
JacksonAdapter.createDefaultSerializerAdapter(),
endpoint);
}
/**
* Initializes an instance of AzureCommunicationChatService client.
*
* @param httpPipeline The HTTP pipeline to send requests through.
*/
AzureCommunicationChatServiceImpl(HttpPipeline httpPipeline, String endpoint) {
this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint);
}
/**
* Initializes an instance of AzureCommunicationChatService client.
*
* @param httpPipeline The HTTP pipeline to send requests through.
* @param serializerAdapter The serializer to serialize an object into a string.
*/
AzureCommunicationChatServiceImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) {
this.httpPipeline = httpPipeline;
this.serializerAdapter = serializerAdapter;
this.endpoint = endpoint;
this.apiVersion = "2020-09-21-preview2";
this.service =
RestProxy.create(
AzureCommunicationChatServiceService.class, this.httpPipeline, this.getSerializerAdapter());
}
/**
* The interface defining all the services for AzureCommunicationChatService to be used by the proxy service to
* perform REST calls.
*/
@Host("{endpoint}")
@ServiceInterface(name = "AzureCommunicationCh")
private interface AzureCommunicationChatServiceService {
@Get("/chat/threads/{chatThreadId}/readreceipts")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<ReadReceiptsCollection>> listChatReadReceipts(
@HostParam("endpoint") String endpoint,
@PathParam("chatThreadId") String chatThreadId,
@QueryParam("api-version") String apiVersion,
Context context);
@Post("/chat/threads/{chatThreadId}/readreceipts")
@ExpectedResponses({201})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<Void>> sendChatReadReceipt(
@HostParam("endpoint") String endpoint,
@PathParam("chatThreadId") String chatThreadId,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") SendReadReceiptRequest body,
Context context);
@Post("/chat/threads/{chatThreadId}/messages")
@ExpectedResponses({201})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<SendChatMessageResult>> sendChatMessage(
@HostParam("endpoint") String endpoint,
@PathParam("chatThreadId") String chatThreadId,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") SendChatMessageOptions body,
Context context);
@Get("/chat/threads/{chatThreadId}/messages")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<ChatMessagesCollection>> listChatMessages(
@HostParam("endpoint") String endpoint,
@PathParam("chatThreadId") String chatThreadId,
@QueryParam("maxPageSize") Integer maxPageSize,
@QueryParam("startTime") OffsetDateTime startTime,
@QueryParam("api-version") String apiVersion,
Context context);
@Get("/chat/threads/{chatThreadId}/messages/{chatMessageId}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<ChatMessage>> getChatMessage(
@HostParam("endpoint") String endpoint,
@PathParam("chatThreadId") String chatThreadId,
@PathParam("chatMessageId") String chatMessageId,
@QueryParam("api-version") String apiVersion,
Context context);
@Patch("/chat/threads/{chatThreadId}/messages/{chatMessageId}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<Void>> updateChatMessage(
@HostParam("endpoint") String endpoint,
@PathParam("chatThreadId") String chatThreadId,
@PathParam("chatMessageId") String chatMessageId,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") UpdateChatMessageOptions body,
Context context);
@Delete("/chat/threads/{chatThreadId}/messages/{chatMessageId}")
@ExpectedResponses({204})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<Void>> deleteChatMessage(
@HostParam("endpoint") String endpoint,
@PathParam("chatThreadId") String chatThreadId,
@PathParam("chatMessageId") String chatMessageId,
@QueryParam("api-version") String apiVersion,
Context context);
@Post("/chat/threads/{chatThreadId}/typing")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<Void>> sendTypingNotification(
@HostParam("endpoint") String endpoint,
@PathParam("chatThreadId") String chatThreadId,
@QueryParam("api-version") String apiVersion,
Context context);
@Get("/chat/threads/{chatThreadId}/members")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<ChatThreadMembersCollection>> listChatThreadMembers(
@HostParam("endpoint") String endpoint,
@PathParam("chatThreadId") String chatThreadId,
@QueryParam("api-version") String apiVersion,
Context context);
@Post("/chat/threads/{chatThreadId}/members")
@ExpectedResponses({207})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<Void>> addChatThreadMembers(
@HostParam("endpoint") String endpoint,
@PathParam("chatThreadId") String chatThreadId,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") AddChatThreadMembersOptions body,
Context context);
@Delete("/chat/threads/{chatThreadId}/members/{chatMemberId}")
@ExpectedResponses({204})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<Void>> removeChatThreadMember(
@HostParam("endpoint") String endpoint,
@PathParam("chatThreadId") String chatThreadId,
@PathParam("chatMemberId") String chatMemberId,
@QueryParam("api-version") String apiVersion,
Context context);
@Post("/chat/threads")
@ExpectedResponses({207})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<MultiStatusResponse>> createChatThread(
@HostParam("endpoint") String endpoint,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") CreateChatThreadOptions body,
Context context);
@Get("/chat/threads")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<ChatThreadsInfoCollection>> listChatThreads(
@HostParam("endpoint") String endpoint,
@QueryParam("maxPageSize") Integer maxPageSize,
@QueryParam("startTime") OffsetDateTime startTime,
@QueryParam("api-version") String apiVersion,
Context context);
@Patch("/chat/threads/{chatThreadId}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<Void>> updateChatThread(
@HostParam("endpoint") String endpoint,
@PathParam("chatThreadId") String chatThreadId,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") UpdateChatThreadOptions body,
Context context);
@Get("/chat/threads/{chatThreadId}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<ChatThread>> getChatThread(
@HostParam("endpoint") String endpoint,
@PathParam("chatThreadId") String chatThreadId,
@QueryParam("api-version") String apiVersion,
Context context);
@Delete("/chat/threads/{chatThreadId}")
@ExpectedResponses({204})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<Void>> deleteChatThread(
@HostParam("endpoint") String endpoint,
@PathParam("chatThreadId") String chatThreadId,
@QueryParam("api-version") String apiVersion,
Context context);
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<ReadReceiptsCollection>> listChatReadReceiptsNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<ChatMessagesCollection>> listChatMessagesNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<ChatThreadMembersCollection>> listChatThreadMembersNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ErrorException.class)
Mono<Response<ChatThreadsInfoCollection>> listChatThreadsNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
}
/**
* Gets read receipts for a thread.
*
* @param chatThreadId Thread id to get the read receipts for.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return read receipts for a thread.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<ReadReceipt>> listChatReadReceiptsSinglePageAsync(String chatThreadId) {
return FluxUtil.withContext(
context ->
service.listChatReadReceipts(
this.getEndpoint(), chatThreadId, this.getApiVersion(), context))
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Gets read receipts for a thread.
*
* @param chatThreadId Thread id to get the read receipts for.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return read receipts for a thread.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<ReadReceipt>> listChatReadReceiptsSinglePageAsync(String chatThreadId, Context context) {
return service.listChatReadReceipts(this.getEndpoint(), chatThreadId, this.getApiVersion(), context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Gets read receipts for a thread.
*
* @param chatThreadId Thread id to get the read receipts for.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return read receipts for a thread.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<ReadReceipt> listChatReadReceiptsAsync(String chatThreadId) {
return new PagedFlux<>(
() -> listChatReadReceiptsSinglePageAsync(chatThreadId),
nextLink -> listChatReadReceiptsNextSinglePageAsync(nextLink));
}
/**
* Gets read receipts for a thread.
*
* @param chatThreadId Thread id to get the read receipts for.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return read receipts for a thread.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<ReadReceipt> listChatReadReceiptsAsync(String chatThreadId, Context context) {
return new PagedFlux<>(
() -> listChatReadReceiptsSinglePageAsync(chatThreadId, context),
nextLink -> listChatReadReceiptsNextSinglePageAsync(nextLink, context));
}
/**
* Gets read receipts for a thread.
*
* @param chatThreadId Thread id to get the read receipts for.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return read receipts for a thread.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ReadReceipt> listChatReadReceipts(String chatThreadId) {
return new PagedIterable<>(listChatReadReceiptsAsync(chatThreadId));
}
/**
* Gets read receipts for a thread.
*
* @param chatThreadId Thread id to get the read receipts for.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return read receipts for a thread.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ReadReceipt> listChatReadReceipts(String chatThreadId, Context context) {
return new PagedIterable<>(listChatReadReceiptsAsync(chatThreadId, context));
}
/**
* Sends a read receipt event to a thread, on behalf of a user.
*
* @param chatThreadId Thread id to send the read receipt event to.
* @param body Request payload for sending a read receipt.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> sendChatReadReceiptWithResponseAsync(String chatThreadId, SendReadReceiptRequest body) {
return FluxUtil.withContext(
context ->
service.sendChatReadReceipt(
this.getEndpoint(), chatThreadId, this.getApiVersion(), body, context));
}
/**
* Sends a read receipt event to a thread, on behalf of a user.
*
* @param chatThreadId Thread id to send the read receipt event to.
* @param body Request payload for sending a read receipt.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> sendChatReadReceiptWithResponseAsync(
String chatThreadId, SendReadReceiptRequest body, Context context) {
return service.sendChatReadReceipt(this.getEndpoint(), chatThreadId, this.getApiVersion(), body, context);
}
/**
* Sends a read receipt event to a thread, on behalf of a user.
*
* @param chatThreadId Thread id to send the read receipt event to.
* @param body Request payload for sending a read receipt.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> sendChatReadReceiptAsync(String chatThreadId, SendReadReceiptRequest body) {
return sendChatReadReceiptWithResponseAsync(chatThreadId, body).flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Sends a read receipt event to a thread, on behalf of a user.
*
* @param chatThreadId Thread id to send the read receipt event to.
* @param body Request payload for sending a read receipt.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> sendChatReadReceiptAsync(String chatThreadId, SendReadReceiptRequest body, Context context) {
return sendChatReadReceiptWithResponseAsync(chatThreadId, body, context)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Sends a read receipt event to a thread, on behalf of a user.
*
* @param chatThreadId Thread id to send the read receipt event to.
* @param body Request payload for sending a read receipt.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void sendChatReadReceipt(String chatThreadId, SendReadReceiptRequest body) {
sendChatReadReceiptAsync(chatThreadId, body).block();
}
/**
* Sends a read receipt event to a thread, on behalf of a user.
*
* @param chatThreadId Thread id to send the read receipt event to.
* @param body Request payload for sending a read receipt.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void sendChatReadReceipt(String chatThreadId, SendReadReceiptRequest body, Context context) {
sendChatReadReceiptAsync(chatThreadId, body, context).block();
}
/**
* Sends a message to a thread.
*
* @param chatThreadId The thread id to send the message to.
* @param body Details of the message to send.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the send message operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<SendChatMessageResult>> sendChatMessageWithResponseAsync(
String chatThreadId, SendChatMessageOptions body) {
return FluxUtil.withContext(
context ->
service.sendChatMessage(this.getEndpoint(), chatThreadId, this.getApiVersion(), body, context));
}
/**
* Sends a message to a thread.
*
* @param chatThreadId The thread id to send the message to.
* @param body Details of the message to send.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the send message operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<SendChatMessageResult>> sendChatMessageWithResponseAsync(
String chatThreadId, SendChatMessageOptions body, Context context) {
return service.sendChatMessage(this.getEndpoint(), chatThreadId, this.getApiVersion(), body, context);
}
/**
* Sends a message to a thread.
*
* @param chatThreadId The thread id to send the message to.
* @param body Details of the message to send.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the send message operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<SendChatMessageResult> sendChatMessageAsync(String chatThreadId, SendChatMessageOptions body) {
return sendChatMessageWithResponseAsync(chatThreadId, body)
.flatMap(
(Response<SendChatMessageResult> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Sends a message to a thread.
*
* @param chatThreadId The thread id to send the message to.
* @param body Details of the message to send.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the send message operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<SendChatMessageResult> sendChatMessageAsync(
String chatThreadId, SendChatMessageOptions body, Context context) {
return sendChatMessageWithResponseAsync(chatThreadId, body, context)
.flatMap(
(Response<SendChatMessageResult> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Sends a message to a thread.
*
* @param chatThreadId The thread id to send the message to.
* @param body Details of the message to send.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the send message operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SendChatMessageResult sendChatMessage(String chatThreadId, SendChatMessageOptions body) {
return sendChatMessageAsync(chatThreadId, body).block();
}
/**
* Sends a message to a thread.
*
* @param chatThreadId The thread id to send the message to.
* @param body Details of the message to send.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the send message operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SendChatMessageResult sendChatMessage(String chatThreadId, SendChatMessageOptions body, Context context) {
return sendChatMessageAsync(chatThreadId, body, context).block();
}
/**
* Gets a list of messages from a thread.
*
* @param chatThreadId The thread id of the message.
* @param maxPageSize The maximum number of messages to be returned per page.
* @param startTime The earliest point in time to get messages up to. The timestamp should be in ISO8601 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of messages from a thread.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<ChatMessage>> listChatMessagesSinglePageAsync(
String chatThreadId, Integer maxPageSize, OffsetDateTime startTime) {
return FluxUtil.withContext(
context ->
service.listChatMessages(
this.getEndpoint(),
chatThreadId,
maxPageSize,
startTime,
this.getApiVersion(),
context))
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Gets a list of messages from a thread.
*
* @param chatThreadId The thread id of the message.
* @param maxPageSize The maximum number of messages to be returned per page.
* @param startTime The earliest point in time to get messages up to. The timestamp should be in ISO8601 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of messages from a thread.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<ChatMessage>> listChatMessagesSinglePageAsync(
String chatThreadId, Integer maxPageSize, OffsetDateTime startTime, Context context) {
return service.listChatMessages(
this.getEndpoint(), chatThreadId, maxPageSize, startTime, this.getApiVersion(), context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Gets a list of messages from a thread.
*
* @param chatThreadId The thread id of the message.
* @param maxPageSize The maximum number of messages to be returned per page.
* @param startTime The earliest point in time to get messages up to. The timestamp should be in ISO8601 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of messages from a thread.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<ChatMessage> listChatMessagesAsync(
String chatThreadId, Integer maxPageSize, OffsetDateTime startTime) {
return new PagedFlux<>(
() -> listChatMessagesSinglePageAsync(chatThreadId, maxPageSize, startTime),
nextLink -> listChatMessagesNextSinglePageAsync(nextLink));
}
/**
* Gets a list of messages from a thread.
*
* @param chatThreadId The thread id of the message.
* @param maxPageSize The maximum number of messages to be returned per page.
* @param startTime The earliest point in time to get messages up to. The timestamp should be in ISO8601 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of messages from a thread.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<ChatMessage> listChatMessagesAsync(
String chatThreadId, Integer maxPageSize, OffsetDateTime startTime, Context context) {
return new PagedFlux<>(
() -> listChatMessagesSinglePageAsync(chatThreadId, maxPageSize, startTime, context),
nextLink -> listChatMessagesNextSinglePageAsync(nextLink, context));
}
/**
* Gets a list of messages from a thread.
*
* @param chatThreadId The thread id of the message.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of messages from a thread.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<ChatMessage> listChatMessagesAsync(String chatThreadId) {
final Integer maxPageSize = null;
final OffsetDateTime startTime = null;
final Context context = null;
return new PagedFlux<>(
() -> listChatMessagesSinglePageAsync(chatThreadId, maxPageSize, startTime),
nextLink -> listChatMessagesNextSinglePageAsync(nextLink, context));
}
/**
* Gets a list of messages from a thread.
*
* @param chatThreadId The thread id of the message.
* @param maxPageSize The maximum number of messages to be returned per page.
* @param startTime The earliest point in time to get messages up to. The timestamp should be in ISO8601 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of messages from a thread.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ChatMessage> listChatMessages(
String chatThreadId, Integer maxPageSize, OffsetDateTime startTime) {
return new PagedIterable<>(listChatMessagesAsync(chatThreadId, maxPageSize, startTime));
}
/**
* Gets a list of messages from a thread.
*
* @param chatThreadId The thread id of the message.
* @param maxPageSize The maximum number of messages to be returned per page.
* @param startTime The earliest point in time to get messages up to. The timestamp should be in ISO8601 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of messages from a thread.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ChatMessage> listChatMessages(
String chatThreadId, Integer maxPageSize, OffsetDateTime startTime, Context context) {
return new PagedIterable<>(listChatMessagesAsync(chatThreadId, maxPageSize, startTime, context));
}
/**
* Gets a list of messages from a thread.
*
* @param chatThreadId The thread id of the message.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of messages from a thread.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ChatMessage> listChatMessages(String chatThreadId) {
final Integer maxPageSize = null;
final OffsetDateTime startTime = null;
final Context context = null;
return new PagedIterable<>(listChatMessagesAsync(chatThreadId, maxPageSize, startTime));
}
/**
* Gets a message by id.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a message by id.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<ChatMessage>> getChatMessageWithResponseAsync(String chatThreadId, String chatMessageId) {
return FluxUtil.withContext(
context ->
service.getChatMessage(
this.getEndpoint(), chatThreadId, chatMessageId, this.getApiVersion(), context));
}
/**
* Gets a message by id.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a message by id.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<ChatMessage>> getChatMessageWithResponseAsync(
String chatThreadId, String chatMessageId, Context context) {
return service.getChatMessage(this.getEndpoint(), chatThreadId, chatMessageId, this.getApiVersion(), context);
}
/**
* Gets a message by id.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a message by id.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ChatMessage> getChatMessageAsync(String chatThreadId, String chatMessageId) {
return getChatMessageWithResponseAsync(chatThreadId, chatMessageId)
.flatMap(
(Response<ChatMessage> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets a message by id.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a message by id.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ChatMessage> getChatMessageAsync(String chatThreadId, String chatMessageId, Context context) {
return getChatMessageWithResponseAsync(chatThreadId, chatMessageId, context)
.flatMap(
(Response<ChatMessage> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets a message by id.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a message by id.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ChatMessage getChatMessage(String chatThreadId, String chatMessageId) {
return getChatMessageAsync(chatThreadId, chatMessageId).block();
}
/**
* Gets a message by id.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a message by id.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ChatMessage getChatMessage(String chatThreadId, String chatMessageId, Context context) {
return getChatMessageAsync(chatThreadId, chatMessageId, context).block();
}
/**
* Updates a message.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @param body Details of the request to update the message.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> updateChatMessageWithResponseAsync(
String chatThreadId, String chatMessageId, UpdateChatMessageOptions body) {
return FluxUtil.withContext(
context ->
service.updateChatMessage(
this.getEndpoint(), chatThreadId, chatMessageId, this.getApiVersion(), body, context));
}
/**
* Updates a message.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @param body Details of the request to update the message.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> updateChatMessageWithResponseAsync(
String chatThreadId, String chatMessageId, UpdateChatMessageOptions body, Context context) {
return service.updateChatMessage(
this.getEndpoint(), chatThreadId, chatMessageId, this.getApiVersion(), body, context);
}
/**
* Updates a message.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @param body Details of the request to update the message.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> updateChatMessageAsync(String chatThreadId, String chatMessageId, UpdateChatMessageOptions body) {
return updateChatMessageWithResponseAsync(chatThreadId, chatMessageId, body)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Updates a message.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @param body Details of the request to update the message.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> updateChatMessageAsync(
String chatThreadId, String chatMessageId, UpdateChatMessageOptions body, Context context) {
return updateChatMessageWithResponseAsync(chatThreadId, chatMessageId, body, context)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Updates a message.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @param body Details of the request to update the message.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void updateChatMessage(String chatThreadId, String chatMessageId, UpdateChatMessageOptions body) {
updateChatMessageAsync(chatThreadId, chatMessageId, body).block();
}
/**
* Updates a message.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @param body Details of the request to update the message.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void updateChatMessage(
String chatThreadId, String chatMessageId, UpdateChatMessageOptions body, Context context) {
updateChatMessageAsync(chatThreadId, chatMessageId, body, context).block();
}
/**
* Deletes a message.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> deleteChatMessageWithResponseAsync(String chatThreadId, String chatMessageId) {
return FluxUtil.withContext(
context ->
service.deleteChatMessage(
this.getEndpoint(), chatThreadId, chatMessageId, this.getApiVersion(), context));
}
/**
* Deletes a message.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> deleteChatMessageWithResponseAsync(
String chatThreadId, String chatMessageId, Context context) {
return service.deleteChatMessage(
this.getEndpoint(), chatThreadId, chatMessageId, this.getApiVersion(), context);
}
/**
* Deletes a message.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deleteChatMessageAsync(String chatThreadId, String chatMessageId) {
return deleteChatMessageWithResponseAsync(chatThreadId, chatMessageId)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Deletes a message.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deleteChatMessageAsync(String chatThreadId, String chatMessageId, Context context) {
return deleteChatMessageWithResponseAsync(chatThreadId, chatMessageId, context)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Deletes a message.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void deleteChatMessage(String chatThreadId, String chatMessageId) {
deleteChatMessageAsync(chatThreadId, chatMessageId).block();
}
/**
* Deletes a message.
*
* @param chatThreadId The thread id to which the message was sent.
* @param chatMessageId The message id.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void deleteChatMessage(String chatThreadId, String chatMessageId, Context context) {
deleteChatMessageAsync(chatThreadId, chatMessageId, context).block();
}
/**
* Posts a typing event to a thread, on behalf of a user.
*
* @param chatThreadId Id of the thread.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> sendTypingNotificationWithResponseAsync(String chatThreadId) {
return FluxUtil.withContext(
context ->
service.sendTypingNotification(
this.getEndpoint(), chatThreadId, this.getApiVersion(), context));
}
/**
* Posts a typing event to a thread, on behalf of a user.
*
* @param chatThreadId Id of the thread.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> sendTypingNotificationWithResponseAsync(String chatThreadId, Context context) {
return service.sendTypingNotification(this.getEndpoint(), chatThreadId, this.getApiVersion(), context);
}
/**
* Posts a typing event to a thread, on behalf of a user.
*
* @param chatThreadId Id of the thread.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> sendTypingNotificationAsync(String chatThreadId) {
return sendTypingNotificationWithResponseAsync(chatThreadId).flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Posts a typing event to a thread, on behalf of a user.
*
* @param chatThreadId Id of the thread.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> sendTypingNotificationAsync(String chatThreadId, Context context) {
return sendTypingNotificationWithResponseAsync(chatThreadId, context)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Posts a typing event to a thread, on behalf of a user.
*
* @param chatThreadId Id of the thread.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void sendTypingNotification(String chatThreadId) {
sendTypingNotificationAsync(chatThreadId).block();
}
/**
* Posts a typing event to a thread, on behalf of a user.
*
* @param chatThreadId Id of the thread.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void sendTypingNotification(String chatThreadId, Context context) {
sendTypingNotificationAsync(chatThreadId, context).block();
}
/**
* Gets the members of a thread.
*
* @param chatThreadId Thread id to get members for.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the members of a thread.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<ChatThreadMember>> listChatThreadMembersSinglePageAsync(String chatThreadId) {
return FluxUtil.withContext(
context ->
service.listChatThreadMembers(
this.getEndpoint(), chatThreadId, this.getApiVersion(), context))
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Gets the members of a thread.
*
* @param chatThreadId Thread id to get members for.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the members of a thread.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<ChatThreadMember>> listChatThreadMembersSinglePageAsync(
String chatThreadId, Context context) {
return service.listChatThreadMembers(this.getEndpoint(), chatThreadId, this.getApiVersion(), context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Gets the members of a thread.
*
* @param chatThreadId Thread id to get members for.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the members of a thread.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<ChatThreadMember> listChatThreadMembersAsync(String chatThreadId) {
return new PagedFlux<>(
() -> listChatThreadMembersSinglePageAsync(chatThreadId),
nextLink -> listChatThreadMembersNextSinglePageAsync(nextLink));
}
/**
* Gets the members of a thread.
*
* @param chatThreadId Thread id to get members for.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the members of a thread.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<ChatThreadMember> listChatThreadMembersAsync(String chatThreadId, Context context) {
return new PagedFlux<>(
() -> listChatThreadMembersSinglePageAsync(chatThreadId, context),
nextLink -> listChatThreadMembersNextSinglePageAsync(nextLink, context));
}
/**
* Gets the members of a thread.
*
* @param chatThreadId Thread id to get members for.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the members of a thread.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ChatThreadMember> listChatThreadMembers(String chatThreadId) {
return new PagedIterable<>(listChatThreadMembersAsync(chatThreadId));
}
/**
* Gets the members of a thread.
*
* @param chatThreadId Thread id to get members for.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the members of a thread.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ChatThreadMember> listChatThreadMembers(String chatThreadId, Context context) {
return new PagedIterable<>(listChatThreadMembersAsync(chatThreadId, context));
}
/**
* Adds thread members to a thread. If members already exist, no change occurs.
*
* @param chatThreadId Id of the thread to add members to.
* @param body Thread members to be added to the thread.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> addChatThreadMembersWithResponseAsync(
String chatThreadId, AddChatThreadMembersOptions body) {
return FluxUtil.withContext(
context ->
service.addChatThreadMembers(
this.getEndpoint(), chatThreadId, this.getApiVersion(), body, context));
}
/**
* Adds thread members to a thread. If members already exist, no change occurs.
*
* @param chatThreadId Id of the thread to add members to.
* @param body Thread members to be added to the thread.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> addChatThreadMembersWithResponseAsync(
String chatThreadId, AddChatThreadMembersOptions body, Context context) {
return service.addChatThreadMembers(this.getEndpoint(), chatThreadId, this.getApiVersion(), body, context);
}
/**
* Adds thread members to a thread. If members already exist, no change occurs.
*
* @param chatThreadId Id of the thread to add members to.
* @param body Thread members to be added to the thread.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> addChatThreadMembersAsync(String chatThreadId, AddChatThreadMembersOptions body) {
return addChatThreadMembersWithResponseAsync(chatThreadId, body).flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Adds thread members to a thread. If members already exist, no change occurs.
*
* @param chatThreadId Id of the thread to add members to.
* @param body Thread members to be added to the thread.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> addChatThreadMembersAsync(
String chatThreadId, AddChatThreadMembersOptions body, Context context) {
return addChatThreadMembersWithResponseAsync(chatThreadId, body, context)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Adds thread members to a thread. If members already exist, no change occurs.
*
* @param chatThreadId Id of the thread to add members to.
* @param body Thread members to be added to the thread.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void addChatThreadMembers(String chatThreadId, AddChatThreadMembersOptions body) {
addChatThreadMembersAsync(chatThreadId, body).block();
}
/**
* Adds thread members to a thread. If members already exist, no change occurs.
*
* @param chatThreadId Id of the thread to add members to.
* @param body Thread members to be added to the thread.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void addChatThreadMembers(String chatThreadId, AddChatThreadMembersOptions body, Context context) {
addChatThreadMembersAsync(chatThreadId, body, context).block();
}
/**
* Remove a member from a thread.
*
* @param chatThreadId Thread id to remove the member from.
* @param chatMemberId Id of the thread member to remove from the thread.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> removeChatThreadMemberWithResponseAsync(String chatThreadId, String chatMemberId) {
return FluxUtil.withContext(
context ->
service.removeChatThreadMember(
this.getEndpoint(), chatThreadId, chatMemberId, this.getApiVersion(), context));
}
/**
* Remove a member from a thread.
*
* @param chatThreadId Thread id to remove the member from.
* @param chatMemberId Id of the thread member to remove from the thread.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> removeChatThreadMemberWithResponseAsync(
String chatThreadId, String chatMemberId, Context context) {
return service.removeChatThreadMember(
this.getEndpoint(), chatThreadId, chatMemberId, this.getApiVersion(), context);
}
/**
* Remove a member from a thread.
*
* @param chatThreadId Thread id to remove the member from.
* @param chatMemberId Id of the thread member to remove from the thread.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> removeChatThreadMemberAsync(String chatThreadId, String chatMemberId) {
return removeChatThreadMemberWithResponseAsync(chatThreadId, chatMemberId)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Remove a member from a thread.
*
* @param chatThreadId Thread id to remove the member from.
* @param chatMemberId Id of the thread member to remove from the thread.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> removeChatThreadMemberAsync(String chatThreadId, String chatMemberId, Context context) {
return removeChatThreadMemberWithResponseAsync(chatThreadId, chatMemberId, context)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Remove a member from a thread.
*
* @param chatThreadId Thread id to remove the member from.
* @param chatMemberId Id of the thread member to remove from the thread.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void removeChatThreadMember(String chatThreadId, String chatMemberId) {
removeChatThreadMemberAsync(chatThreadId, chatMemberId).block();
}
/**
* Remove a member from a thread.
*
* @param chatThreadId Thread id to remove the member from.
* @param chatMemberId Id of the thread member to remove from the thread.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void removeChatThreadMember(String chatThreadId, String chatMemberId, Context context) {
removeChatThreadMemberAsync(chatThreadId, chatMemberId, context).block();
}
/**
* Creates a chat thread.
*
* @param body Request payload for creating a chat thread.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<MultiStatusResponse>> createChatThreadWithResponseAsync(CreateChatThreadOptions body) {
return FluxUtil.withContext(
context -> service.createChatThread(this.getEndpoint(), this.getApiVersion(), body, context));
}
/**
* Creates a chat thread.
*
* @param body Request payload for creating a chat thread.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<MultiStatusResponse>> createChatThreadWithResponseAsync(
CreateChatThreadOptions body, Context context) {
return service.createChatThread(this.getEndpoint(), this.getApiVersion(), body, context);
}
/**
* Creates a chat thread.
*
* @param body Request payload for creating a chat thread.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<MultiStatusResponse> createChatThreadAsync(CreateChatThreadOptions body) {
return createChatThreadWithResponseAsync(body)
.flatMap(
(Response<MultiStatusResponse> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Creates a chat thread.
*
* @param body Request payload for creating a chat thread.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<MultiStatusResponse> createChatThreadAsync(CreateChatThreadOptions body, Context context) {
return createChatThreadWithResponseAsync(body, context)
.flatMap(
(Response<MultiStatusResponse> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Creates a chat thread.
*
* @param body Request payload for creating a chat thread.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public MultiStatusResponse createChatThread(CreateChatThreadOptions body) {
return createChatThreadAsync(body).block();
}
/**
* Creates a chat thread.
*
* @param body Request payload for creating a chat thread.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public MultiStatusResponse createChatThread(CreateChatThreadOptions body, Context context) {
return createChatThreadAsync(body, context).block();
}
/**
* Gets the list of chat threads of a user.
*
* @param maxPageSize The maximum number of chat threads returned per page.
* @param startTime The earliest point in time to get chat threads up to. The timestamp should be in ISO8601 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of chat threads of a user.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<ChatThreadInfo>> listChatThreadsSinglePageAsync(
Integer maxPageSize, OffsetDateTime startTime) {
return FluxUtil.withContext(
context ->
service.listChatThreads(
this.getEndpoint(), maxPageSize, startTime, this.getApiVersion(), context))
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Gets the list of chat threads of a user.
*
* @param maxPageSize The maximum number of chat threads returned per page.
* @param startTime The earliest point in time to get chat threads up to. The timestamp should be in ISO8601 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of chat threads of a user.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<ChatThreadInfo>> listChatThreadsSinglePageAsync(
Integer maxPageSize, OffsetDateTime startTime, Context context) {
return service.listChatThreads(this.getEndpoint(), maxPageSize, startTime, this.getApiVersion(), context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Gets the list of chat threads of a user.
*
* @param maxPageSize The maximum number of chat threads returned per page.
* @param startTime The earliest point in time to get chat threads up to. The timestamp should be in ISO8601 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of chat threads of a user.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<ChatThreadInfo> listChatThreadsAsync(Integer maxPageSize, OffsetDateTime startTime) {
return new PagedFlux<>(
() -> listChatThreadsSinglePageAsync(maxPageSize, startTime),
nextLink -> listChatThreadsNextSinglePageAsync(nextLink));
}
/**
* Gets the list of chat threads of a user.
*
* @param maxPageSize The maximum number of chat threads returned per page.
* @param startTime The earliest point in time to get chat threads up to. The timestamp should be in ISO8601 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of chat threads of a user.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<ChatThreadInfo> listChatThreadsAsync(
Integer maxPageSize, OffsetDateTime startTime, Context context) {
return new PagedFlux<>(
() -> listChatThreadsSinglePageAsync(maxPageSize, startTime, context),
nextLink -> listChatThreadsNextSinglePageAsync(nextLink, context));
}
/**
* Gets the list of chat threads of a user.
*
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of chat threads of a user.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<ChatThreadInfo> listChatThreadsAsync() {
final Integer maxPageSize = null;
final OffsetDateTime startTime = null;
final Context context = null;
return new PagedFlux<>(
() -> listChatThreadsSinglePageAsync(maxPageSize, startTime),
nextLink -> listChatThreadsNextSinglePageAsync(nextLink, context));
}
/**
* Gets the list of chat threads of a user.
*
* @param maxPageSize The maximum number of chat threads returned per page.
* @param startTime The earliest point in time to get chat threads up to. The timestamp should be in ISO8601 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of chat threads of a user.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ChatThreadInfo> listChatThreads(Integer maxPageSize, OffsetDateTime startTime) {
return new PagedIterable<>(listChatThreadsAsync(maxPageSize, startTime));
}
/**
* Gets the list of chat threads of a user.
*
* @param maxPageSize The maximum number of chat threads returned per page.
* @param startTime The earliest point in time to get chat threads up to. The timestamp should be in ISO8601 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of chat threads of a user.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ChatThreadInfo> listChatThreads(
Integer maxPageSize, OffsetDateTime startTime, Context context) {
return new PagedIterable<>(listChatThreadsAsync(maxPageSize, startTime, context));
}
/**
* Gets the list of chat threads of a user.
*
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the list of chat threads of a user.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ChatThreadInfo> listChatThreads() {
final Integer maxPageSize = null;
final OffsetDateTime startTime = null;
final Context context = null;
return new PagedIterable<>(listChatThreadsAsync(maxPageSize, startTime));
}
/**
* Updates a thread's properties.
*
* @param chatThreadId The id of the thread to update.
* @param body Request payload for updating a chat thread.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> updateChatThreadWithResponseAsync(String chatThreadId, UpdateChatThreadOptions body) {
return FluxUtil.withContext(
context ->
service.updateChatThread(
this.getEndpoint(), chatThreadId, this.getApiVersion(), body, context));
}
/**
* Updates a thread's properties.
*
* @param chatThreadId The id of the thread to update.
* @param body Request payload for updating a chat thread.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> updateChatThreadWithResponseAsync(
String chatThreadId, UpdateChatThreadOptions body, Context context) {
return service.updateChatThread(this.getEndpoint(), chatThreadId, this.getApiVersion(), body, context);
}
/**
* Updates a thread's properties.
*
* @param chatThreadId The id of the thread to update.
* @param body Request payload for updating a chat thread.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> updateChatThreadAsync(String chatThreadId, UpdateChatThreadOptions body) {
return updateChatThreadWithResponseAsync(chatThreadId, body).flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Updates a thread's properties.
*
* @param chatThreadId The id of the thread to update.
* @param body Request payload for updating a chat thread.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> updateChatThreadAsync(String chatThreadId, UpdateChatThreadOptions body, Context context) {
return updateChatThreadWithResponseAsync(chatThreadId, body, context)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Updates a thread's properties.
*
* @param chatThreadId The id of the thread to update.
* @param body Request payload for updating a chat thread.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void updateChatThread(String chatThreadId, UpdateChatThreadOptions body) {
updateChatThreadAsync(chatThreadId, body).block();
}
/**
* Updates a thread's properties.
*
* @param chatThreadId The id of the thread to update.
* @param body Request payload for updating a chat thread.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void updateChatThread(String chatThreadId, UpdateChatThreadOptions body, Context context) {
updateChatThreadAsync(chatThreadId, body, context).block();
}
/**
* Gets a chat thread.
*
* @param chatThreadId Thread id to get.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a chat thread.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<ChatThread>> getChatThreadWithResponseAsync(String chatThreadId) {
return FluxUtil.withContext(
context -> service.getChatThread(this.getEndpoint(), chatThreadId, this.getApiVersion(), context));
}
/**
* Gets a chat thread.
*
* @param chatThreadId Thread id to get.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a chat thread.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<ChatThread>> getChatThreadWithResponseAsync(String chatThreadId, Context context) {
return service.getChatThread(this.getEndpoint(), chatThreadId, this.getApiVersion(), context);
}
/**
* Gets a chat thread.
*
* @param chatThreadId Thread id to get.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a chat thread.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ChatThread> getChatThreadAsync(String chatThreadId) {
return getChatThreadWithResponseAsync(chatThreadId)
.flatMap(
(Response<ChatThread> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets a chat thread.
*
* @param chatThreadId Thread id to get.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a chat thread.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ChatThread> getChatThreadAsync(String chatThreadId, Context context) {
return getChatThreadWithResponseAsync(chatThreadId, context)
.flatMap(
(Response<ChatThread> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets a chat thread.
*
* @param chatThreadId Thread id to get.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a chat thread.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ChatThread getChatThread(String chatThreadId) {
return getChatThreadAsync(chatThreadId).block();
}
/**
* Gets a chat thread.
*
* @param chatThreadId Thread id to get.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a chat thread.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ChatThread getChatThread(String chatThreadId, Context context) {
return getChatThreadAsync(chatThreadId, context).block();
}
/**
* Deletes a thread.
*
* @param chatThreadId Thread id to delete.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> deleteChatThreadWithResponseAsync(String chatThreadId) {
return FluxUtil.withContext(
context -> service.deleteChatThread(this.getEndpoint(), chatThreadId, this.getApiVersion(), context));
}
/**
* Deletes a thread.
*
* @param chatThreadId Thread id to delete.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> deleteChatThreadWithResponseAsync(String chatThreadId, Context context) {
return service.deleteChatThread(this.getEndpoint(), chatThreadId, this.getApiVersion(), context);
}
/**
* Deletes a thread.
*
* @param chatThreadId Thread id to delete.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deleteChatThreadAsync(String chatThreadId) {
return deleteChatThreadWithResponseAsync(chatThreadId).flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Deletes a thread.
*
* @param chatThreadId Thread id to delete.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deleteChatThreadAsync(String chatThreadId, Context context) {
return deleteChatThreadWithResponseAsync(chatThreadId, context).flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Deletes a thread.
*
* @param chatThreadId Thread id to delete.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void deleteChatThread(String chatThreadId) {
deleteChatThreadAsync(chatThreadId).block();
}
/**
* Deletes a thread.
*
* @param chatThreadId Thread id to delete.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void deleteChatThread(String chatThreadId, Context context) {
deleteChatThreadAsync(chatThreadId, context).block();
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<ReadReceipt>> listChatReadReceiptsNextSinglePageAsync(String nextLink) {
return FluxUtil.withContext(context -> service.listChatReadReceiptsNext(nextLink, context))
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<ReadReceipt>> listChatReadReceiptsNextSinglePageAsync(String nextLink, Context context) {
return service.listChatReadReceiptsNext(nextLink, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return collection of chat messages for a particular chat thread.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<ChatMessage>> listChatMessagesNextSinglePageAsync(String nextLink) {
return FluxUtil.withContext(context -> service.listChatMessagesNext(nextLink, context))
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return collection of chat messages for a particular chat thread.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<ChatMessage>> listChatMessagesNextSinglePageAsync(String nextLink, Context context) {
return service.listChatMessagesNext(nextLink, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return collection of thread members belong to a particular thread.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<ChatThreadMember>> listChatThreadMembersNextSinglePageAsync(String nextLink) {
return FluxUtil.withContext(context -> service.listChatThreadMembersNext(nextLink, context))
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return collection of thread members belong to a particular thread.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<ChatThreadMember>> listChatThreadMembersNextSinglePageAsync(
String nextLink, Context context) {
return service.listChatThreadMembersNext(nextLink, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return collection of chat threads.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<ChatThreadInfo>> listChatThreadsNextSinglePageAsync(String nextLink) {
return FluxUtil.withContext(context -> service.listChatThreadsNext(nextLink, context))
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return collection of chat threads.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<ChatThreadInfo>> listChatThreadsNextSinglePageAsync(String nextLink, Context context) {
return service.listChatThreadsNext(nextLink, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
}