=encoding utf8

=head1 NAME

OpenAPI::Client::OpenAI::Path::threads-thread_id-messages - Documentation for the /threads/{thread_id}/messages path.

=head1 OPERATIONS

=head2 GET /threads/{thread_id}/messages

=head3 listMessages

  $client->list_messages({
      body => { ... },
  });

Returns a list of messages for a given thread.

=head4 Path/query parameters

=over

=item * C<thread_id> (in path, required, string) - The ID of the L<thread|https://platform.openai.com/docs/api-reference/threads>
the messages belong to.

=item * C<limit> (in query, optional, integer) - A limit on the number of objects to be returned. Limit can range between 1 and
100, and the default is 20.

Default: 20

=item * C<order> (in query, optional, string) - Sort order by the C<created_at> timestamp of the objects. C<asc> for ascending
order and C<desc> for descending order.

Allowed values: asc, desc

Default: desc

=item * C<after> (in query, optional, string) - A cursor for use in pagination. C<after> is an object ID that defines your
place in the list. For instance, if you make a list request and receive 100
objects, ending with obj_foo, your subsequent call can include after=obj_foo
in order to fetch the next page of the list.

=item * C<before> (in query, optional, string) - A cursor for use in pagination. C<before> is an object ID that defines your
place in the list. For instance, if you make a list request and receive 100
objects, starting with obj_foo, your subsequent call can include
before=obj_foo in order to fetch the previous page of the list.

=item * C<run_id> (in query, optional, string) - Filter messages by the run ID that generated them.

=back

=head4 Responses

B<200 - OK>

Content-Type: application/json

Example:

    {
       "data" : [
          "{\n  \"id\": \"msg_abc123\",\n  \"object\": \"thread.message\",\n  \"created_at\": 1698983503,\n  \"thread_id\": \"thread_abc123\",\n  \"role\": \"assistant\",\n  \"content\": [\n    {\n      \"type\": \"text\",\n      \"text\": {\n        \"value\": \"Hi! How can I help you today?\",\n        \"annotations\": []\n      }\n    }\n  ],\n  \"assistant_id\": \"asst_abc123\",\n  \"run_id\": \"run_abc123\",\n  \"attachments\": [],\n  \"metadata\": {}\n}\n"
       ],
       "first_id" : "msg_abc123",
       "has_more" : false,
       "last_id" : "msg_abc123",
       "object" : "list"
    }

=head2 POST /threads/{thread_id}/messages

=head3 createMessage

  $client->create_message({
      body => { ... },
  });

Create a message.

=head4 Path/query parameters

=over

=item * C<thread_id> (in path, required, string) - The ID of the L<thread|https://platform.openai.com/docs/api-reference/threads>
to create a message for.

=back

=head4 Responses

B<200 - OK>

Content-Type: application/json

Example:

    {
       "assistant_id" : "asst_abc123",
       "attachments" : [],
       "content" : [
          {
             "text" : {
                "annotations" : [],
                "value" : "Hi! How can I help you today?"
             },
             "type" : "text"
          }
       ],
       "created_at" : 1698983503,
       "id" : "msg_abc123",
       "metadata" : {},
       "object" : "thread.message",
       "role" : "assistant",
       "run_id" : "run_abc123",
       "thread_id" : "thread_abc123"
    }

=head1 SCHEMAS

=head2 CreateMessageRequest

Properties:

=over

=item * C<attachments> (anyOf)

=item * C<content> (oneOf, required)

=item * C<metadata> (Metadata)

See L</Metadata> below for shape.

=item * C<role> (string, required) - The role of the entity that is creating the message. Allowed values include: -
C<user> : Indicates the message is sent by an actual user and should be used
in most cases to represent user-generated messages. - C<assistant> : Indicates
the message is generated by the assistant. Use this value to insert messages
from the assistant into the conversation.

Allowed values: user, assistant

=back

=head2 ListMessagesResponse

Properties:

=over

=item * C<data> (array of MessageObject, required)

=item * C<first_id> (string, required)

=item * C<has_more> (boolean, required)

=item * C<last_id> (string, required)

=item * C<object> (string, required)

=back

=head2 MessageObject

Properties:

=over

=item * C<assistant_id> (anyOf, required)

=item * C<attachments> (anyOf, required)

=item * C<completed_at> (anyOf, required)

=item * C<content> (array of object, required) - The content of the message in array of text and/or images.

=item * C<created_at> (integer, required) - The Unix timestamp (in seconds) for when the message was created.

=item * C<id> (string, required) - The identifier, which can be referenced in API endpoints.

=item * C<incomplete_at> (anyOf, required)

=item * C<incomplete_details> (anyOf, required)

=item * C<metadata> (Metadata, required)

See L</Metadata> below for shape.

=item * C<object> (string, required) - The object type, which is always C<thread.message> .

Allowed values: thread.message

=item * C<role> (string, required) - The entity that produced the message. One of C<user> or C<assistant> .

Allowed values: user, assistant

=item * C<run_id> (anyOf, required)

=item * C<status> (string, required) - The status of the message, which can be either C<in_progress> , C<incomplete>
, or C<completed> .

Allowed values: in_progress, incomplete, completed

=item * C<thread_id> (string, required) - The L<thread|https://platform.openai.com/docs/api-reference/threads> ID that
this message belongs to.

=back

=head2 Metadata

Set of 16 key-value pairs that can be attached to an object. This can be
useful for storing additional information about the object in a structured
format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings
with a maximum length of 512 characters.

=head1 SEE ALSO

L<OpenAPI::Client::OpenAI::Path>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2023-2026 by Nelson Ferraz

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.14.0 or,
at your option, any later version of Perl 5 you may have available.

=cut
