companies

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAuthorizationFailed = errors.New("company authorization failed")
)
View Source
var (
	ErrInvalidApiKeyRevoke = errors.New("invalid api key revoke")
)
View Source
var (
	ErrInvalidCompanyCreation = errors.New("invalid company creation")
)
View Source
var (
	ErrRetrievingData = errors.New("retrieving data failed")
)

Functions

This section is empty.

Types

type Address

type Address struct {
	Address1 string `json:"address_1"`
	Country  string `json:"country"`
	City     string `json:"city"`
	State    string `json:"state"`
	Zip      string `json:"zip"`
}

type ApiKey

type ApiKey struct {
	Key string `json:"key"`
}

type AuthorizationInput

type AuthorizationInput struct {
	AccessToken string `json:"access_token"`
	Type        string `json:"type"`
}

type AuthorizationOutput

type AuthorizationOutput struct {
	Username string
	At       time.Time
}

type CompaniesConfigs

type CompaniesConfigs struct {
	ServiceUri string
	Routes     *CompaniesRoutes
}

type CompaniesRoutes

type CompaniesRoutes struct {
	Create    RouteOptions
	Data      RouteOptions
	Revoke    RouteOptions
	Authorize RouteOptions
}

type Company

type Company struct {
	OCID        string   `json:"ocid"`
	Title       string   `json:"title"`
	Email       string   `json:"email"`
	PhoneNumber string   `json:"phone_number"`
	Address     *Address `json:"address"`
}

func GetCompanyData

func GetCompanyData(d *DataInput, cfg *CompaniesConfigs) (*Company, error)

type CreateInput

type CreateInput struct {
	Title       string `json:"title"`
	Email       string `json:"email"`
	Password    string `json:"password"`
	PhoneNumber string `json:"phone_number"`

	Address struct {
		Address1 string `json:"address_1"`
		City     string `json:"city"`
		Country  string `json:"country"`
		State    string `json:"state"`
		Zip      string `json:"zip"`
	} `json:"address" validate:"dive"`
}

type CreateOutput

type CreateOutput struct {
	Type    string  `json:"type"`
	ApiKey  ApiKey  `json:"key"`
	Company Company `json:"company"`
}

func CreateCompany

func CreateCompany(cr *CreateInput, cfg *CompaniesConfigs) (*CreateOutput, error)

type DataInput

type DataInput struct {
	OCID string `json:"ocid"`
}

type RevokeInput

type RevokeInput struct {
	Key string `json:"key"`
}

type RevokeOutput

type RevokeOutput struct {
	Type   string `json:"type"`
	ApiKey ApiKey `json:"key"`
}

func RevokeApiKey

func RevokeApiKey(cr *RevokeInput, cfg *CompaniesConfigs) (*RevokeOutput, error)

type RouteOptions

type RouteOptions struct {
	Path   string
	Method string
}

func (RouteOptions) Construct

func (p RouteOptions) Construct(srv string) (*url.URL, error)

Jump to

Keyboard shortcuts

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