Skip to content

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

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 ('multimedia' or 'other').

None
order_by str | None

Sort field. Valid values: 'name', 'mimeType', 'size', 'creatorUserId', 'creationTimestamp', 'entityType'.

None
order_desc bool | None

True for descending, False for ascending (default: True).

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
class PostAttachment:
    """Narrow facade over :class:`~generated.ListPostAttachmentsElementDTOModel`.

    Attributes:
        raw: The underlying generated DTO; access additional fields via this escape hatch.
    """

    def __init__(self, raw: generated.ListPostAttachmentsElementDTOModel) -> None:
        self.raw = raw

    @property
    def id(self) -> int | None:
        return self.raw.id

    @property
    def name(self) -> str | None:
        return self.raw.name

    @property
    def content_mime_type(self) -> str | None:
        return self.raw.contentMimeType

    @property
    def size(self) -> int | None:
        return self.raw.size

    @property
    def type(self) -> int | None:
        return self.raw.type

    @property
    def downloadable(self) -> bool | None:
        return self.raw.downloadable

    @property
    def version_number(self) -> int | None:
        return self.raw.versionNumber

    @property
    def creator_user(self) -> generated.UserDTO | None:
        return self.raw.creatorUser

    @property
    def creation_timestamp(self) -> int | None:
        return self.raw.creationTimestamp

    @property
    def hashtags(self) -> list[generated.HashtagDTOModel] | None:
        return self.raw.hashtags

    @property
    def temporary_content_view_link(self) -> str | None:
        return self.raw.temporaryContentViewLink

    @property
    def temporary_content_download_link(self) -> str | None:
        return self.raw.temporaryContentDownloadLink

    @property
    def temporary_content_preview_image_link(self) -> str | None:
        return self.raw.temporaryContentPreviewImageLink

    @property
    def temporary_content_preview_image_animated_link(self) -> str | None:
        return self.raw.temporaryContentPreviewImageAnimatedLink

    @property
    def temporary_content_preview_image_hi_res_link(self) -> str | None:
        return self.raw.temporaryContentPreviewImageHiResLink

    @property
    def temporary_content_preview_image_hi_res_animated_link(self) -> str | None:
        return self.raw.temporaryContentPreviewImageHiResAnimatedLink

    @classmethod
    def from_dict(cls, data: dict) -> PostAttachment:  # type: ignore[type-arg]
        """Parse from a raw API response dict element.

        Args:
            data: A single item dict from the ``items`` list.

        Returns:
            A new :class:`PostAttachment`.
        """
        raw = generated.ListPostAttachmentsElementDTOModel.model_validate(data)
        return cls(raw)

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 items list.

required

Returns:

Type Description
PostAttachment

A new :class:PostAttachment.

