DutyCalls module written using the Go language.
Install the module by running the following command in the @thingsdb scope:
new_module("dutycalls", "github.com/thingsdb/module-go-dutycalls");Optionally, you can choose a specific version by adding a @ followed with the release tag. For example: @v0.1.0.
The DutyCalls module requires configuration with the following properties:
| Property | Type | Description |
|---|---|---|
| login | str (required) | Login to authenticate with. |
| password | str (required) | Password / secret for the user. |
| uri | str (optional) | API REST endpoint. Defaults to https://dutycalls.me/api. |
Example configuration:
set_module_conf("dutycalls", {
login: "abcdefgh...",
password: "hgfedcba...",
});| Name | Description |
|---|---|
| new_ticket | Create a new ticket. |
| get_ticket | Get a ticket. |
| get_tickets | Get multiple tickets with a single request. |
| close_ticket | Close a ticket. |
| close_tickets | Close a list of tickets. |
| unack_ticket | Un-acknowledge a ticket. |
| unack_tickets | Un-acknowledge a list of tickets. |
| new-hit | Create a new hit. |
| get-hits | Get ticket hists. |
Syntax: new_ticket(channel, ticket)
channel: (str) Destination Channel to crete the ticket in.ticket: (thing) Ticket, at least a title and body are required.
ticket = {
title: "Example ticket",
body: "This is an example ticket."
};
dutycalls.new_ticket("mychannel", ticket).then(|sid| {
sid; // the SID (string) of the created ticket
}).else(|err| {
err; // some error has occurred
})Syntax: get_ticket(sid)
sid: (str) SID of the ticket.
sid = "Ai782xf..."; // Some SID
dutycalls.get_ticket(sid).then(|ticket| {
ticket; // the ticket (thing) with the given SID
});Syntax: get_tickets([sid, ...])
[sid, ...]: (list of str) List with SIDs.
sids = ["Ai782xf...", ["Aj35dwe..."]; // Some SIDs
dutycalls.get_tickets(sids).then(|tickets| {
tickets; // list with tickets for the given SIDs
});Syntax: close_ticket(sid)
sid: (str) SID of the ticket.
sid = "Ai782xf..."; // Some SID
// Returns nil in case of success
dutycalls.close_ticket(sid).else(|err| {
err; // some error has occurred
});Syntax: close_tickets([sid, ...])
[sid, ...]: (list of str) List of SIDs.
sids = ["Ai782xf...", "Aj35dwe..."]; // Some SIDs
// Returns nil in case of success
dutycalls.close_tickets(sids).else(|err| {
err; // some error has occurred
});Syntax: unack_ticket(sid)
sid: (str) SID of the ticket.
sid = "Ai782xf..."; // Some SID
// Returns nil in case of success
dutycalls.unack_ticket(sid).else(|err| {
err; // some error has occurred
});Syntax: unack_tickets([sid, ...])
[sid, ...]: (list of str) List of SIDs.
sids = ["Ai782xf...", "Aj35dwe..."]; // Some SIDs
// Returns nil in case of success
dutycalls.unack_tickets(sids).else(|err| {
err; // some error has occurred
});Syntax: new_hit(sid, ticket)
sid: (str) Destination Ticket (SID) to crete the hit for.hit: (thing) Hit, at least a summary is required.
hit = {
summary: "Example hist"
};
// Returns nil in case of success
dutycalls.new_hit("Ai782xf...", hit).else(|err| {
err; // some error has occurred
});Syntax: get_hits(sid)
sid: (str) SID of the ticket.
sid = "Ai782xf...";
dutycalls.get_hits(sid).then(|hits| {
hits; // some error has occurred
});