api

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: MIT Imports: 24 Imported by: 6

Documentation

Index

Constants

View Source
const (
	GetCountriesMethod     = "getCountries"
	GetEmployeesMethod     = "getEmployees"
	GetBusinessAreasMethod = "getBusinessAreas"
	GetCurrenciesMethod    = "getCurrencies"
	GetUserRightsMethod    = "getUserRights"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BodyMock added in v0.3.0

type BodyMock struct {
	Body       io.Reader
	WasClosed  bool
	CloseError error
}

BodyMock implements resp.Body

func NewFromStr added in v0.3.0

func NewFromStr(body string) *BodyMock

NewFromStr creates BodyMock from a string

func NewFromStruct added in v0.3.0

func NewFromStruct(input interface{}) *BodyMock

NewFromStruct creates BodyMock from a struct converted to json or string

func (*BodyMock) Close added in v0.3.0

func (bm *BodyMock) Close() error

Close io.Closer implementation

func (*BodyMock) Read added in v0.3.0

func (bm *BodyMock) Read(p []byte) (n int, err error)

Read io.Reader implementation

type BusinessArea added in v0.1.0

type BusinessArea struct {
	Id           uint   `json:"id"`
	Name         string `json:"name"`
	Added        uint64 `json:"added"`
	LastModified uint64 `json:"lastModified"`
}

type Client added in v0.4.0

type Client struct {

	//Address requests
	AddressProvider addresses.Manager
	//Token requests
	AuthProvider auth.Provider
	//Company and Conf parameter requests
	CompanyManager company.Manager
	//Customers and suppliers requests
	CustomerManager customers.Manager
	//POS related requests
	PosManager pos.Manager
	//ListingDataProvider related requests
	ProductManager products.Manager
	//SalesDocuments, Payments, Projects, ShoppingCart, VatRates
	SalesManager sales.Manager
	//Warehouse requests
	WarehouseManager warehouse.Manager
	//Prices requests
	PricesManager prices.Manager
	//Documents requests
	DocumentsManager documents.Manager
	//Service Discovery
	ServiceDiscoverer servicediscovery.ServiceDiscoverer
	// contains filtered or unexported fields
}

func NewClient

func NewClient(sessionKey string, clientCode string, customCli *http.Client) (*Client, error)

NewClient Takes three params: sessionKey string obtained from credentials or jwt clientCode erply customer identification number and a custom http Client if needs to be overwritten. if nil will use default http client provided by the SDK The headersSetToEveryRequest function will be executed on every request and supplied with the request name. There is an example in the /examples of you to use it

func NewClientWithCustomHeaders added in v1.3.1

func NewClientWithCustomHeaders(customHTTPCli *http.Client, headersSetToEveryRequest func(requestName string) url.Values) (*Client, error)

NewClientWithCustomHeaders enables defining the function that will set headers to every request by your own

func NewClientWithURL added in v1.7.3

func NewClientWithURL(sessionKey, clientCode, partnerKey, url string, httpCli *http.Client, headersSetToEveryRequest func(requestName string) url.Values) (*Client, error)

NewClientWithURL creates a new Client which can have a static URL which is not affected by clientCode nor the headersSetToEveryRequest function if set. If the url parameter is set to an empty string, the URL is still resolved normally. This allows creating clients which have a static url in your unit tests but function normally in the rest of your code

func NewUnvalidatedClient added in v0.4.0

func NewUnvalidatedClient(sk, cc, partnerKey string, httpCli *http.Client) *Client

NewUnvalidatedClient returns a new Client without validating any of the incoming parameters giving the developer more flexibility

func (*Client) GetBusinessAreas added in v0.4.0

func (cli *Client) GetBusinessAreas(ctx context.Context, filters map[string]string) ([]BusinessArea, error)

GetBusinessAreas will list business areas according to specified filters.

func (*Client) GetCountries added in v0.4.0

func (cli *Client) GetCountries(ctx context.Context, filters map[string]string) ([]Country, error)

GetCountries will list countries according to specified filters.

func (*Client) GetCurrencies added in v0.4.0

func (cli *Client) GetCurrencies(ctx context.Context, filters map[string]string) ([]Currency, error)

GetCurrencies will list currencies according to specified filters.

func (*Client) GetEmployees added in v0.4.0

func (cli *Client) GetEmployees(ctx context.Context, filters map[string]string) ([]Employee, error)

GetEmployees will list employees according to specified filters.

func (*Client) GetUserRights added in v0.4.0

func (cli *Client) GetUserRights(ctx context.Context, filters map[string]string) ([]UserRights, error)

GetUserName from GetUserRights erply API request

func (*Client) LogProcessingOfCustomerData added in v0.4.0

func (cli *Client) LogProcessingOfCustomerData(ctx context.Context, filters map[string]string) error

type ClientMock added in v0.3.0

type ClientMock struct {
	ErrToGive      error
	ResponseToGive *http.Response
	Requests       []*http.Request
	Lock           sync.Mutex
}

ClientMock mocks HttpClient interface

func (*ClientMock) Do added in v0.3.0

func (cm *ClientMock) Do(req *http.Request) (*http.Response, error)

Do HttpClient interface implementation

type Country added in v0.1.0

type Country struct {
	CountryId             uint   `json:"countryID"`
	CountryName           string `json:"countryName"`
	CountryCode           string `json:"countryCode"`
	MemberOfEuropeanUnion byte   `json:"memberOfEuropeanUnion"`
	LastModified          string `json:"lastModified"`
	Added                 uint64 `json:"added"`
}

type Currency added in v0.1.0

type Currency struct {
	CurrencyID   string `json:"currencyID"`
	Code         string `json:"code"`
	Name         string `json:"name"`
	Default      string `json:"default"`
	NameShort    string `json:"nameShort"`
	NameFraction string `json:"nameFraction"`
	Added        string `json:"added"`
	LastModified string `json:"lastModified"`
}

type Employee added in v0.1.0

type Employee struct {
	EmployeeID             string                      `json:"employeeID"`
	FullName               string                      `json:"fullName"`
	EmployeeName           string                      `json:"employeeName"`
	FirstName              string                      `json:"firstName"`
	LastName               string                      `json:"lastName"`
	Phone                  string                      `json:"phone"`
	Mobile                 string                      `json:"mobile"`
	Email                  string                      `json:"email"`
	Fax                    string                      `json:"fax"`
	Code                   string                      `json:"code"`
	Gender                 string                      `json:"gender"`
	UserID                 string                      `json:"userID"`
	Username               string                      `json:"username"`
	UserGroupID            string                      `json:"userGroupID"`
	Warehouses             []EmployeeWarehouse         `json:"warehouses"`
	PointsOfSale           string                      `json:"pointsOfSale"`
	ProductIDs             []EmployeeProduct           `json:"productIDs"`
	Attributes             []sharedCommon.ObjAttribute `json:"attributes"`
	LastModified           uint64                      `json:"lastModified"`
	LastModifiedByUserName string                      `json:"lastModifiedByUserName"`

	// detail fileds
	Skype        string `json:"skype"`
	Birthday     string `json:"birthday"`
	JobTitleID   uint   `json:"jobTitleID"`
	JobTitleName string `json:"jobTitleName"`
	Notes        string `json:"notes"`
	Added        uint64 `json:"added"`
}

type EmployeeProduct added in v0.1.0

type EmployeeProduct struct {
	ProductID    uint   `json:"productID"`
	ProductCode  string `json:"productCode"`
	ProductName  string `json:"productName"`
	ProductGroup uint   `json:"productGroup"`
}

type EmployeeWarehouse added in v0.1.0

type EmployeeWarehouse struct {
	Id uint `json:"id"`
}

type GetBusinessAreasResponse added in v0.1.0

type GetBusinessAreasResponse struct {
	Status        sharedCommon.Status `json:"status"`
	BusinessAreas []BusinessArea      `json:"records"`
}

type GetCountriesResponse added in v0.1.0

type GetCountriesResponse struct {
	Status    sharedCommon.Status `json:"status"`
	Countries []Country           `json:"records"`
}

type GetCurrenciesResponse added in v0.1.0

type GetCurrenciesResponse struct {
	Status     sharedCommon.Status `json:"status"`
	Currencies []Currency          `json:"records"`
}

type GetEmployeesResponse added in v0.1.0

type GetEmployeesResponse struct {
	Status    sharedCommon.Status `json:"status"`
	Employees []Employee          `json:"records"`
}

type GetUserRightsResponse

type GetUserRightsResponse struct {
	Status  sharedCommon.Status `json:"status"`
	Records []UserRights        `json:"records"`
}

type InstallationRequest added in v0.1.0

type InstallationRequest struct {
	CompanyName string `json:"companyName"`
	FirstName   string `json:"firstName"`
	LastName    string `json:"lastName"`
	Phone       string `json:"phone"`
	Email       string `json:"email"`
	SendEmail   int    `json:"sendEmail"`
}

type InstallationResponse added in v0.1.0

type InstallationResponse struct {
	ClientCode int    `json:"clientCode"`
	UserName   string `json:"username"`
	Password   string `json:"password"`
}

func CreateInstallation added in v0.1.0

func CreateInstallation(baseUrl, partnerKey string, filters map[string]string, httpCli *http.Client) (*InstallationResponse, error)

type Manager added in v0.4.0

type Manager interface {
	GetCountries(ctx context.Context, filters map[string]string) ([]Country, error)
	GetUserRights(ctx context.Context, filters map[string]string) ([]UserRights, error)
	GetEmployees(ctx context.Context, filters map[string]string) ([]Employee, error)
	GetBusinessAreas(ctx context.Context, filters map[string]string) ([]BusinessArea, error)
	GetCurrencies(ctx context.Context, filters map[string]string) ([]Currency, error)
	LogProcessingOfCustomerData(ctx context.Context, filters map[string]string) error
}

this interface sums up the general requests here

type PartnerClient added in v0.4.0

type PartnerClient struct {
	Client               *Client
	PartnerTokenProvider auth.PartnerTokenProvider
}

func NewPartnerClient added in v0.4.0

func NewPartnerClient(sessionKey, clientCode, partnerKey string, customCli *http.Client) (*PartnerClient, error)

type UserRights

type UserRights struct {
	UserName string `json:"userName"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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