account

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 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 {
	GetClients(parameters connection.APIRequestParameters) ([]Client, error)
	GetClientsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Client], error)
	GetClient(clientID int) (Client, error)
	CreateClient(req CreateClientRequest) (int, error)
	PatchClient(clientID int, patch PatchClientRequest) error
	DeleteClient(clientID int) error

	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)

	GetApplications(parameters connection.APIRequestParameters) ([]Application, error)
	GetApplicationsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Application], error)
	GetServices(parameters connection.APIRequestParameters) ([]ApplicationService, error)
	GetServicesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[ApplicationService], error)
	GetApplication(appID string) (Application, error)
	CreateApplication(req CreateApplicationRequest) (CreateApplicationResponse, error)
	UpdateApplication(appID string, req UpdateApplicationRequest) error
	GetApplicationServices(appID string) (ApplicationServiceMapping, error)
	SetApplicationServices(appID string, req SetServiceRequest) error
	DeleteApplicationServices(appID string) error
	GetApplicationRestrictions(appID string) (ApplicationRestriction, error)
	SetApplicationRestrictions(appID string, req SetRestrictionRequest) error
	DeleteApplicationRestrictions(appID string) error
	DeleteApplication(appID string) error
}

AccountService is an interface for managing account

type Application added in v1.20.0

type Application struct {
	ID          string              `json:"id"`
	Key         string              `json:"key"`
	Name        string              `json:"name"`
	Description string              `json:"description"`
	CreatedAt   connection.DateTime `json:"created_at"`
	CreatedBy   string              `json:"created_by"`
}

Application represents an API Application

type ApplicationNotFoundError added in v1.20.0

type ApplicationNotFoundError struct {
	ID string
}

func (*ApplicationNotFoundError) Error added in v1.20.0

func (e *ApplicationNotFoundError) Error() string

type ApplicationRestriction added in v1.20.0

type ApplicationRestriction struct {
	IPRestrictionType string   `json:"ip_restriction_type"`
	IPRanges          []string `json:"ip_ranges"`
}

type ApplicationService added in v1.20.0

type ApplicationService struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type ApplicationServiceMapping added in v1.20.0

type ApplicationServiceMapping struct {
	Scopes []ApplicationServiceScope `json:"scopes"`
}

type ApplicationServiceScope added in v1.20.0

type ApplicationServiceScope struct {
	Service string   `json:"service"`
	Roles   []string `json:"roles"`
}

type Client added in v1.16.8

type Client struct {
	ID               int    `json:"id"`
	CompanyName      string `json:"company_name"`
	FirstName        string `json:"first_name"`
	LastName         string `json:"last_name"`
	EmailAddress     string `json:"email_address"`
	LimitedNumber    string `json:"limited_number"`
	VATNumber        string `json:"vat_number"`
	Address          string `json:"address"`
	Address1         string `json:"address1"`
	City             string `json:"city"`
	County           string `json:"county"`
	Country          string `json:"country"`
	Postcode         string `json:"postcode"`
	Phone            string `json:"phone"`
	Fax              string `json:"fax"`
	Mobile           string `json:"mobile"`
	Type             string `json:"type"`
	UserName         string `json:"user_name"`
	IDReference      string `json:"id_reference"`
	NominetContactID string `json:"nominet_contact_id"`
	CreatedDate      string `json:"created_date"`
}

Client represents an account client

type ClientNotFoundError added in v1.16.8

type ClientNotFoundError struct {
	ID int
}

ClientNotFoundError indicates a client was not found

func (*ClientNotFoundError) Error added in v1.16.8

func (e *ClientNotFoundError) Error() string

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 CreateApplicationRequest added in v1.20.0

type CreateApplicationRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type CreateApplicationResponse added in v1.20.1

type CreateApplicationResponse struct {
	ID  string `json:"id"`
	Key string `json:"key"`
}

type CreateClientRequest added in v1.16.8

type CreateClientRequest struct {
	CompanyName      string `json:"company_name"`
	FirstName        string `json:"first_name"`
	LastName         string `json:"last_name"`
	EmailAddress     string `json:"email_address"`
	LimitedNumber    string `json:"limited_number"`
	VATNumber        string `json:"vat_number"`
	Address          string `json:"address"`
	Address1         string `json:"address1"`
	City             string `json:"city"`
	County           string `json:"county"`
	Country          string `json:"country"`
	Postcode         string `json:"postcode"`
	Phone            string `json:"phone"`
	Fax              string `json:"fax"`
	Mobile           string `json:"mobile"`
	Type             string `json:"type"`
	UserName         string `json:"user_name"`
	IDReference      string `json:"id_reference"`
	NominetContactID string `json:"nominet_contact_id"`
}

CreateClientRequest represents a request to create a client

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 PatchClientRequest added in v1.16.8

