1.0.10 • Published 2 months ago

rock.so-sdk v1.0.10

Weekly downloads
-
License
ISC
Repository
github
Last release
2 months ago

ROCK.SO API SDK

BASIC USAGE

import { RockAPi } from 'rock.so-sdk'

const rockApi = new RockApi(process.env.ROCK_BOT_TOKEN)

rockApi.sendMessage('Hello!')

This SDK is highly typed, with all methods from Rock.so Public Api being mapped and exported!

METHODS

All methods available on Rock.so Public Api are available on the SDK, i.e.:

MethodDescription
sendMessageThe sendMessage method allows you to send a new message.
createNoteCreate note.
createTaskCreate a new task.
getBotInfoAllows you to retrieve basic information about the public API bot.
getCustomFieldsAllows you to retrieve information about custom fields defined for the tasks in bot’s space.
getTaskListsAllows you to retrieve information about tasks lists defined in the bot’s space.
listLabelsThe listLabels method can be used to retrieve the list of labels assigned to tasks. Note that labels are created and deleted "on the fly"; when there are no more tasks with a given label (either the label was removed from all tasks, or all tasks with the label were deleted), that label is deleted.
listSpaceMembersThe listSpaceMembers method can be used to retrieve a list of space members, including both people and bots.
listSprintsThe listSprints method can be used to retrieve a list of sprints defined in the space.

USING ALL METHODS

Send Message

await rockApi.sendMessage('Hello')

Create note

await rockApi.createNote({
  body: [{ text: "hello world" }],
  labels: ["label"], //Optional
  watchersIds: ["abcd123"], //Optional
});

Create a task

import { ListIdStatusEnum, PriorityEnum } from "rock.so-sdk";

await rockApi.createTask({
  body: [{ text: "hello world" }],
  listId: ListIdStatusEnum.TO_DO,
  priority: PriorityEnum.HIGH,
  title: "hello world",
  start: 123456789, //Optional
  due: 123456789, //Optional
  owners: ["abcd123"], //Optional
  checkList: ["abcd123"], //Optional
  severity: 1, //Optional
  sprint: 1, //Optional
  customFields: ["abcd123"], //Optional
  labels: ["abcd123"], //Optional
  recurringSchedule: { //Optional
    dayOfMonth: 1,
    daysOfWeek: {
      monday: true,
      tuesday: true,
      wednesday: true,
      thursday: true,
      friday: true,
      saturday: true,
      sunday: true,
    },
    targetListId: "abcd123",
    type: 1,
    workdaysOnly: true,
  },
  watchersIds: ["abcd123"], //Optional,
});

Get Bot Info

const { data } = await rockApi.getBotInfo();

Get Custom Fields

const { data } = await rockApi.getCustomFields();

Get Task Lists

const { data } = await rockApi.getTaskLists();

List Labels

const { data } = await rockApi.listLabels();

List Space Members

const { data } = await rockApi.listSpaceMembers();

List Sprints

const { data } = await rockApi.listSprints();
1.0.10

2 months ago

1.0.9

2 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago