Optional calls
Assign Textsegments to Agenda Item
Assign Textsegments to Agenda Item
Use the assignTextsegmentsToAgendaItem mutation to reassign a block of transcript segments to a (typically empty) agenda item.
You pass the agenda item you want to fill and the ID of the segment that should become its first segment. The mutation then walks forward from that boundary and pulls in all consecutive segments from the same source:
- If the boundary segment currently belongs to another agenda item, all segments from that point to the end of that item are moved over.
- If the boundary segment is currently unassigned, all consecutive unassigned segments are moved over — stopping as soon as a segment already owned by another item is encountered.
The boundary segment must belong to the same protocol as the target agenda item.
GraphQL Mutation
fragment moveAgendaItemDetails on MoveAgendaItemResultItemType {
id
title
textsegments {
id
pos
speakerObj {
slug
givenName
familyName
gender
party
preTitle
postTitle
posShort
posLong
specialCase
}
textJson {
text
startTime
endTime
}
}
}
mutation AssignTextsegmentsToAgendaItem(
$agendaItemId: Int!
$firstTextsegmentId: Int!
) {
assignTextsegmentsToAgendaItem(
agendaItemId: $agendaItemId
firstTextsegmentId: $firstTextsegmentId
) {
success
agendaItemList {
...moveAgendaItemDetails
}
}
}
Mutation Variables
{
"agendaItemId": 42,
"firstTextsegmentId": 187
}
agendaItemId(Int, required) — ID of the agenda item to assign segments to. Typically an empty item returned bygetResultsWithEmpty.firstTextsegmentId(Int, required) — ID of the segment that becomes the first segment of the target item. All eligible consecutive segments from this point are reassigned automatically.
Example JavaScript Implementation
import axios from "axios";
const ASSIGN_TEXTSEGMENTS_TO_AGENDA_ITEM = `
fragment moveAgendaItemDetails on MoveAgendaItemResultItemType {
id
title
textsegments {
id
pos
speakerObj {
slug
givenName
familyName
}
textJson {
text
startTime
endTime
}
}
}
mutation AssignTextsegmentsToAgendaItem(
$agendaItemId: Int!
$firstTextsegmentId: Int!
) {
assignTextsegmentsToAgendaItem(
agendaItemId: $agendaItemId
firstTextsegmentId: $firstTextsegmentId
) {
success
agendaItemList {
...moveAgendaItemDetails
}
}
}
`;
export async function assignTextsegmentsToAgendaItem(agendaItemId, firstTextsegmentId) {
const res = await axios.post(
"https://api-v2.speechmind.com/external/v2/graphql",
{
query: ASSIGN_TEXTSEGMENTS_TO_AGENDA_ITEM,
variables: { agendaItemId, firstTextsegmentId },
},
{
headers: {
"Content-Type": "application/json",
"x-api-key": process.env.SPEECHMIND_API_KEY,
},
}
);
const { success, agendaItemList } = res.data.data.assignTextsegmentsToAgendaItem;
return { success, agendaItemList };
}
// Example usage
assignTextsegmentsToAgendaItem(42, 187);
Notes
- The returned
agendaItemListis of typeMoveAgendaItemResultItemType— it containsid,title, andtextsegments, not the AI-generatedtextList/textsfields. To retrieve the full content after reassignment, callgetResultsorgetResultsWithEmpty. - Use
getResultsWithEmptyto discover empty agenda items andgetTextsegmentsByProtocolAndPageto find the right boundary segment ID before calling this mutation. - Only segments that are consecutive and from the same source are moved. The walk stops at the first segment already belonging to a different agenda item.
Have questions?
Still have questions? Talk to support.