type PatchClientRequest struct {
	CompanyName      string `json:"company_name,omitempty"`
	FirstName        string `json:"first_name,omitempty"`
	LastName         string `json:"last_name,omitempty"`
	EmailAddress     string `json:"email_address,omitempty"`
	LimitedNumber    string `json:"limited_number,omitempty"`
	VATNumber        string `json:"vat_number,omitempty"`
	Address          string `json:"address,omitempty"`
	Address1         string `json:"address1,omitempty"`
	City             string `json:"city,omitempty"`
	County           string `json:"county,omitempty"`
	Country          string `json:"country,omitempty"`
	Postcode         string `json:"postcode,omitempty"`
	Phone            string `json:"phone,omitempty"`
	Fax              string `json:"fax,omitempty"`
	Mobile           string `json:"mobile,omitempty"`
	Type             string `json:"type,omitempty"`
	UserName         string `json:"user_name,omitempty"`
	IDReference      string `json:"id_reference,omitempty"`
	NominetContactID string `json:"nominet_contact_id,omitempty"`
}

PatchClientRequest represents a request to update a client

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) CreateApplication added in v1.20.0

func (s *Service) CreateApplication(req CreateApplicationRequest) (CreateApplicationResponse, error)

func (*Service) CreateClient added in v1.16.8

func (s *Service) CreateClient(req CreateClientRequest) (int, error)

CreateClient creates a new client

func (*Service) CreateInvoiceQuery

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

CreateInvoiceQuery retrieves creates an InvoiceQuery

func (*Service) DeleteApplication added in v1.20.0

func (s *Service) DeleteApplication(appID string) error

DeleteApplication removes an application

func (*Service) DeleteApplicationRestrictions added in v1.20.3

func (s *Service) DeleteApplicationRestrictions(appID string) error

func (*Service) DeleteApplicationServices added in v1.20.4

func (s *Service) DeleteApplicationServices(appID string) error

func (*Service) DeleteClient added in v1.16.8

func (s *Service) DeleteClient(clientID int) error

DeleteClient removes a client

func (*Service) GetApplication added in v1.20.0

func (s *Service) GetApplication(appID string) (Application, error)

GetApplication retrieves a single application by id

func (*Service) GetApplicationRestrictions added in v1.20.0

func (s *Service) GetApplicationRestrictions(appID string) (ApplicationRestriction, error)

GetApplicationRestrictions retrieves the IP restrictions of an application by id

func (*Service) GetApplicationServices added in v1.20.0

func (s *Service) GetApplicationServices(appID string) (ApplicationServiceMapping, error)

GetApplicationServices retrieves the services and roles of an application by id

func (*Service) GetApplications added in v1.20.0

func (s *Service) GetApplications(parameters connection.APIRequestParameters) ([]Application, error)

GetApplications retrieves a list of applications

func (*Service) GetApplicationsPaginated added in v1.20.0

func (s *Service) GetApplicationsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Application], error)

func (*Service) GetClient added in v1.16.8

func (s *Service) GetClient(clientID int) (Client, error)

GetClient retrieves a single client by id

func (*Service) GetClients added in v1.16.8

func (s *Service) GetClients(parameters connection.APIRequestParameters) ([]Client, error)

GetClients retrieves a list of clients

func (*Service) GetClientsPaginated added in v1.16.8

func (s *Service) GetClientsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Client], error)

GetClientsPaginated retrieves a paginated list of clients

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

func (*Service) GetServices added in v1.20.0

func (s *Service) GetServices(parameters connection.APIRequestParameters) ([]ApplicationService, error)

GetApplications retrieves a list of applications

func (*Service) GetServicesPaginated added in v1.20.0

func (s *Service) GetServicesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[ApplicationService], error)

func (*Service) PatchClient added in v1.16.8

func (s *Service) PatchClient(clientID int, patch PatchClientRequest) error

PatchClient patches a client

func (*Service) SetApplicationRestrictions added in v1.20.0

func (s *Service) SetApplicationRestrictions(appID string, req SetRestrictionRequest) error

func (*Service) SetApplicationServices added in v1.20.0

func (s *Service) SetApplicationServices(appID string, req SetServiceRequest) error

func (*Service) UpdateApplication added in v1.20.1

func (s *Service) UpdateApplication(appID string, req UpdateApplicationRequest) error

type SetRestrictionRequest added in v1.20.0

type SetRestrictionRequest struct {
	IPRestrictionType string   `json:"ip_restriction_type"`
	IPRanges          []string `json:"ip_ranges"`
}

type SetServiceRequest added in v1.20.0

type SetServiceRequest struct {
	Scopes []ApplicationServiceScope `json:"scopes"`
}

type UpdateApplicationRequest added in v1.20.1

type UpdateApplicationRequest struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

Jump to

Keyboard shortcuts

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