Skip to content

savely-krasovsky/pyrusapi-go

Repository files navigation

pyrusapi-go

GoDoc Widget Go Report codecov test lint

Library to work with Pyrus API v4 written in Golang.

Install

go get github.com/L11R/pyrusapi-go

Quick Start

package main

import (
	"fmt"
	"log"

	"github.com/L11R/pyrusapi-go"
)

func main() {
	c, err := pyrus.NewClient("bot_login", "bot_security_key")
	if err != nil {
		log.Fatalln(err)
	}

	p, err := c.Profile()
	if err != nil {
		log.Fatalln(err)
	}

	fmt.Println(p.FirstName)
}

Current status

Forms:

  • GET /forms
  • GET /forms/{form-id}
  • GET /forms/{form-id}/register

Tasks:

  • GET /tasks/{task-id}
  • POST /tasks
  • POST /tasks/{task-id}/comments

Files:

  • POST /files/upload
  • GET /files/download/{file-id}

Catalogs:

  • GET /catalogs
  • GET /catalogs/{catalog-id}
  • PUT /catalogs
  • POST /catalogs/{catalog-id}

Contacts:

  • GET /contacts

Members:

  • GET /members
  • POST /members
  • PUT /members/{member-id}
  • DELETE /members/{member-id}

Lists:

  • GET /lists
  • GET /lists/{list-id}/tasks
  • GET /inbox

Telephony:

  • GET /calls
  • PUT /calls/{call-guid}
  • POST /calls/{call-guid}/event

Webhooks:

  • Use WebhookHandler() (http.HandlerFunc, <-chan Event)

Tests

To test project you have to download sample responses from your organization. I cannot upload my own, because it could contain sensitive information, and I'm too lazy to fake it :)

Set those environment variables and run tests:

PYRUS_LOGIN=login
PYRUS_SECURITY_KEY=securityKey
PYRUS_FORM_ID=123456
PYRUS_TASK_ID=123456
PYRUS_CATALOG_ID=123456
PYRUS_MEMBER_ID=123456
PYRUS_ROLE_ID=123456
PYRUS_LIST_ID=123456
PYRUS_FILE_ID=123456
PYRUS_CALL_GUID=5d8dc3d6-27e7-4cd4-a057-2b4f4d74e0a5