Giter Club home page Giter Club logo

goticket's Introduction

goticket

Go Go Report Card

Is a library for the ticket software osTicket. Here you can find their website. With this small library you can create a new ticket in json format via the Rest API. A small tutorial can be found here.

Install

go get github.com/gowizzard/goticket

How to use?

With a function you can create a ticket directly in your system. How to create an API token can be found here.

Create ticket

To give you a better understanding of the data to be transferred, I'll show you the structure for creating the JSON data. Here you can see which values are needed. Below you will find an example.

type TicketBody struct {
	Alert       bool                `json:"alert"`
	Autorespond bool                `json:"autorespond"`
	Source      string              `json:"source"`
	Name        string              `json:"name"`
	Email       string              `json:"email"`
	Phone       string              `json:"phone"`
	Subject     string              `json:"subject"`
	Ip          string              `json:"ip"`
	Message     string              `json:"message"`
	Attachments []map[string]string `json:"attachments,omitempty"`
}

With this function you create a ticket.

// Ticket body
body := &goticket.TicketBody{
    Alert:       true,
    Autorespond: true,
    Source:      "API",
    Name:        "Jonas Kwiedor",
    Email:       "[email protected]",
    Phone:       "",
    Subject:     "Sehr sauer",
    Ip:          "data:text/html,Message <b>Was ist da los????</b>",
    Message:     "",
    Attachments: nil,
}

// Add file
file := make(map[string]string)
file["files.txt"] = "data:text/plain;charset=utf-8,content"

// Add file to attachment
body.Attachments = append(body.Attachments, file)

// Create test ticket
ticket, err := goticket.CreateTicket(body, "https://base.url.de", "token")
if err != nil {
    fmt.Println(err)
}

// Print ticket response
fmt.Println(ticket)

Help

If you have any questions or comments, please contact us by e-mail at [email protected]

goticket's People

Contributors

gowizzard avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.