goakeneo

package module
v2.0.0-...-a146387 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: MIT Imports: 16 Imported by: 0

README

Go Akeneo SDK

The Go Akeneo SDK is a client library for interacting with the Akeneo API in Go applications.

Installation

You can install the library using the go get command:

go get github.com/ezifyio/go-akeneo

To use the Go Akeneo SDK in your Go project, you need to import it:

import "github.com/ezifyio/go-akeneo"

Usage

To get started with the Go Akeneo SDK, you need to create a new client by providing the necessary configuration and options:

connector := goakeneo.Connector{
ClientID:   "your-client-id",
Secret:     "your-secret",
UserName:   "your-username",
Password:   "your-password",
}

client, err := goakeneo.NewClient(connector,
	goakeneo.WithBaseURL("https://your-akeneo-instance.com"),
	goakeneo.WithRateLimit(10, 1*time.Second),
)
if err != nil {
// Handle error
}

Once you have a client instance, you can use it to interact with the Akeneo API. The client provides various services for different API endpoints, such as AuthService, ProductService, FamilyService, etc. You can access these services from the client and make API calls:

// Example: Get products
products,links, err := client.Product.ListWithPagination(nil)
if err != nil {
// Handle error
}

for product := range products {
// Process each product
}

Refer to the Go Akeneo SDK documentation and API reference for more information on available services and methods.

Contributing

If you would like to contribute to the Go Akeneo SDK, feel free to submit pull requests or open issues on the GitHub repository: https://github.com/ezifyio/go-akeneo

License

The Go Akeneo SDK is open-source and available under the MIT License.

Documentation

Index

Constants

View Source
const (
	// AkeneoPimVersion4 is the version 4 of Akeneo PIM
	AkeneoPimVersion4 = iota + 4
	// AkeneoPimVersion5 is the version 5 of Akeneo PIM
	AkeneoPimVersion5
	// AkeneoPimVersion6 is the version 6 of Akeneo PIM
	AkeneoPimVersion6
	// AkeneoPimVersion7 is the version 7 of Akeneo PIM
	AkeneoPimVersion7
)
View Source
const (
	ValueTypeString = iota + 1
	ValueTypeStringCollection
	ValueTypeNumber
	ValueTypeMetric
	ValueTypePrice
	ValueTypeBoolean
	ValueTypeSimpleSelect
	ValueTypeMultiSelect
	ValueTypeTable
)

ValueTypeConst

Variables

View Source
var ValueTypeName = map[int]string{
	ValueTypeString:           "string",
	ValueTypeStringCollection: "string_collection",
	ValueTypeNumber:           "number",
	ValueTypeMetric:           "metric",
	ValueTypePrice:            "price",
	ValueTypeBoolean:          "boolean",
	ValueTypeSimpleSelect:     "simple_select",
	ValueTypeMultiSelect:      "multi_select",
	ValueTypeTable:            "table",
}

ValueTypeName is the name of the value type

Functions

This section is empty.

Types

type AssociationTypeListOptions

type AssociationTypeListOptions struct {
	Page      int  `url:"page,omitempty"`
	Limit     int  `url:"limit,omitempty"`
	WithCount bool `url:"with_count,omitempty"`
}

AssociationTypeListOptions specifies the association type optional parameters

type Attribute

