Skip to content

Transcripts

Meeting transcripts made by Affinity's AI Notetaker (V2).

Only transcripts the API key's user is allowed to see are returned. Transcript content is meeting dialogue: handle it like the meeting itself.

Source code in affinity/services/transcripts.py
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
class TranscriptService:
    """Meeting transcripts made by Affinity's AI Notetaker (V2).

    Only transcripts the API key's user is allowed to see are returned. Transcript content is
    meeting dialogue: handle it like the meeting itself.
    """

    def __init__(self, client: HTTPClient):
        self._client = client

    def list(
        self,
        *,
        created_after: datetime | None = None,
        created_before: datetime | None = None,
        limit: int | None = None,
        total_count: bool = False,
        cursor: str | None = None,
    ) -> PaginatedResponse[Transcript]:
        """One page of transcripts, metadata only (no fragments).

        ``created_after`` is inclusive and ``created_before`` exclusive, rounded outward to
        whole seconds. ``limit`` is 1-100 (API default 20). ``total_count=True`` asks for the
        number of matching transcripts (``page.total_count``). ``cursor`` (a previous page's
        ``next_cursor``) can't be combined with other arguments.
        """
        _check_cursor_alone(cursor, created_after, created_before, limit, total_count)
        if cursor is not None:
            return _transcript_page(self._client.get_url(cursor))
        params = _list_params(
            created_after=created_after,
            created_before=created_before,
            limit=limit,
            total_count=total_count,
        )
        return _transcript_page(self._client.get("/transcripts", params=params or None))

    def iter(
        self,
        *,
        created_after: datetime | None = None,
        created_before: datetime | None = None,
        limit: int | None = None,
    ) -> Iterator[Transcript]:
        """Iterate all transcripts (every page; ``limit`` is the page size)."""

        def fetch_page(next_url: str | None) -> PaginatedResponse[Transcript]:
            if next_url:
                return self.list(cursor=next_url)
            return self.list(
                created_after=created_after, created_before=created_before, limit=limit
            )

        return PageIterator(fetch_page)

    def get(self, transcript_id: int) -> Transcript:
        """One transcript with its note and a preview of its first fragments."""
        return Transcript.model_validate(self._client.get(f"/transcripts/{int(transcript_id)}"))

    def fragments(
        self,
        transcript_id: int,
        *,
        limit: int | None = None,
        total_count: bool = False,
        cursor: str | None = None,
    ) -> PaginatedResponse[TranscriptFragment]:
        """One page of a transcript's dialogue fragments, in order."""
        _check_cursor_alone(cursor, limit, total_count)
        if cursor is not None:
            return _fragment_page(self._client.get_url(cursor))
        params = _fragment_params(limit, total_count)
        return _fragment_page(
            self._client.get(f"/transcripts/{int(transcript_id)}/fragments", params=params or None)
        )

    def iter_fragments(
        self, transcript_id: int, *, limit: int | None = None
    ) -> Iterator[TranscriptFragment]:
        """Iterate all of a transcript's fragments (every page)."""

        def fetch_page(next_url: str | None) -> PaginatedResponse[TranscriptFragment]:
            if next_url:
                return self.fragments(transcript_id, cursor=next_url)
            return self.fragments(transcript_id, limit=limit)

        return PageIterator(fetch_page)

fragments(transcript_id: int, *, limit: int | None = None, total_count: bool = False, cursor: str | None = None) -> PaginatedResponse[TranscriptFragment]

One page of a transcript's dialogue fragments, in order.

Source code in affinity/services/transcripts.py
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
def fragments(
    self,
    transcript_id: int,
    *,
    limit: int | None = None,
    total_count: bool = False,
    cursor: str | None = None,
) -> PaginatedResponse[TranscriptFragment]:
    """One page of a transcript's dialogue fragments, in order."""
    _check_cursor_alone(cursor, limit, total_count)
    if cursor is not None:
        return _fragment_page(self._client.get_url(cursor))
    params = _fragment_params(limit, total_count)
    return _fragment_page(
        self._client.get(f"/transcripts/{int(transcript_id)}/fragments", params=params or None)
    )

get(transcript_id: int) -> Transcript

One transcript with its note and a preview of its first fragments.

Source code in affinity/services/transcripts.py
133
134
135
def get(self, transcript_id: int) -> Transcript:
    """One transcript with its note and a preview of its first fragments."""
    return Transcript.model_validate(self._client.get(f"/transcripts/{int(transcript_id)}"))

iter(*, created_after: datetime | None = None, created_before: datetime | None = None, limit: int | None = None) -> Iterator[Transcript]

Iterate all transcripts (every page; limit is the page size).

Source code in affinity/services/transcripts.py
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
def iter(
    self,
    *,
    created_after: datetime | None = None,
    created_before: datetime | None = None,
    limit: int | None = None,
) -> Iterator[Transcript]:
    """Iterate all transcripts (every page; ``limit`` is the page size)."""

    def fetch_page(next_url: str | None) -> PaginatedResponse[Transcript]:
        if next_url:
            return self.list(cursor=next_url)
        return self.list(
            created_after=created_after, created_before=created_before, limit=limit
        )

    return PageIterator(fetch_page)

iter_fragments(transcript_id: int, *, limit: int | None = None) -> Iterator[TranscriptFragment]

Iterate all of a transcript's fragments (every page).

Source code in affinity/services/transcripts.py
154
155
156
157
158
159
160
161
162
163
164
def iter_fragments(
    self, transcript_id: int, *, limit: int | None = None
) -> Iterator[TranscriptFragment]:
    """Iterate all of a transcript's fragments (every page)."""

    def fetch_page(next_url: str | None) -> PaginatedResponse[TranscriptFragment]:
        if next_url:
            return self.fragments(transcript_id, cursor=next_url)
        return self.fragments(transcript_id, limit=limit)

    return PageIterator(fetch_page)

list(*, created_after: datetime | None = None, created_before: datetime | None = None, limit: int | None = None, total_count: bool = False, cursor: str | None = None) -> PaginatedResponse[Transcript]

One page of transcripts, metadata only (no fragments).

created_after is inclusive and created_before exclusive, rounded outward to whole seconds. limit is 1-100 (API default 20). total_count=True asks for the number of matching transcripts (page.total_count). cursor (a previous page's next_cursor) can't be combined with other arguments.

Source code in affinity/services/transcripts.py
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
def list(
    self,
    *,
    created_after: datetime | None = None,
    created_before: datetime | None = None,
    limit: int | None = None,
    total_count: bool = False,
    cursor: str | None = None,
) -> PaginatedResponse[Transcript]:
    """One page of transcripts, metadata only (no fragments).

    ``created_after`` is inclusive and ``created_before`` exclusive, rounded outward to
    whole seconds. ``limit`` is 1-100 (API default 20). ``total_count=True`` asks for the
    number of matching transcripts (``page.total_count``). ``cursor`` (a previous page's
    ``next_cursor``) can't be combined with other arguments.
    """
    _check_cursor_alone(cursor, created_after, created_before, limit, total_count)
    if cursor is not None:
        return _transcript_page(self._client.get_url(cursor))
    params = _list_params(
        created_after=created_after,
        created_before=created_before,
        limit=limit,
        total_count=total_count,
    )
    return _transcript_page(self._client.get("/transcripts", params=params or None))