Source code in src/pynteracta/models/facade/attachments.py
@classmethod
def from_dict(cls, data: dict) -> PostAttachment:  # type: ignore[type-arg]
    """Parse from a raw API response dict element.

    Args:
        data: A single item dict from the ``items`` list.

    Returns:
        A new :class:`PostAttachment`.
    """
    raw = generated.ListPostAttachmentsElementDTOModel.model_validate(data)
    return cls(raw)

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
class 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:
        raw: The underlying generated DTO; access additional fields via this escape hatch.
    """

    def __init__(self, raw: generated.ListPostAttachmentsResponseDTO) -> None:
        self.raw = raw

    @property
    def next_page_token(self) -> str | None:
        return self.raw.nextPageToken

    @property
    def total_items_count(self) -> int | None:
        return self.raw.totalItemsCount

    @property
    def can_add_attachment(self) -> bool | None:
        return self.raw.canAddAttachment

    @property
    def image_attachments_count(self) -> int | None:
        return self.raw.imageAttachmentsCount

    @property
    def video_attachments_count(self) -> int | None:
        return self.raw.videoAttachmentsCount

    @property
    def audio_attachments_count(self) -> int | None:
        return self.raw.audioAttachmentsCount

    @property
    def documents_attachments_count(self) -> int | None:
        return self.raw.documentsAttachmentsCount

    @property
    def items_typed(self) -> list[PostAttachment]:
        """Re-validate each opaque list item into :class:`PostAttachment`.

        Returns:
            List of :class:`PostAttachment` instances.
        """
        if not self.raw.items:
            return []
        result = []
        for item in self.raw.items:
            root = item.root if hasattr(item, "root") else item
            if isinstance(root, dict):
                result.append(
                    PostAttachment(
                        generated.ListPostAttachmentsElementDTOModel.model_validate(root)
                    )
                )
        return result

    @classmethod
    def from_dict(cls, data: dict) -> PostAttachmentList:  # type: ignore[type-arg]
        """Parse from a raw API response dict.

        Args:
            data: Parsed JSON response body.

        Returns:
            A new :class:`PostAttachmentList`.
        """
        raw = generated.ListPostAttachmentsResponseDTO.model_validate(data)
        return cls(raw)

items_typed property

Re-validate each opaque list item into :class:PostAttachment.

Returns:

Type Description
list[PostAttachment]

List of :class:PostAttachment instances.

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:PostAttachmentList.

Source code in src/pynteracta/models/facade/attachments.py
@classmethod
def from_dict(cls, data: dict) -> PostAttachmentList:  # type: ignore[type-arg]
    """Parse from a raw API response dict.

    Args:
        data: Parsed JSON response body.

    Returns:
        A new :class:`PostAttachmentList`.
    """
    raw = generated.ListPostAttachmentsResponseDTO.model_validate(data)
    return cls(raw)

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
class 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:
        raw: The underlying generated DTO; access additional fields via this escape hatch.
    """

    def __init__(self, raw: generated.GetPostAttachmentDetailResponseDTO) -> None:
        self.raw = raw
        self._attachment_data: generated.PostAttachmentDataDTO1 | None = None
        if raw.attachmentData is not None:
            ad = raw.attachmentData
            root = ad.root if hasattr(ad, "root") else ad
            if isinstance(root, dict):
                self._attachment_data = generated.PostAttachmentDataDTO1.model_validate(root)
        self._post: generated.PostBaseInfoDTO1 | None = None
        if raw.post is not None:
            pr = raw.post
            proot = pr.root if hasattr(pr, "root") else pr
            if isinstance(proot, dict):
                self._post = generated.PostBaseInfoDTO1.model_validate(proot)

    @property
    def attachment_data(self) -> generated.PostAttachmentDataDTO1 | None:
        """Typed attachment data DTO."""
        return self._attachment_data

    @property
    def post(self) -> generated.PostBaseInfoDTO1 | None:
        """Parent post base info (typed variant of the RootModel stub)."""
        return self._post

    @property
    def id(self) -> int | None:
        return self._attachment_data.id if self._attachment_data else None

    @property
    def name(self) -> str | None:
        return self._attachment_data.name if self._attachment_data else None

    @property
    def content_mime_type(self) -> str | None:
        return self._attachment_data.contentMimeType if self._attachment_data else None

    @property
    def size(self) -> int | None:
        return self._attachment_data.size if self._attachment_data else None

    @property
    def type(self) -> int | None:
        return self._attachment_data.type if self._attachment_data else None

    @property
    def downloadable(self) -> bool | None:
        return self._attachment_data.downloadable if self._attachment_data else None

    @property
    def temporary_content_view_link(self) -> str | None:
        return self._attachment_data.temporaryContentViewLink if self._attachment_data else None

    @property
    def temporary_content_download_link(self) -> str | None:
        return self._attachment_data.temporaryContentDownloadLink if self._attachment_data else None

    @classmethod
    def from_dict(cls, data: dict) -> AttachmentDetail:  # type: ignore[type-arg]
        """Parse from a raw API response dict.

        Args:
            data: Parsed JSON response body.

        Returns:
            A new :class:`AttachmentDetail`.
        """
        raw = generated.GetPostAttachmentDetailResponseDTO.model_validate(data)
        return cls(raw)

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:AttachmentDetail.

Source code in src/pynteracta/models/facade/attachments.py
@classmethod
def from_dict(cls, data: dict) -> AttachmentDetail:  # type: ignore[type-arg]
    """Parse from a raw API response dict.

    Args:
        data: Parsed JSON response body.

    Returns:
        A new :class:`AttachmentDetail`.
    """
    raw = generated.GetPostAttachmentDetailResponseDTO.model_validate(data)
    return cls(raw)

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
class 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:
        raw: The underlying generated DTO; access additional fields via this escape hatch.
    """

    def __init__(self, raw: generated.CheckVisibilityResponseDTO) -> None:
        self.raw = raw

    @property
    def ids(self) -> list[int]:
        """List of visible attachment IDs."""
        return self.raw.ids or []

    @classmethod
    def from_dict(cls, data: dict) -> AttachmentVisibility:  # type: ignore[type-arg]
        """Parse from a raw API response dict.

        Args:
            data: Parsed JSON response body.

        Returns:
            A new :class:`AttachmentVisibility`.
        """
        raw = generated.CheckVisibilityResponseDTO.model_validate(data)
        return cls(raw)

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:AttachmentVisibility.

Source code in src/pynteracta/models/facade/attachments.py
@classmethod
def from_dict(cls, data: dict) -> AttachmentVisibility:  # type: ignore[type-arg]
    """Parse from a raw API response dict.

    Args:
        data: Parsed JSON response body.

    Returns:
        A new :class:`AttachmentVisibility`.
    """
    raw = generated.CheckVisibilityResponseDTO.model_validate(data)
    return cls(raw)