type Attribute struct {
	Links               Links             `json:"_links" mapstructure:"_links"`
	Code                string            `json:"code" mapstructure:"code"`
	Type                string            `json:"type" mapstructure:"type"`
	Labels              map[string]string `json:"labels" mapstructure:"labels"`
	Group               string            `json:"group" mapstructure:"group"`
	GroupLabels         map[string]string `json:"group_labels" mapstructure:"group_labels"`
	SortOrder           int               `json:"sort_order" mapstructure:"sort_order"`
	Localizable         bool              `json:"localizable" mapstructure:"localizable"`                       // whether the attribute is localizable or not,i.e. whether it can be translated or not
	Scopable            bool              `json:"scopable" mapstructure:"scopable"`                             // whether the attribute is scopable or not,i.e. whether it can have different values depending on the channel or not
	AvailableLocales    []string          `json:"available_locales" mapstructure:"available_locales"`           // the list of activated locales for the attribute values
	Unique              bool              `json:"unique" mapstructure:"unique"`                                 // whether the attribute value is unique or not
	UseableAsGridFilter bool              `json:"useable_as_grid_filter" mapstructure:"useable_as_grid_filter"` // whether the attribute can be used as a filter in the product grid or not
	MaxCharacters       int               `json:"max_characters" mapstructure:"max_characters"`                 // the maximum number of characters allowed for the value of the attribute
	ValidationRule      string            `json:"validation_rule" mapstructure:"validation_rule"`               // validation rule code to validate the attribute value
	ValidationRegexp    string            `json:"validation_regexp" mapstructure:"validation_regexp"`           // validation regexp to validate the attribute value
	WysiwygEnabled      bool              `json:"wysiwyg_enabled" mapstructure:"wysiwyg_enabled"`               // whether the attribute can have a value per channel or not
	NumberMin           string            `json:"number_min" mapstructure:"number_min"`                         // the minimum value allowed for the value of the attribute
	NumberMax           string            `json:"number_max" mapstructure:"number_max"`                         // the maximum value allowed for the value of the attribute
	DecimalsAllowed     bool              `json:"decimals_allowed" mapstructure:"decimals_allowed"`             // whether decimals are allowed for the attribute or not
	NegativeAllowed     bool              `json:"negative_allowed" mapstructure:"negative_allowed"`             // whether negative numbers are allowed for the attribute or not
	MetricFamily        string            `json:"metric_family" mapstructure:"metric_family"`                   // the metric family of the attribute
	DefaultMetricUnit   string            `json:"default_metric_unit" mapstructure:"default_metric_unit"`       // the default metric unit of the attribute
	DateMin             string            `json:"date_min" mapstructure:"date_min"`                             // the minimum date allowed for the value of the attribute
	DateMax             string            `json:"date_max" mapstructure:"date_max"`                             // the maximum date allowed for the value of the attribute
	AllowedExtensions   []string          `json:"allowed_extensions" mapstructure:"allowed_extensions"`         // the list of allowed extensions for the value of the attribute
	MaxFileSize         string            `json:"max_file_size" mapstructure:"max_file_size"`                   // the maximum file size allowed for the value of the attribute
	ReferenceDataName   string            `json:"reference_data_name" mapstructure:"reference_data_name"`       // the reference data name of the attribute
	DefaultValue        bool              `json:"default_value" mapstructure:"default_value"`                   // the default value of the attribute
	TableConfiguration  []string          `json:"table_configuration" mapstructure:"table_configuration"`       // the table configuration of the attribute
}

Attribute is the struct for an akeneo attribute,see: https://api.akeneo.com/api-reference.html#Attribute

type AttributeGroupListOptions

type AttributeGroupListOptions struct {
	ListOptions
}

AttributeGroupListOptions specifies the attribute group optional parameters

type AttributeListOptions

type AttributeListOptions struct {
	WithTableSelectOptions bool `url:"with_table_select_options,omitempty" json:"with_table_select_options,omitempty" mapstructure:"with_table_select_options"` // false by default,decreases performance when enabled
	ListOptions
}

AttributeListOptions specifies the attribute optional parameters

type AttributeOption

type AttributeOption struct {
	Links     Links             `json:"_links" mapstructure:"_links"`
	Code      string            `json:"code" mapstructure:"code"`
	Attribute string            `json:"attribute" mapstructure:"attribute"`
	SortOrder int               `json:"sort_order" mapstructure:"sort_order"`
	Labels    map[string]string `json:"labels" mapstructure:"labels"`
}

AttributeOption is the struct for an akeneo attribute option,see:

type AttributeOptionListOptions

type AttributeOptionListOptions struct {
	Page      int  `url:"page,omitempty"`
	Limit     int  `url:"limit,omitempty"`
	WithCount bool `url:"with_count,omitempty"`
}

AttributeOptionListOptions specifies the attribute option optional parameters

type AttributeOptionsResponse

type AttributeOptionsResponse struct {
	Links       Links                `json:"_links" mapstructure:"_links"`
	CurrentPage int                  `json:"current_page" mapstructure:"current_page"`
	Embedded    attributeOptionItems `json:"_embedded" mapstructure:"_embedded"`
}

AttributeOptionsResponse is the struct for a akeneo attribute options response

