| 1 |
from typing import Optional |
| 2 |
from datetime import datetime |
| 3 |
from typing_extensions import Literal |
| 4 |
|
| 5 |
from ..._models import BaseModel |
| 6 |
from .message_batch_request_counts import MessageBatchRequestCounts |
| 7 |
|
| 8 |
__all__ = ["MessageBatch"] |
| 9 |
|
| 10 |
|
| 11 |
class MessageBatch(BaseModel): |
| 12 |
id: str |
| 13 |
"""Unique object identifier. |
| 14 |
|
| 15 |
The format and length of IDs may change over time. |
| 16 |
""" |
| 17 |
|
| 18 |
archived_at: Optional[datetime] = None |
| 19 |
""" |
| 20 |
RFC 3339 datetime string representing the time at which the Message Batch was |
| 21 |
archived and its results became unavailable. |
| 22 |
""" |
| 23 |
|
| 24 |
cancel_initiated_at: Optional[datetime] = None |
| 25 |
""" |
| 26 |
RFC 3339 datetime string representing the time at which cancellation was |
| 27 |
initiated for the Message Batch. Specified only if cancellation was initiated. |
| 28 |
""" |
| 29 |
|
| 30 |
created_at: datetime |
| 31 |
""" |
| 32 |
RFC 3339 datetime string representing the time at which the Message Batch was |
| 33 |
created. |
| 34 |
""" |
| 35 |
|
| 36 |
ended_at: Optional[datetime] = None |
| 37 |
""" |
| 38 |
RFC 3339 datetime string representing the time at which processing for the |
| 39 |
Message Batch ended. Specified only once processing ends. |
| 40 |
|
| 41 |
Processing ends when every request in a Message Batch has either succeeded, |
| 42 |
errored, canceled, or expired. |
| 43 |
""" |
| 44 |
|
| 45 |
expires_at: datetime |
| 46 |
""" |
| 47 |
RFC 3339 datetime string representing the time at which the Message Batch will |
| 48 |
expire and end processing, which is 24 hours after creation. |
| 49 |
""" |
| 50 |
|
| 51 |
processing_status: Literal["in_progress", "canceling", "ended"] |
| 52 |
"""Processing status of the Message Batch.""" |
| 53 |
|
| 54 |
request_counts: MessageBatchRequestCounts |
| 55 |
"""Tallies requests within the Message Batch, categorized by their status. |
| 56 |
|
| 57 |
Requests start as `processing` and move to one of the other statuses only once |
| 58 |
processing of the entire batch ends. The sum of all values always matches the |
| 59 |
total number of requests in the batch. |
| 60 |
""" |
| 61 |
|
| 62 |
results_url: Optional[str] = None |
| 63 |
"""URL to a `.jsonl` file containing the results of the Message Batch requests. |
| 64 |
|
| 65 |
Specified only once processing ends. |
| 66 |
|
| 67 |
Results in the file are not guaranteed to be in the same order as requests. Use |
| 68 |
the `custom_id` field to match results to requests. |
| 69 |
""" |
| 70 |
|
| 71 |
type: Literal["message_batch"] |
| 72 |
"""Object type. |
| 73 |
|
| 74 |
For Message Batches, this is always `"message_batch"`. |
| 75 |
""" |