Giter Site home page Giter Site logo

billomat's Introduction

billomat

Unofficial billomat.com API Go/Golang SDK

https://www.billomat.com/api/

Examples

Creating new Client

package main

import (
	log "github.com/sirupsen/logrus"
	"github.com/sklinkert/billomat"
)

func main() {
	const apiKey = "abcdefgh"
	const billomatID = "mycompany"
	const appID = "12345"
	const appSecret = "ejkrfierfnebnfuernferufrbef/ejenir"
	b := billomat.New(billomatID, appID, appSecret, apiKey)
}

Create Client

client := &billomat.Client{
	Name:        "Musterfirma",
	Salutation:  "Herr",
	FirstName:   "Max",
	LastName:    "Muster",
	Street:      "Musterstraße 123",
	Zip:         "12345",
	State:       "Bundesland",
	CountryCode: "DE",
	Phone:       "+49 123456789",
	Email:       "[email protected]",
}
createdClient, err := b.CreateClient(client)
if err != nil {
	log.WithError(err).Fatal("Adding client failed")
}
log.Infof("Client ID is %d. Created at %v", createdClient.ID, createdClient.Created)

Delete Client

if err := b.DeleteClient(createdClient); err != nil {
	log.WithError(err).Fatal("deleting client failed")
}

Create Offer

offer := &billomat.Offer{
	ClientID: createdClient.ID,
	OfferItems: []billomat.OfferItem{
		{
			Title:     "Product XYZ",
			UnitPrice: 18.99,
			Quantity:  5,
		},
	},
}
createdOffer, err := b.CreateOffer(offer)
if err != nil {
	log.WithError(err).Fatal("Adding offer failed")
}
log.Infof("Offer ID is %d", createdOffer.ID)

Delete Offer

if err := b.DeleteOffer(createdOffer); err != nil {
	log.WithError(err).Fatal("deleting offer failed")
}

Create Article

article := &billomat.Article{
  Title: "ETF-Sparplan von ETFs24.de"
  SalePrice: 9.99,
  // ...
}
createdArticle, err := b.CreateArticle(article)
if err != nil {
	log.WithError(err).Fatal("Adding article failed")
}

Get Article(s)

// by article number
articles, err := b.GetArticlesByNumber("D-1830-54")
if err != nil {
	log.WithError(err).Fatal("getting articles failed")
}

// or by ID
article, err := b.GetArticleByID(287)
if err != nil {
	log.WithError(err).Fatal("getting article failed")
}

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.