type AttributeService

type AttributeService interface {
	ListWithPagination(options any) ([]Attribute, Links, error)
	GetAttribute(code string, options any) (*Attribute, error)
	GetAttributeOptions(code string, options any) ([]AttributeOption, Links, error)
}

AttributeService is an interface for interfacing with the attribute

type AttributesResponse

type AttributesResponse struct {
	Links       Links          `json:"_links" mapstructure:"_links"`
	CurrentPage int            `json:"current_page" mapstructure:"current_page"`
	Embedded    attributeItems `json:"_embedded" mapstructure:"_embedded"`
}

AttributesResponse is the struct for a akeneo attributes response

type AuthService

type AuthService interface {
	GrantByPassword() error
	GrantByRefreshToken() error
	ShouldRefreshToken() bool
	AutoRefreshToken() error
}

AuthService is the interface to implement to authenticate to the Akeneo API

type BooleanValue

type BooleanValue struct {
	Locale string `json:"locale,omitempty" mapstructure:"locale"`
	Scope  string `json:"scope,omitempty" mapstructure:"scope"`
	Data   bool   `json:"data,omitempty" mapstructure:"data"`
}

BooleanValue is the struct for an akeneo boolean type product value pim_catalog_boolean : data is a bool

func (BooleanValue) ValueType

func (BooleanValue) ValueType() int

ValueType returns the value type, see ValueTypeConst

type CategoriesResponse

type CategoriesResponse struct {
	Links       Links         `json:"_links,omitempty" mapstructure:"_links"`
	CurrentPage int           `json:"current_page,omitempty" mapstructure:"current_page"`
	Embedded    categoryItems `json:"_embedded,omitempty" mapstructure:"_embedded"`
}

CategoriesResponse is the struct for a akeneo categories response

type Category

type Category struct {
	Links    Links                    `json:"_links" mapstructure:"_links"`
	Code     string                   `json:"code" mapstructure:"code"`
	Parent   string                   `json:"parent" mapstructure:"parent"`
	Updated  string                   `json:"updated" mapstructure:"updated"`
	Position int                      `json:"position" mapstructure:"position"` // since 7.0 with query parameter "with_positions=true"
	Labels   map[string]string        `json:"labels" mapstructure:"labels"`
	Values   map[string]categoryValue `json:"values" mapstructure:"values"`
}

Category is the struct for an akeneo category

type CategoryListOptions

type CategoryListOptions struct {
	ListOptions
	WithPosition           bool `url:"with_position,omitempty"`
	WithEnrichedAttributes bool `url:"with_enriched_attributes,omitempty"`
}

CategoryListOptions specifies the category optional parameters

type CategoryService

type CategoryService interface {
	ListWithPagination(options any) ([]Category, Links, error)
}

CategoryService is an interface for interacting with the Akeneo Category API.

type Channel

type Channel struct {
	Links           Links             `json:"_links" mapstructure:"_links"`
	Code            string            `json:"code" mapstructure:"code"`
	Currencies      []string          `json:"currencies" mapstructure:"currencies"`
	Locales         []string          `json:"locales" mapstructure:"locales"`
	CategoryTree    string            `json:"category_tree" mapstructure:"category_tree"`
	ConversionUnits map[string]string `json:"conversion_units" mapstructure:"conversion_units"`
	Labels          map[string]string `json:"labels" mapstructure:"labels"`
}

Channel is the struct for an akeneo channel

type ChannelService

type ChannelService interface {
	ListWithPagination(options any) ([]Channel, Links, error)
}

ChannelService is the interface to interact with the Akeneo Channel API

type ChannelsResponse

type ChannelsResponse struct {
	Links       Links        `json:"_links" mapstructure:"_links"`
	CurrentPage int          `json:"current_page" mapstructure:"current_page"`
	Embedded    channelItems `json:"_embedded" mapstructure:"_embedded"`
}

ChannelsResponse is the struct for an akeneo channels response

type Client

type Client struct {
	Auth      AuthService
	Product   ProductService
	Family    FamilyService
	Attribute AttributeService
	Category  CategoryService
	Channel   ChannelService
	Locale    LocaleService
	Media     MediaFileService
	// contains filtered or unexported fields
}

Client is the main struct to use to interact with the Akeneo API

