Skip to content

v0.3.0

Latest
Compare
Choose a tag to compare
@kaustavdm kaustavdm released this 21 Dec 08:07
eff8997

Breaking change

With v0.3.0, all API SDK methods return results wrapped in a Response object Promise<Response<T>>. The Response object has the following properties.

  • Method:
    • .json(): Call the .json() method on the response to access the response body as model objects
  • Properties:
    • .headers: Use the headers property to access response headers as an object
    • .statusCode: Numeric response status code
    • .body: Access the raw response body

Usage example:

v0.2.0:

// `employees` is an Array of `Freshteam.models.Employee`
const employees = await ft.employees.list();
// No further way to access response headers

v0.3.0:

const res = await ft.employees.list();
const { headers, statusCode } = res;
const employees = res.json();

Introducing Freshservice Tickets endpoints

With this release, the API SDK supports the Tickets API endpoints for Freshservice, thanks to the efforts by @thakurganeshsinghfw.

Usage example:

// Setup
const { Freshservice } = require("@freshworks/api-sdk");
const fs = new Freshservice(domain, apiKey);

// Get list of tickets
const res = await fs.tickets.list();
const tickets = res.json();

New methods added

  • fs.tickets.list(query) - List and search tickets
  • fs.tickets.get(id, opts) - Get ticket by ID, with additional options to include details
  • fs.tickets.create(ticket) - Create a new ticket
  • fs.tickets.update(id, ticket) - Update an existing ticket
  • fs.tickets.delete(id) - Delete ticket by id
  • fs.tickets.restore(id) - Restore ticket by ID
  • fs.tickets.createChildTicket(parentId, childTicket) - Create a child ticket for a given parent ticket
  • fs.tickets.timeEntry(ticketId, timeEntryId)- Get a time entry by ID for a given ticket
  • fs.tickets.timeEntries(ticketId, opts) - Get all time entries for a ticket
  • fs.tickets.createTimeEntry(ticketId, timeEntry) - Create a time entry for a ticket
  • fs.tickets.updateTimeEntry(ticketId, timeEntryId, timeEntry) - Update an existing time entry for a ticket
  • fs.tickets.deleteTimeEntry(ticketId, timeEntryId) - Delete an existing time entry for a ticket
  • fs.tickets.createSource(source) - Create a new ticket source
  • fs.tickets.getTask(ticketId, taskId) - Get a specific task by id
  • fs.tickets.getTasks(ticketId, opts) - Get all tasks for a given ticket
  • fs.tickets.createTask(ticketId, task) - Create a new task for a given ticket
  • fs.tickets.updateTask(ticketId, taskId, task) - Update an existing task
  • fs.tickets.deleteTask(ticketId, taskId) - Delete an existing task

See the docs for more details.