account

package
v1.14.4 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountService

type AccountService interface {
	GetContacts(parameters connection.APIRequestParameters) ([]Contact, error)
	GetContactsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Contact], error)
	GetContact(contactID int) (Contact, error)

	GetDetails() (Details, error)

	GetCredits(parameters connection.APIRequestParameters) ([]Credit, error)

	GetInvoices(parameters connection.APIRequestParameters) ([]Invoice, error)
	GetInvoicesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Invoice], error)
	GetInvoice(invoiceID int) (Invoice, error)

	GetInvoiceQueries(parameters connection.APIRequestParameters) ([]InvoiceQuery, error)
	GetInvoiceQueriesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[InvoiceQuery], error)
	GetInvoiceQuery(invoiceQueryID int) (InvoiceQuery, error)
	CreateInvoiceQuery(req CreateInvoiceQueryRequest) (int, error)
}

AccountService is an interface for managing account

type Contact

type Contact struct {
	ID        int         `json:"id"`
	Type      ContactType `json:"type"`
	FirstName string      `json:"first_name"`
	LastName  string      `json:"last_name"`
}

Contact represents a UKFast account contact

type ContactNotFoundError

type ContactNotFoundError struct {
	ID int
}

ContactNotFoundError indicates a contact was not found

func (*ContactNotFoundError) Error

func (e *ContactNotFoundError) Error() string

type ContactType

type ContactType string
const (
	ContactTypePrimaryContact ContactType = "Primary Contact"
	ContactTypeAccounts       ContactType = "Accounts"
	ContactTypeTechnical      ContactType = "Technical"
	ContactTypeThirdParty     ContactType = "Third Party"
	ContactTypeOther          ContactType = "Other"
)

func (ContactType) String

func (t ContactType) String() string

type CreateInvoiceQueryRequest

type CreateInvoiceQueryRequest struct {
	ContactID        int     `json:"contact_id"`
	ContactMethod    string  `json:"contact_method"`
	Amount           float32 `json:"amount"`
	WhatWasExpected  string  `json:"what_was_expected"`
	WhatWasReceived  string  `json:"what_was_received"`
	ProposedSolution string  `json:"proposed_solution"`
	InvoiceIDs       []int   `json:"invoice_ids"`
}

CreateInvoiceQueryRequest represents a request to create an invoice query

type Credit

type Credit struct {
	Type      string `json:"type"`
	Total     int    `json:"total"`
	Remaining int    `json:"remaining"`
}

Credit represents a UKFast account credit

type Details

type Details struct {
	CompanyRegistrationNumber string `json:"company_registration_number"`
	VATIdentificationNumber   string `json:"vat_identification_number"`
	PrimaryContactID          int    `json:"primary_contact_id"`
}

Details represents a UKFast account details

type Invoice

type Invoice struct {
	ID    int             `json:"id"`
	Date  connection.Date `json:"date"`
	Paid  bool            `json:"paid"`
	Net   float32         `json:"net"`
	VAT   float32         `json:"vat"`
	Gross float32         `json:"gross"`
}

Invoice represents a UKFast account invoice

type InvoiceNotFoundError

type InvoiceNotFoundError struct {
	ID int
}

InvoiceNotFoundError indicates an invoice was not found

func (*InvoiceNotFoundError) Error

func (e *InvoiceNotFoundError) Error() string

type InvoiceQuery

type InvoiceQuery struct {
	ID               int     `json:"id"`
	ContactID        int     `json:"contact_id"`
	Amount           float32 `json:"amount"`
	WhatWasExpected  string  `json:"what_was_expected"`
	WhatWasReceived  string  `json:"what_was_received"`
	ProposedSolution string  `json:"proposed_solution"`
	InvoiceIDs       []int   `json:"invoice_ids"`
}

InvoiceQuery represents a UKFast account invoice query

type InvoiceQueryNotFoundError

type InvoiceQueryNotFoundError struct {
	ID int
}

InvoiceQueryNotFoundError indicates an invoice query was not found

func (*InvoiceQueryNotFoundError) Error

func (e *InvoiceQueryNotFoundError) Error() string

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service implements AccountService for managing Account certificates via the UKFast API

func NewService

func NewService(connection connection.Connection) *Service

NewService returns a new instance of AccountService

func (*Service) CreateInvoiceQuery

func (s *Service) CreateInvoiceQuery(req CreateInvoiceQueryRequest) (int, error)

CreateInvoiceQuery retrieves creates an InvoiceQuery

func (*Service) GetContact

func (s *Service) GetContact(contactID int) (Contact, error)

GetContact retrieves a single contact by id

func (*Service) GetContacts

func (s *Service) GetContacts(parameters connection.APIRequestParameters) ([]Contact, error)

GetContacts retrieves a list of contacts

func (*Service) GetContactsPaginated

func (s *Service) GetContactsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Contact], error)

GetContactsPaginated retrieves a paginated list of contacts

func (*Service) GetCredits

func (s *Service) GetCredits(parameters connection.APIRequestParameters) ([]Credit, error)

GetCredits retrieves a list of credits

func (*Service) GetDetails

func (s *Service) GetDetails() (Details, error)

GetDetails retrieves account details

func (*Service) GetInvoice

func (s *Service) GetInvoice(invoiceID int) (Invoice, error)

GetInvoice retrieves a single invoice by id

func (*Service) GetInvoiceQueries

func (s *Service) GetInvoiceQueries(parameters connection.APIRequestParameters) ([]InvoiceQuery, error)

GetInvoiceQueries retrieves a list of invoice queries

func (*Service) GetInvoiceQueriesPaginated

func (s *Service) GetInvoiceQueriesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[InvoiceQuery], error)

GetInvoiceQueriesPaginated retrieves a paginated list of invoice queries

func (*Service) GetInvoiceQuery

func (s *Service) GetInvoiceQuery(queryID int) (InvoiceQuery, error)

GetInvoiceQuery retrieves a single invoice query by id

func (*Service) GetInvoices

func (s *Service) GetInvoices(parameters connection.APIRequestParameters) ([]Invoice, error)

GetInvoices retrieves a list of invoices

func (*Service) GetInvoicesPaginated

func (s *Service) GetInvoicesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Invoice], error)

GetInvoicesPaginated retrieves a paginated list of invoices

Jump to

Keyboard shortcuts

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