func MockClient

func MockClient() *Client

func NewClient

func NewClient(con Connector, opts ...Option) (*Client, error)

NewClient creates a new Akeneo client

func (*Client) GET

func (c *Client) GET(relPath string, ops, data, result any) error

GET creates a get request and execute it result must be a pointer to a struct

func (*Client) POST

func (c *Client) POST(relPath string, ops, data, result any) error

POST creates a post request and execute it result must be a pointer to a struct

type Connector

type Connector struct {
	ClientID string `json:"client_id" mapstructure:"client_id"`
	Secret   string `json:"secret" mapstructure:"secret"`
	UserName string `json:"username" mapstructure:"username"`
	Password string `json:"password" mapstructure:"password"`
}

Connector is the struct to use to store the Akeneo connection information

func (Connector) NewClient

func (c Connector) NewClient(opts ...Option) (*Client, error)

NewClient creates a new Akeneo client

type ErrorResponse

type ErrorResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type FamiliesResponse

type FamiliesResponse struct {
	Links       Links       `json:"_links" mapstructure:"_links"`
	CurrentPage int         `json:"current_page" mapstructure:"current_page"`
	Embedded    familyItems `json:"_embedded" mapstructure:"_embedded"`
}

FamiliesResponse is the struct for a akeneo families response

type Family

type Family struct {
	Links                 Links               `json:"_links,omitempty" mapstructure:"_links"`
	Code                  string              `json:"code,omitempty" mapstructure:"code"`                                     // The code of the family
	Attributes            []string            `json:"attributes,omitempty" mapstructure:"attributes"`                         //  Attributes codes that compose the family
	AttributeAsLabel      string              `json:"attribute_as_label,omitempty" mapstructure:"attribute_as_label"`         // The code of the attribute used as label for the family
	AttributeAsImage      string              `json:"attribute_as_image,omitempty" mapstructure:"attribute_as_image"`         // Attribute code used as the main picture in the user interface (only since v2.fmt
	AttributeRequirements map[string][]string `json:"attribute_requirements,omitempty" mapstructure:"attribute_requirements"` //  • Attributes codes of the family that are required for the completeness calculation for the channel `channelCode`
	Labels                map[string]string   `json:"labels,omitempty" mapstructure:"labels"`                                 //  Translatable labels. Ex: {"en_US": "T-shirt", "fr_FR": "T-shirt"}
}

Family is the struct for an akeneo family

type FamilyListOptions

type FamilyListOptions struct {
	ListOptions
}

FamilyListOptions specifies the family optional parameters see :https://api.akeneo.com/api-reference.html#Family

type FamilyService

type FamilyService interface {
	ListWithPagination(options any) ([]Family, Links, error)
	GetFamily(familyCode string, options any) (*Family, error)
	GetFamilyVariants(familyCode string, options any) ([]FamilyVariant, error)
	GetFamilyVariant(familyCode string, familyVariantCode string) (*FamilyVariant, error)
}

FamilyService is the interface to interact with the Akeneo Family API todo: query parameters check

type FamilyVariant

type FamilyVariant struct {
	Links                Links                 `json:"_links,omitempty" mapstructure:"_links"`
	Code                 string                `json:"code,omitempty" mapstructure:"code"`                                     // The code of the family variant
	Lables               map[string]string     `json:"labels,omitempty" mapstructure:"labels"`                                 // Translatable labels. Ex: {"en_US": "T-shirt", "fr_FR": "T-shirt"}
	VariantAttributeSets []variantAttributeSet `json:"variant_attribute_sets,omitempty" mapstructure:"variant_attribute_sets"` // The variant attribute sets of the family variant
}

FamilyVariant is the struct for an akeneo family variant

type FamilyVariantListOptions

type FamilyVariantListOptions struct {
	Page      int  `url:"page,omitempty"`
	Limit     int  `url:"limit,omitempty"`
	WithCount bool `url:"with_count,omitempty"`
}

FamilyVariantListOptions specifies the family variant optional parameters see :https://api.akeneo.com/api-reference.html#FamilyVariant

type FamilyVariantsResponse

type FamilyVariantsResponse struct {
	Links       Links              `json:"_links" mapstructure:"_links"`
	CurrentPage int                `json:"current_page" mapstructure:"current_page"`
	Embedded    familyVariantItems `json:"_embedded" mapstructure:"_embedded"`
}

