Attachments API¶
The AttachmentsAPI client exposes three read endpoints added in v0.3.0.
Resource grouping¶
All three endpoints are grouped under client.attachments regardless of their URL prefix.
In particular, get() calls communication/posts/data/attachment-detail-by-id/{id} — a
posts/data/ URL — but logically belongs to the attachments resource group (D-v0.3-1).
Usage¶
from pynteracta.client import InteractaClient
with InteractaClient(base_url="https://tenant.example.com", credentials=...) as client:
# List all attachments for a post (first page)
page = client.attachments.list_for_post(21269)
for att in page.items_typed:
print(att.id, att.name, att.content_mime_type)
# Iterate all pages lazily
for att in client.attachments.iterate_for_post(21269, page_size=20):
print(att.id, att.name)
# Fetch a single attachment with parent-post info
detail = client.attachments.get(3001)
print(detail.name, detail.post.id if detail.post else None)
# Check which attachment IDs are visible
visibility = client.attachments.check_visibility([3001, 3002, 3099])
print(visibility.ids) # only visible IDs
Temporary content links¶
PostAttachment and AttachmentDetail expose temporaryContent*Link properties
(temporary_content_view_link, temporary_content_download_link, etc.). These are
short-lived signed URLs returned by the API; they are not shown in the default CLI table
(D-v0.3-3a) but are accessible via --full, --fields, or --export in the CLI and
directly on the facade object in Python.
Filter surface for list_for_post¶
Curated explicit kwargs: types, entity_types, mime_types, mime_type_category,
order_by, order_desc.
Valid order_by values: 'name', 'mimeType', 'size', 'creatorUserId',
'creationTimestamp', 'entityType'.
Niche filters (aiSupportedFilter, postFilePickerFieldId, wfScreenFilePickerFieldId,
language) are reachable only via the list_for_post_raw(req) escape hatch.
API Reference¶
pynteracta.api.attachments.AttachmentsAPI
¶
Bases: ResourceClient
Client for attachment listing, detail, and visibility endpoints.
list_for_post(post_id, *, page_token=None, page_size=None, types=None, entity_types=None, mime_types=None, mime_type_category=None, order_by=None, order_desc=None)
¶
POST /communication/attachments/data/posts/{postId}/attachments-list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
post_id
|
int
|
The post whose attachments to list. |
required |
page_token
|
str | None
|
Pagination cursor from a previous response. |
None
|
page_size
|
int | None
|
Maximum items per page. |
None
|
types
|
list[int] | None
|
Filter by attachment type (1=STORAGE, 2=DRIVE). |
None
|
entity_types
|
list[int] | None
|
Filter by entity type (1=POST, 2=TASK, 3=COMMENT, 4=POST_FILE_PICKER, 5=SCREEN_FILE_PICKER). |
None
|
mime_types
|
list[str] | None
|
Filter by MIME type strings. |
None
|
mime_type_category
|
str | None
|
Filter by MIME category ( |
None
|
order_by
|
str | None
|
Sort field. Valid values: |
None
|
order_desc
|
bool | None
|
|
None
|
list_for_post_raw(post_id, req)
¶
POST attachment list with a pre-built request DTO (escape hatch).
iterate_for_post(post_id, *, page_size=None, types=None, entity_types=None, mime_types=None, mime_type_category=None, order_by=None, order_desc=None)
¶
Lazy iterator over all pages of :meth:list_for_post.
get(attachment_id)
¶
GET /communication/posts/data/attachment-detail-by-id/{attachmentId}.
Note: this endpoint lives under the posts/data/ URL prefix but belongs to the
attachments resource group (D-v0.3-1).
check_visibility(attachment_ids)
¶
POST /communication/attachments/data/check-visibility.
check_visibility_raw(req)
¶
POST check-visibility with a pre-built request DTO (escape hatch).
Facade Reference¶
pynteracta.models.facade.attachments.PostAttachment
¶
Narrow facade over :class:~generated.ListPostAttachmentsElementDTOModel.
Attributes:
| Name | Type | Description |
|---|---|---|
raw |
The underlying generated DTO; access additional fields via this escape hatch. |
Source code in src/pynteracta/models/facade/attachments.py
from_dict(data)
classmethod
¶
Parse from a raw API response dict element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
A single item dict from the |
required |
Returns:
| Type | Description |
|---|---|
PostAttachment
|
A new :class: |
Source code in src/pynteracta/models/facade/attachments.py
pynteracta.models.facade.attachments.PostAttachmentList
¶
Narrow facade over :class:~generated.ListPostAttachmentsResponseDTO.
The items list holds :class:~generated.ListPostAttachmentsElementDTO objects, which are
generated as RootModel[Any] stubs. Call :meth:items_typed to re-validate each item
against the fully-typed :class:~generated.ListPostAttachmentsElementDTOModel.
Attributes:
| Name | Type | Description |
|---|---|---|
raw |
The underlying generated DTO; access additional fields via this escape hatch. |
Source code in src/pynteracta/models/facade/attachments.py
items_typed
property
¶
Re-validate each opaque list item into :class:PostAttachment.
Returns:
| Type | Description |
|---|---|
list[PostAttachment]
|
List of :class: |
from_dict(data)
classmethod
¶
Parse from a raw API response dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
Parsed JSON response body. |
required |
Returns:
| Type | Description |
|---|---|
PostAttachmentList
|
A new :class: |
Source code in src/pynteracta/models/facade/attachments.py
pynteracta.models.facade.attachments.AttachmentDetail
¶
Narrow facade over :class:~generated.GetPostAttachmentDetailResponseDTO.
attachmentData is typed as PostAttachmentDataDTO (a RootModel[Any] stub) in the
generated code; we re-validate it against the typed sibling
:class:~generated.PostAttachmentDataDTO1.
Attributes:
| Name | Type | Description |
|---|---|---|
raw |
The underlying generated DTO; access additional fields via this escape hatch. |
Source code in src/pynteracta/models/facade/attachments.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | |
attachment_data
property
¶
Typed attachment data DTO.
post
property
¶
Parent post base info (typed variant of the RootModel stub).
from_dict(data)
classmethod
¶
Parse from a raw API response dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
Parsed JSON response body. |
required |
Returns:
| Type | Description |
|---|---|
AttachmentDetail
|
A new :class: |
Source code in src/pynteracta/models/facade/attachments.py
pynteracta.models.facade.attachments.AttachmentVisibility
¶
Thin facade over :class:~generated.CheckVisibilityResponseDTO.
Returns which attachment IDs are visible to the current user.
Kept separate from the v0.2 :class:~pynteracta.models.facade.posts.VisibilityResult.
Attributes:
| Name | Type | Description |
|---|---|---|
raw |
The underlying generated DTO; access additional fields via this escape hatch. |
Source code in src/pynteracta/models/facade/attachments.py
ids
property
¶
List of visible attachment IDs.
from_dict(data)
classmethod
¶
Parse from a raw API response dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
Parsed JSON response body. |
required |
Returns:
| Type | Description |
|---|---|
AttachmentVisibility
|
A new :class: |