container

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// EnvProduction is the production env
	EnvProduction = iota
	// EnvDevelopment is the dev env
	EnvDevelopment
	// EnvSandBox is the local/sandbox env
	EnvSandBox
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	AuthService     authentication.Service
	MerchantService merchant.Service
	CatalogService  catalog.Service
	EventsService   events.Service
	OrdersService   orders.Service
	// contains filtered or unexported fields
}

Container is the SDK abstractions holder to facilitate the API manipulation

func Create added in v1.1.1

func Create(clientId, clientSecret string, env int, v2 bool) (c *Container)

func CreateFromEnvs added in v1.1.1

func CreateFromEnvs() (c *Container)

CreateFromEnvs creates a new instance of the container struct from envs

"IFOOD_CLIENT_ID"
"IFOOD_CLIENT_SECRET"
"IFOOD_ENV" (default to Production)
always uses the api v2

func New

func New(env int, timeout time.Duration, v2 bool) *Container

New returns a new container

func (*Container) GetAuthenticationService

func (c *Container) GetAuthenticationService(clientId, clientSecret string) authentication.Service

GetAuthenticationService instantiates an auth service, also adds it to the container

func (*Container) GetCatalogService

func (c *Container) GetCatalogService() catalog.Service

GetCatalogService instantiates an catalog service, also adds it to the container

func (*Container) GetEventsService

func (c *Container) GetEventsService() events.Service

GetEventsService instantiates an events service, also adds it to the container

func (*Container) GetHttpAdapter

func (c *Container) GetHttpAdapter() adapters.Http

GetHttpAdapter returns new HTTP adapter according to the env

func (*Container) GetMerchantService

func (c *Container) GetMerchantService() merchant.Service

GetMerchantService instantiates an merchant service, also adds it to the container

func (*Container) GetOrdersService

func (c *Container) GetOrdersService() orders.Service

GetOrdersService instantiates an orders service, also adds it to the container

Jump to

Keyboard shortcuts

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