FamilyVariantsResponse is the struct for a akeneo family variants response

type Link struct {
	Href string `json:"href,omitempty"`
}

Link is the struct for an akeneo link

type Links struct {
	Self     Link `json:"self,omitempty"`
	First    Link `json:"first,omitempty"`
	Previous Link `json:"previous,omitempty"`
	Next     Link `json:"next,omitempty"`
	Download Link `json:"download,omitempty"`
}

Links is the struct for akeneo links

func (Links) HasNext

func (l Links) HasNext() bool

HasNext returns true if there is a next link

func (Links) NextOptions

func (l Links) NextOptions() url.Values

NextOptions returns the options for the next link

type ListOptions

type ListOptions struct {
	Search    string `url:"search,omitempty"`
	Page      int    `url:"page,omitempty"`
	Limit     int    `url:"limit,omitempty"`
	WithCount bool   `url:"with_count,omitempty"`
}

ListOptions is the struct for common list options

type Locale

type Locale struct {
	Links   Links  `json:"_links" mapstructure:"_links"`
	Code    string `json:"code" mapstructure:"code"`
	Enabled bool   `json:"enabled" mapstructure:"enabled"`
}

Locale is the struct for an akeneo locale

type LocaleService

type LocaleService interface {
	ListWithPagination(options any) ([]Locale, Links, error)
}

LocaleService is the interface to interact with the Akeneo Locale API

type LocalesResponse

type LocalesResponse struct {
	Links       Links       `json:"_links" mapstructure:"_links"`
	CurrentPage int         `json:"current_page" mapstructure:"current_page"`
	Embedded    localeItems `json:"_embedded" mapstructure:"_embedded"`
}

LocalesResponse is the struct for a akeneo locales response

type MediaFile

type MediaFile struct {
	Code             string `json:"code,omitempty" mapstructure:"code"`
	OriginalFilename string `json:"original_filename,omitempty" mapstructure:"original_filename"`
	MimeType         string `json:"mime_type,omitempty" mapstructure:"mime_type"`
	Size             int    `json:"size,omitempty" mapstructure:"size"`
	Extension        string `json:"extension,omitempty" mapstructure:"extension"`
	Links            Links  `json:"_links,omitempty" mapstructure:"_links"`
}

MediaFile is the struct for an akeneo media file

type MediaFileResponse

type MediaFileResponse struct {
	Links       Links      `json:"_links,omitempty" mapstructure:"_links"`
	CurrentPage int        `json:"current_page,omitempty" mapstructure:"current_page"`
	Embedded    mediaItems `json:"_embedded,omitempty" mapstructure:"_embedded"`
}

type MediaFileService

type MediaFileService interface {
	ListPagination(options any) ([]MediaFile, Links, error)
}

MediaFileService see: https://api.akeneo.com/api-reference.html#media-files

type MetricValue

type MetricValue struct {
	Locale string `json:"locale,omitempty" mapstructure:"locale"`
	Scope  string `json:"scope,omitempty" mapstructure:"scope"`
	Data   metric `json:"data,omitempty" mapstructure:"data"`
}

MetricValue is the struct for an akeneo metric type product value pim_catalog_metric : data amount is a float64 string when decimal is true, int when decimal is false

func (MetricValue) Amount

func (v MetricValue) Amount() string

Amount returns the amount as string

func (MetricValue) Unit

func (v MetricValue) Unit() string

Unit returns the unit as string

func (MetricValue) ValueType

func (MetricValue) ValueType() int

ValueType returns the value type, see ValueTypeConst

type MultiSelectValue

type MultiSelectValue struct {
	Locale     string                `json:"locale,omitempty" mapstructure:"locale"`
	Scope      string                `json:"scope,omitempty" mapstructure:"scope"`
	Data       []string              `json:"data,omitempty" mapstructure:"data"`
	LinkedData map[string]linkedData `json:"linked_data,omitempty" mapstructure:"linked_data"`
}

MultiSelectValue is the struct for an akeneo multi select type product value

func (MultiSelectValue) ValueType

func (MultiSelectValue) ValueType() int

ValueType returns the value type, see ValueTypeConst

