smallinvoice

package module
v0.0.0-...-0e290b2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

README

smallinvoice-go

Documentation

Index

Constants

View Source
const (
	// ContactTypePrivate is a private customer.
	ContactTypePrivate ContactType = "P"

	// ContactTypeCompany is a commercial customer/company.
	ContactTypeCompany ContactType = "C"

	// ContactRelationClient is a client.
	ContactRelationClient ContactRelation = "CL"

	// ContactRelationCreditor is a creditor.
	ContactRelationCreditor ContactRelation = "CR"

	// ContactGenderFemale ...
	ContactGenderFemale ContactGender = "F"

	// ContactGenderMale ...
	ContactGenderMale ContactGender = "M"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Country  string `json:"country,omitempty"`
	Street   string `json:"street,omitempty"`
	Street2  string `json:"street2,omitempty"`
	StreetNo string `json:"street_no,omitempty"`
	Postcode string `json:"postcode,omitempty"`
	City     string `json:"city,omitempty"`
}

Address is the main contact address.

type AuthBundle

type AuthBundle struct {
	TokenType   string `json:"token_type"`
	ExpiresIn   int    `json:"expires_in"`
	AccessToken string `json:"access_token"`
}

AuthBundle stores all auth related data.

type Client

type Client struct {
	RestyClient *resty.Client
	Credentials Credentials
	AuthBundle  AuthBundle
}

Client stores all connection related information and acts as the gateway.

func NewClient

func NewClient(clientID string, clientSecret string) (*Client, error)

NewClient creates a new Smallinvoice client.

func (*Client) CreateContact

func (c *Client) CreateContact(contact Contact) (Contact, error)

CreateContact creates a new contact

func (*Client) GetContact

func (c *Client) GetContact(id string) (contact Contact, err error)

GetContact fetches one contact from the API.

type Contact

type Contact struct {
	Gender      ContactGender     `json:"gender"`
	Type        ContactType       `json:"type"`
	Relation    []ContactRelation `json:"relation"`
	Email       string            `json:"email"`
	Name        string            `json:"name"`
	MainAddress Address           `json:"main_address"`
}

Contact is the contact entity.

type ContactGender

type ContactGender string

ContactGender is either F or M.

type ContactRelation

type ContactRelation string

ContactRelation is either a client or creditor.

type ContactType

type ContactType string

ContactType is either a commercial or private customer type.

type Credentials

type Credentials struct {
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	GrantType    string `json:"grant_type"`
	Scope        string `json:"scope"`
}

Credentials consists of client id and secret which is obtained in the Dashboard of smallinvoice.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL