Skip to content

Virtomize/i-doit-go-api

Repository files navigation

i-doit-go-api/goidoit

Donate GoDoc Go Report Card License Build Status Built with Mage Coverage

is an I-doit API client implementation written in GOLANG.

Its focused on simplicity to create easy writable code for your projects.

the package supports:

  • Login
  • Requests
  • Searching
  • Getting object information by id, id slice, string or custom field
  • creating, altering, deleting, archiving, quickpurging objects
  • reports
  • categories (only parts implemented) (wip)
  • object_type_categories
  • dialog

Other types of requests like

  • object_types (coming soon)
  • object_type_groups (coming soon)
  • objects_by_relation (coming soon)
  • categories (category, category_info) (wip)
  • location_tree
  • workstation_components
  • logbook
  • impact

are not implemented yet (and maybe never will) but can easily be implemented using the goidoit.Request function there are some advanced examples of how to do this.

There is also a second repo i-doit-go-tools where you can find some more scripts for special use-cases that can be used as an even more advanced example :P.

Installation

If you already installed GO on your system and configured it properly than its simply:

go get github.com/virtomize/i-doit-go-api

If not follow these instructions

Usage

Simple example

package main

import (
	"fmt"
	"github.com/virtomize/i-doit-go-api"
)

func main() {
  // create api object
  a, _ := goidoit.NewAPI("https://example.com/src/jsonrpc.php", "yourapikey")

  // or login using X-RPC-Auth (recommended)
  // a, _ := goidoit.NewLogin("https://example.com/src/jsonrpc.php", "yourapikey", "username", "password")

  // search for sth like test
  s, _ := a.Search("test")

  // thats it
  fmt.Println(s)
}

Advanced examples

There are more advanced examples documented in the repo for common use cases.

Code Documentation

You find the full code documentation here

Code Testing

This library uses mage for testing and coverage. After installing mage just run:

mage test

also code coverage in detail can be seen via browser by using

mage coverage

Additional Informations

This project uses sematic versioning.

Other great client implementations

Thanks for your code inspirations!

Contribution

Thank you for participating to this project. Please see our Contribution Guidlines for more information.