type NumberValue

type NumberValue struct {
	Locale string `json:"locale,omitempty" mapstructure:"locale"`
	Scope  string `json:"scope,omitempty" mapstructure:"scope"`
	Data   int    `json:"data,omitempty" mapstructure:"data"`
}

NumberValue is the struct for an akeneo number type product value pim_catalog_number : data is an int when decimal is false ,float64 string when decimal is true so the data will be parsed as ValueTypeString when decimal is true

func (NumberValue) ValueType

func (NumberValue) ValueType() int

ValueType returns the value type, see ValueTypeConst

type Option

type Option func(*Client)

Option is client option function

func WithBaseURL

func WithBaseURL(u string) Option

WithBaseURL sets the base URL of the Akeneo API

func WithRateLimit

func WithRateLimit(limit int, t time.Duration) Option

WithRateLimit sets the rate limit of the Akeneo API

func WithVersion

func WithVersion(v int) Option

WithVersion sets the version of the Akeneo API

type PimProductValue

type PimProductValue interface {
	ValueType() int
}

type PriceValue

type PriceValue struct {
	Locale string  `json:"locale,omitempty" mapstructure:"locale"`
	Scope  string  `json:"scope,omitempty" mapstructure:"scope"`
	Data   []price `json:"data,omitempty" mapstructure:"data"`
}

PriceValue is the struct for an akeneo price type product value pim_catalog_price : data amount is a float64 string when decimal is true, int when decimal is false

func (PriceValue) Amount

func (v PriceValue) Amount(currency string) string

Amount returns the amount as string

func (PriceValue) ValueType

func (PriceValue) ValueType() int

ValueType returns the value type, see ValueTypeConst

type Product

type Product struct {
	Links                  Links                            `json:"_links,omitempty" mapstructure:"_links"`
	UUID                   string                           `json:"uuid,omitempty" mapstructure:"uuid"` // Since Akeneo 7.0
	Identifier             string                           `json:"identifier,omitempty" mapstructure:"identifier"`
	Enabled                bool                             `json:"enabled,omitempty" mapstructure:"enabled"`
	Family                 string                           `json:"family,omitempty" mapstructure:"family"`
	Categories             []string                         `json:"categories,omitempty" mapstructure:"categories"`
	Groups                 []string                         `json:"groups,omitempty" mapstructure:"groups"`
	Parent                 string                           `json:"parent,omitempty" mapstructure:"parent"` // code of the parent product model when the product is a variant
	Values                 map[string][]ProductValue        `json:"values,omitempty" mapstructure:"values"`
	Associations           map[string]association           `json:"associations,omitempty" mapstructure:"associations"`
	QuantifiedAssociations map[string]quantifiedAssociation `json:"quantified_associations,omitempty" mapstructure:"quantified_associations"` // Since Akeneo 5.0
	Created                string                           `json:"created,omitempty" mapstructure:"created"`
	Updated                string                           `json:"updated,omitempty" mapstructure:"updated"`
	QualityScores          []QualityScore                   `json:"quality_scores,omitempty" mapstructure:"quality_scores"` // Since Akeneo 5.0,WithQualityScores must be true in the request
	Completenesses         []any                            `json:"completenesses,omitempty" mapstructure:"completenesses"` // Since Akeneo 6.0,WithCompleteness must be true in the request
	Metadata               map[string]string                `json:"metadata,omitempty" mapstructure:"metadata"`             // Enterprise Edition only
}

Product is the struct for an akeneo product

type ProductListOptions

type ProductListOptions struct {
	Scope                string `url:"scope,omitempty"`
	Locales              string `url:"locales,omitempty"`
	Attributes           string `url:"attributes,omitempty"`
	PaginationType       string `url:"pagination_type,omitempty"`
	SearchAfter          string `url:"search_after,omitempty"`
	WithAttributeOptions bool   `url:"with_attribute_options,omitempty"`
	WithCompleteness     bool   `url:"with_completeness,omitempty"`
	WithQualityScores    bool   `url:"with_quality_scores,omitempty"`
	ListOptions
}

ProductListOptions specifies the product optional parameters see: https://api.akeneo.com/api-reference.html#get_products

type ProductModelListOptions

