import { PostRepository, PollRepository } from '@amityco/ts-sdk'; async function createPollPost(): Promise { // Setup your poll params const newPoll = { answerType: 'single' as Amity.PollAnswerType, answers: [ { dataType: 'text', data: 'answer1' }, { dataType: 'text', data: 'answer2' }, ] as Pick [], question: 'question', }; // Create a poll from poll params const { data: poll } = await PollRepository.createPoll(newPoll); // Ceate a poll post on the user's feed. const newPollPost = { targetType: 'user', targetId: 'userId1', data: { text: 'question', pollId: poll.pollId }, }; const { data: post } = await PostRepository.createPost(newPollPost); return post; }