ChatResource
Person-to-person chat between patients and their care team under /v1/chat.
- Stable unknown
- Release candidate not available
- Development since 0.2.0-dev.33+8af64df
public final class ChatResourcePerson-to-person chat between patients and their care team under /v1/chat. Get it from Ovok.chat().
Methods
threads
public ChatResource.Threads threads()Returns the signed-in person's threads.
Returns: the thread routes
messages
public ChatResource.Messages messages()Returns the messages in a thread.
Returns: the message routes
attachments
public ChatResource.Attachments attachments()Returns the files to send in threads.
Returns: the attachment routes
read
public void read(
String threadId,
Object request,
RequestOptions options) throws IOException, InterruptedExceptionMarks a thread read by the signed-in person, now or at readAt (POST /v1/chat/threads/{threadId}/read).
Parameters:
threadId: the thread idrequest: the optionalreadAttime;nullmarks it read nowoptions: per-request options, such as the timeout
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
ChatResource.Threads
public static final class ThreadsThe signed-in person's chat threads.
Threads.open
public JsonNode open(
Object request,
RequestOptions options) throws IOException, InterruptedExceptionOpens a thread about a patient, or answers the one these participants already have; every participant must be allowed to read the patient (POST /v1/chat/threads).
Parameters:
request: thepatient,participantsand optionaltitleoptions: per-request options, such as the timeout
Returns: the thread
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
Threads.list
public Page<JsonNode> list(
Map<String, ?> params,
RequestOptions options) throws IOException, InterruptedExceptionLists the signed-in person's threads, newest message first (GET /v1/chat/threads).
Parameters:
params: optionalpatient,updatedSinceandlimitoptions: per-request options, such as the timeout
Returns: the first page; iterating it loads the next pages
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
Threads.retrieve
public JsonNode retrieve(
String threadId,
RequestOptions options) throws IOException, InterruptedExceptionReads one thread (GET /v1/chat/threads/{threadId}).
Parameters:
threadId: the thread idoptions: per-request options, such as the timeout
Returns: the thread
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
ChatResource.Messages
public static final class MessagesMessages in a chat thread.
Messages.list
public Page<JsonNode> list(
String threadId,
Map<String, ?> params,
RequestOptions options) throws IOException, InterruptedExceptionLists a thread's messages, newest first; later pages go further back (GET /v1/chat/threads/{threadId}/messages).
Parameters:
threadId: the thread idparams: optionalsinceandlimitoptions: per-request options, such as the timeout
Returns: the first page; iterating it loads the next pages
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
Messages.send
public JsonNode send(
String threadId,
Map<String, ?> message,
RequestOptions options) throws IOException, InterruptedExceptionSends a message, with any of the signed-in person's own uploads (POST /v1/chat/threads/{threadId}/messages). It carries a client id the server remembers, so a retried send is stored once.
Parameters:
threadId: the thread idmessage: thetext, optionalattachments(upload ids),replyToandclientId; a missingclientIdis generatedoptions: per-request options, such as the timeout
Returns: the message
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
Messages.attachmentLink
public JsonNode attachmentLink(
String threadId,
String messageId,
String attachmentId,
RequestOptions options) throws IOException, InterruptedExceptionReturns a link that downloads a file sent with a message, for the next hour (GET /v1/chat/threads/{threadId}/messages/{messageId}/attachments/{attachmentId}).
Parameters:
threadId: the thread idmessageId: the message idattachmentId: the attachment idoptions: per-request options, such as the timeout
Returns: the url and expiresAt
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
ChatResource.Attachments
public static final class AttachmentsFiles the signed-in person uploads to send in their chat threads.
Attachments.upload
public JsonNode upload(
byte[] file,
String fileName,
String contentType,
RequestOptions options) throws IOException, InterruptedExceptionUploads a PDF, PNG, JPEG or WebP of up to 10 MB, kept private (POST /v1/chat/attachments), then stores the file where the server says. Send it with messages().send(threadId, Map.of("text", text, "attachments", List.of(attachmentId)), options), in as many threads as you like.
Parameters:
file: the file's bytesfileName: the file namecontentType:application/pdf,image/png,image/jpegorimage/webpoptions: per-request options, such as the timeout
Returns: the attachment's id, title and contentType
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the responseOvokServiceException: if the store refuses the file, for example because it is larger than 10 MB
Attachments.link
public JsonNode link(
String attachmentId,
RequestOptions options) throws IOException, InterruptedExceptionReturns a link that downloads one of the signed-in person's own uploads for the next hour (GET /v1/chat/attachments/{attachmentId}).
Parameters:
attachmentId: the attachment idoptions: per-request options, such as the timeout
Returns: the url and expiresAt
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
Last updated on