type ProductModelListOptions struct {
	Scope             string `url:"scope,omitempty"`
	Locales           string `url:"locales,omitempty"`
	Attributes        string `url:"attributes,omitempty"`
	PaginationType    string `url:"pagination_type,omitempty"`
	SearchAfter       string `url:"search_after,omitempty"`
	WithQualityScores bool   `url:"with_quality_scores,omitempty"`
	ListOptions
}

ProductModelListOptions specifies the product model optional parameters see :https://api.akeneo.com/api-reference.html#Productmodel

type ProductService

type ProductService interface {
	GetAllProducts(ctx context.Context, options any) (<-chan Product, chan error)
	ListWithPagination(options any) ([]Product, Links, error)
	GetProduct(id string, options any) (*Product, error)
}

ProductService is the interface to interact with the Akeneo Product API

type ProductValue

type ProductValue struct {
	Locale     string `json:"locale,omitempty" mapstructure:"locale"`
	Scope      string `json:"scope,omitempty" mapstructure:"scope"`
	Data       any    `json:"data,omitempty" mapstructure:"data"`
	LinkedData any    `json:"linked_data,omitempty" mapstructure:"linked_data"`
}

func (ProductValue) ParseValue

func (v ProductValue) ParseValue() (PimProductValue, error)

ParseValue tries to parse the value to correct type

type ProductsResponse

type ProductsResponse struct {
	Links       Links        `json:"_links" mapstructure:"_links"`
	CurrentPage int          `json:"current_page" mapstructure:"current_page"`
	Embedded    productItems `json:"_embedded" mapstructure:"_embedded"`
}

ProductsResponse is the struct for a akeneo products response

type QualityScore

type QualityScore struct {
	Scope  string `json:"scope,omitempty" validate:"required"`
	Locale string `json:"locale,omitempty" validate:"required"`
	Data   string `json:"data,omitempty" validate:"required"`
}

QualityScore is the struct for quality score

type SearchFilter

type SearchFilter map[string][]map[string]interface{}

SearchFilter is a map of search filters,see : https://api.akeneo.com/documentation/filter.html

func (SearchFilter) String

func (sf SearchFilter) String() string

type SimpleSelectValue

type SimpleSelectValue struct {
	Locale     string     `json:"locale,omitempty" mapstructure:"locale"`
	Scope      string     `json:"scope,omitempty" mapstructure:"scope"`
	Data       string     `json:"data,omitempty" mapstructure:"data"`
	LinkedData linkedData `json:"linked_data,omitempty" mapstructure:"linked_data"`
}

SimpleSelectValue is the struct for an akeneo simple select type product value

func (SimpleSelectValue) ValueType

func (SimpleSelectValue) ValueType() int

ValueType returns the value type, see ValueTypeConst

type StringCollectionValue

type StringCollectionValue struct {
	Locale string   `json:"locale,omitempty" mapstructure:"locale"`
	Scope  string   `json:"scope,omitempty" mapstructure:"scope"`
	Data   []string `json:"data,omitempty" mapstructure:"data"`
}

StringCollectionValue is the struct for an akeneo collection type product value

func (StringCollectionValue) ValueType

func (StringCollectionValue) ValueType() int

ValueType returns the value type, see ValueTypeConst

type StringValue

type StringValue struct {
	Locale string `json:"locale,omitempty" mapstructure:"locale"`
	Scope  string `json:"scope,omitempty" mapstructure:"scope"`
	Data   string `json:"data,omitempty" mapstructure:"data"`
}

StringValue is the struct for an akeneo text type product value pim_catalog_text or pim_catalog_textarea : data is a string pim_catalog_file or pim_catalog_image: data is the file path pim_catalog_date : data is a string in ISO-8601 format

func (StringValue) ValueType

func (StringValue) ValueType() int

ValueType returns the value type, see ValueTypeConst

type TableValue

type TableValue struct {
	Locale string `json:"locale,omitempty" mapstructure:"locale"`
	Scope  string `json:"scope,omitempty" mapstructure:"scope"`
	Data   []map[string]any
}

TableValue is the struct for an akeneo table type product value pim_catalog_table : data is a []map[string]any

func (TableValue) ValueType

func (TableValue) ValueType() int

ValueType returns the value type, see ValueTypeConst

Jump to

Keyboard shortcuts

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