rename()

rename(id: EntryIdType, newName: string): Promise<PollWithOptions>

Rename a poll.

Parameters:

  • id (EntryIdType): The ID of the poll to be renamed.

  • newName (string): The new name for the poll.

Returns:

  • A Promise resolving to the updated poll object (PollWithOptions), including information such as the poll ID, updated name, creation date, associated poll type, and options.

Example:

const pollIdToRename = 1;
const newPollName = 'Updated Poll Name';

try {
  const renamedPoll = await pollz.polls.rename(pollIdToRename, newPollName);
  console.log('Poll Renamed:', renamedPoll);
} catch (error) {
  console.error('Failed to rename poll:', error.message);
}

The rename method allows you to change the name of a specific poll identified by its unique ID (id). Provide the new name for the poll using the newName parameter.

The method returns a Promise resolving to the updated poll object (PollWithOptions), which includes details such as the poll ID, updated name, creation date, associated poll type, and the list of options.

Note: Ensure that the provided id corresponds to an existing poll in the system.

Last updated