unaswrappergo

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: MIT Imports: 14 Imported by: 0

README

Unas API wrapper lib for Golang

Coverage Status Go Reference

This is an unofficial API wrapper lib for Unas webshop written for Golang. The main goal is to make programming stuff using Unas API more convinient.

Contributions

Big thanks to @ondrejoa for helping me in this.

Maintenance

The largest part of the codebase was written in 2021 summer. We cannot guarantee the correct operation in case of an API update. Feel free to contribute and keep the code up to date.

Code documentation

Unas API has an often poor, so we can't figure out some minor stuff either 😕

Usable API requests

Endpoint Support
AuthwithAPIKey
AuthwithPass
GetNewsletter
SetNewsletter
GetProduct
SetProduct
GetProductDB
SetProductDB
GetOrder
SetOrder
GetStock
SetStock
GetCategory
SetCategory
GetCustomer
SetCustomer
CheckCustomer
GetScriptTag
SetScriptTag
GetPage
SetPage
GetPageContent
SetPageContent
GetStorage
SetStorage
GetProductParameter
SetProductParameter
GetAutomatism
SetAutomatism

Documentation

Index

Constants

View Source
const (
	LoginEndPoint       endpointEnumType = "https://api.unas.eu/shop/login"
	GetNewsletter       endpointEnumType = "https://api.unas.eu/shop/getNewsletter"
	SetNewsletter       endpointEnumType = "https://api.unas.eu/shop/setNewsletter"
	GetProduct          endpointEnumType = "https://api.unas.eu/shop/getProduct"
	SetProduct          endpointEnumType = "https://api.unas.eu/shop/setProduct"
	GetProductDB        endpointEnumType = "https://api.unas.eu/shop/getProductDB"
	SetProductDB        endpointEnumType = "https://api.unas.eu/shop/setProductDB"
	GetOrder            endpointEnumType = "https://api.unas.eu/shop/getOrder"
	SetOrder            endpointEnumType = "https://api.unas.eu/shop/setOrder"
	GetStock            endpointEnumType = "https://api.unas.eu/shop/getStock"
	SetStock            endpointEnumType = "https://api.unas.eu/shop/setStock"
	GetCategory         endpointEnumType = "https://api.unas.eu/shop/getCategory"
	SetCategory         endpointEnumType = "https://api.unas.eu/shop/setCategory"
	GetCustomer         endpointEnumType = "https://api.unas.eu/shop/getCustomer"
	SetCustomer         endpointEnumType = "https://api.unas.eu/shop/setCustomer"
	CheckCustomer       endpointEnumType = "https://api.unas.eu/shop/checkCustomer"
	GetScriptTag        endpointEnumType = "https://api.unas.eu/shop/getScriptTag"
	SetScriptTag        endpointEnumType = "https://api.unas.eu/shop/setScriptTag"
	GetPage             endpointEnumType = "https://api.unas.eu/shop/getPage"
	SetPage             endpointEnumType = "https://api.unas.eu/shop/setPage"
	GetPageContent      endpointEnumType = "https://api.unas.eu/shop/getPageContent"
	SetPageContent      endpointEnumType = "https://api.unas.eu/shop/setPageContent"
	GetStorage          endpointEnumType = "https://api.unas.eu/shop/getStorage"
	SetStorage          endpointEnumType = "https://api.unas.eu/shop/setStorage"
	GetProductParameter endpointEnumType = "https://api.unas.eu/shop/getProductParameter"
	SetProductParameter endpointEnumType = "https://api.unas.eu/shop/setProductParameter"
	GetAutomatism       endpointEnumType = "https://api.unas.eu/shop/getAutomatism"
	SetAutomatism       endpointEnumType = "https://api.unas.eu/shop/setAutomatism"
)
View Source
const (
	StatusBaseNotActive statusBaseEnum = iota
	StatusBaseActive
	StatusBaseActiveNew
	StatusBaseActiveNotBuyable
)
View Source
const (
	ContentTypeMinimal = "minimal"
	ContentTypeShort   = "short"
	ContentTypeNormal  = "normal"
	ContentTypeFull    = "full"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Username      string `xml:"Username"`
	PasswordCrypt string `xml:"PasswordCrypt"`
	ShopID        string `xml:"ShopId"`
	AuthCode      string `xml:"AuthCode"`
}

Auth Struct for login with user:pass

type Category added in v0.0.5

type Category struct {
	XMLName xml.Name `xml:"Category,omitempty"`
	Action  string   `xml:"Action,omitempty"`
	ID      string   `xml:"Id,omitempty"`
	History struct {
		Event struct {
			Action string `xml:"Action,omitempty"`
			Time   string `xml:"Time,omitempty"`
			ID     string `xml:"Id,omitempty"`
		} `xml:"Event"`
	} `xml:"History"`
	Name        string `xml:"Name,omitempty"`
	URL         string `xml:"Url,omitempty"`
	SefUrl      string `xml:"SefUrl,omitempty"`
	AltUrl      string `xml:"AltUrl,omitempty"`
	AltUrlBlank string `xml:"AltUrlBlank,omitempty"`
	Display     struct {
		Page string `xml:"Page,omitempty"`
		Menu string `xml:"Menu,omitempty"`
	} `xml:"Display"`
	PageLayout struct {
		ProductList  string `xml:"ProductList,omitempty"`
		CategoryList string `xml:"CategoryList,omitempty"`
	} `xml:"PageLayout"`
	Parent struct {
		ID   string `xml:"Id,omitempty"`
		Tree string `xml:"Tree,omitempty"`
	} `xml:"Parent"`
	Order    string `xml:"Order,omitempty"`
	Products struct {
		All string `xml:"All,omitempty"`
		New string `xml:"New,omitempty"`
	} `xml:"Products"`
	Texts struct {
		Top    string `xml:"Top,omitempty"`
		Bottom string `xml:"Bottom,omitempty"`
		Menu   string `xml:"Menu,omitempty"`
	} `xml:"Texts"`
	Meta struct {
		Keywords    string `xml:"Keywords,omitempty"`
		Description string `xml:"Description,omitempty"`
		Title       string `xml:"Title,omitempty"`
		Robots      string `xml:"Robots,omitempty"`
	} `xml:"Meta"`
	AutomaticMeta struct {
		Keywords    string `xml:"Keywords,omitempty"`
		Description string `xml:"Description,omitempty"`
		Title       string `xml:"Title,omitempty"`
	} `xml:"AutomaticMeta"`
	LastModTime string `xml:"LastModTime,omitempty"`
	Image       struct {
		URL string `xml:"Url,omitempty"`
		OG  string `xml:"OG,omitempty"`
	} `xml:"Image"`
	Tags []string `xml:"Tags>Tag,omitempty"`
}

type ContentParamList

type ContentParamList []string

func (ContentParamList) MarshalXML

func (contentParam ContentParamList) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*ContentParamList) UnmarshalXML

func (contentParam *ContentParamList) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type GetCategoryRequestParams added in v0.0.5

type GetCategoryRequestParams struct {
	XMLName     xml.Name       `xml:"Params"`
	ID          string         `xml:"Id,omitempty"`          // Category Unique ID
	Name        string         `xml:"Name,omitempty"`        // Category Name
	Parent      string         `xml:"Parent,omitempty"`      // Category's parent's ID
	TimeStart   *UnasTimeStamp `xml:"TimeStart,omitempty"`   // Categories modified after this timestamp
	TimeEnd     *UnasTimeStamp `xml:"TimeEnd,omitempty"`     // Categories modified before this timestamp
	DateStart   *UnasDate      `xml:"DateStart,omitempty"`   // Categories modified after this date
	DateEnd     *UnasDate      `xml:"DateEnd,omitempty"`     // Categories modified before this date
	ContentType string         `xml:"ContentType,omitempty"` // Level of details: "minimal", "normal","full"
	LimitStart  string         `xml:"LimitStart,omitempty"`  // Shift starting point of query by N items
	LimitNum    string         `xml:"LimitNum,omitempty"`    // Limit Maxmimum Category data queried overall
	History     string         `xml:"History,omitempty"`     // Log Category editing history data. "no", "yes"
}

https://unas.hu/tudastar/api/category#getcategory-keres

type GetNewsletterParams

type GetNewsletterParams struct {
	XMLName   xml.Name      `xml:"Params,omitempty"`
	Type      string        `xml:"Type,omitempty"`
	Auth      string        `xml:"Auth,omitempty"` //TODO bool
	TimeStart UnasTimeStamp `xml:"TimeStart,omitempty"`
	TimeEnd   UnasTimeStamp `xml:"TimeEnd,omitempty"`
}

GetNewsletterParams Params to set for querying newsletter subscribers https://unas.hu/tudastar/api/newsletter#getnewsletter-keres

type GetProductDBParameters

type GetProductDBParameters struct {
	Format              string `xml:"Format,omitempty"`
	Compress            string `xml:"Compress,omitempty"`
	LimitStart          string `xml:"LimitStart,omitempty"`
	LimitNum            string `xml:"LimitNum,omitempty"`
	Category            string `xml:"Category,omitempty"`
	Lang                string `xml:"Lang,omitempty"`
	GetName             string `xml:"GetName,omitempty"`
	GetStatus           string `xml:"GetStatus,omitempty"`
	GetPrice            string `xml:"GetPrice,omitempty"`
	GetPriceSale        string `xml:"GetPriceSale,omitempty"`
	GetPriceSpecial     string `xml:"GetPriceSpecial,omitempty"`
	GetCategory         string `xml:"GetCategory,omitempty"`
	GetDescriptionShort string `xml:"GetDescriptionShort,omitempty"`
	GetDescriptionLong  string `xml:"GetDescriptionLong,omitempty"`
	GetLink             string `xml:"GetLink,omitempty"`
	GetMinQty           string `xml:"GetMinQty,omitempty"`
	GetStock            string `xml:"GetStock,omitempty"`
	GetUnit             string `xml:"GetUnit,omitempty"`
	GetAlterUnit        string `xml:"GetAlterUnit,omitempty"`
	GetWeight           string `xml:"GetWeight,omitempty"`
	GetPoint            string `xml:"GetPoint,omitempty"`
	GetParam            string `xml:"GetParam,omitempty"`
	GetData             string `xml:"GetData,omitempty"`
	GetAttach           string `xml:"GetAttach,omitempty"`
	GetPack             string `xml:"GetPack,omitempty"`
	GetVariant          string `xml:"GetVariant,omitempty"`
	GetAlterCategory    string `xml:"GetAlterCategory,omitempty"`
	GetImage            string `xml:"GetImage,omitempty"`
	GetURL              string `xml:"GetURL,omitempty"`
	GetExport           string `xml:"GetExport,omitempty"`
	GetOrder            string `xml:"GetOrder,omitempty"`
	GetExplicit         string `xml:"GetExplicit,omitempty"`
	GetOnlineContent    string `xml:"GetOnlineContent,omitempty"`
	GetSEO              string `xml:"GetSeo,omitempty"`
	GetType             string `xml:"GetType,omitempty"`
	GetImageConnect     string `xml:"GetImageConnect,omitempty"`
	GetDiscount         string `xml:"GetDiscount,omitempty"`
	GetUnitStep         string `xml:"GetUnitStep,omitempty"`
	GetShipping         string `xml:"GetShipping,omitempty"`
	GetPayment          string `xml:"GetPayment,omitempty"`
	GetCustomerGroup    string `xml:"GetCustomerGroup,omitempty"`
	GetAddModDate       string `xml:"GetAddModDate,omitempty"`
	GetService          string `xml:"GetService,omitempty"`
}

GetProductDBParameters Parameters required for GetProductDB request, more info at: https://unas.hu/tudastar/api/product#getproductdb-keres

type GetProductRequestParams

type GetProductRequestParams struct {
	XMLName      xml.Name         `xml:"Params"`
	StatusBase   *statusBaseEnum  `xml:"StatusBase,omitempty"`   // termék alap státusza; 0 – nem aktív; 1 – aktív; 2 – aktív, új; 3 – aktív, nem vásárolható;
	ID           string           `xml:"Id,omitempty"`           // termék egyedi azonosítója, ha ezt megadtad, akkor az Sku értéket figyelmen kívül hagyjuk
	Sku          string           `xml:"Sku,omitempty"`          // termék cikkszáma
	Parent       string           `xml:"Parent,omitempty"`       // típus összevonás esetén ezen alap típushoz tartozó termékek listázása
	TimeStart    *UnasTimeStamp   `xml:"TimeStart,omitempty"`    // unix timestamp, ezen időpont után módosult termékek listázása
	TimeEnd      *UnasTimeStamp   `xml:"TimeEnd,omitempty"`      // unix timestamp, ezen időpont előtt módosult termékek listázása
	DateStart    *UnasDate        `xml:"DateStart,omitempty"`    // YYYY.MM.DD formátum, ezen dátum után módosult termékek listázása
	DateEnd      *UnasDate        `xml:"DateEnd,omitempty"`      // YYYY.MM.DD formátum, ezen dátum előtt módosult termékek listázása
	ContentType  string           `xml:"ContentType,omitempty"`  // azt határozhatod meg, hogy milyen adatok jelenjenek meg egy termékről, négy szint közül választhatsz: minimal - gyors adatlekérés, minimális termék adatokkal; short - szűkített lista, bővített törzsadatokkal; normal - normál lista a leggyakrabban használt adatokkal (alapértelmezett); full – teljes lista minden termék adattal (csak valódi szükség esetén használandó)
	ContentParam ContentParamList `xml:"ContentParam,omitempty"` // "full" lekérés esetén vesszővel elválasztva megadhatók paraméter azonosítók, így szűkíthető a lekérendő paraméter értékek köre
	LimitStart   string           `xml:"LimitStart,omitempty"`   // Ha nem az összes terméket szeretnéd letölteni, akkor itt adhatod meg, hogy hányadik terméktől induljon a letöltés, pozitív egész szám, csak a LimitNum paraméterrel együtt használható.
	LimitNum     string           `xml:"LimitNum,omitempty"`     // Ha nem az összes terméket szeretnéd letölteni, akkor itt adhatod meg, hogy hány termék kerüljön letöltésre.
}

type GetScriptTagParams

type GetScriptTagParams struct {
	ID string `xml:"Id,omitempty"`
}

type GetStockParams

type GetStockParams struct {
	XMLName    xml.Name `xml:"Params"`
	ID         string   `xml:"Id"`
	Sku        string   `xml:"Sku"`
	Variant1   string   `xml:"Variant1"`
	Variant2   string   `xml:"Variant2"`
	Variant3   string   `xml:"Variant3"`
	LimitStart string   `xml:"LimitStart"`
	LimitNum   string   `xml:"LimitNum"`
}

type GetStorageParams

type GetStorageParams struct {
	Type    string `xml:"Params>Type,omitempty"`    // TODO enum
	GetInfo string `xml:"Params>GetInfo,omitempty"` //TODO enum
	Folder  string `xml:"Params>Folder,omitempty"`
}

type NewsletterSubscriber

type NewsletterSubscriber struct {
	Email      string        `xml:"Email,omitempty"`
	Type       string        `xml:"Type,omitempty"`
	Time       UnasTimeStamp `xml:"Time,omitempty"`
	Name       string        `xml:"Name,omitempty"`
	Address    string        `xml:"Address,omitempty"`
	Lang       string        `xml:"Lang,omitempty"`
	Authorized string        `xml:"Authorized,omitempty"` //TODO bool
}

NewsletterSubscriber One subscriber of the newsletter

type Product

type Product struct {
	XMLName             xml.Name                       `xml:"Product"`
	Action              string                         `xml:"Action,omitempty"`
	State               string                         `xml:"State"`
	ID                  string                         `xml:"Id"`
	Sku                 string                         `xml:"Sku"`
	SkuNew              string                         `xml:"SkuNew,omitempty"`
	History             []ProductEventType             `xml:"History>Event,omitempty"`
	Statuses            []ProductStatusType            `xml:"Statuses>Status,omitempty"`
	NoList              bool                           `xml:"NoList,omitempty"`
	Inquire             bool                           `xml:"Inquire,omitempty"`
	CustDiscountDisable bool                           `xml:"CustDiscountDisable,omitempty"`
	Explicit            bool                           `xml:"Explicit,omitempty"`
	Export              *ProductExportType             `xml:"Export,omitempty"`
	PublicInterval      *ProductPublicIntervalType     `xml:"PublicInterval,omitempty"`
	Name                string                         `xml:"Name,omitempty"`
	Unit                string                         `xml:"Unit,omitempty"`
	MinimumQty          string                         `xml:"MinimumQty,omitempty"`
	MaximumQty          string                         `xml:"MaximumQty,omitempty"`
	AlertQty            *uint64                        `xml:"AlertQty,omitempty"`
	UnitStep            string                         `xml:"UnitStep,omitempty"`
	AlterUnit           *ProductAlterUnitType          `xml:"AlterUnit,omitempty"`
	Weight              *float64                       `xml:"Weight,omitempty"`
	Point               *uint64                        `xml:"Point,omitempty"`
	BuyableWithPoint    *string                        `xml:"BuyableWithPoint,omitempty"`
	Description         *ProductDescriptionType        `xml:"Description,omitempty"`
	Prices              []ProductPriceType             `xml:"Prices>Price,omitempty"`
	Categories          []ProductCategoryType          `xml:"Categories>Category,omitempty"`
	Url                 *string                        `xml:"Url,omitempty"`
	SefUrl              *string                        `xml:"SefUrl,omitempty"`
	Images              *ProductImagesType             `xml:"Images,omitempty"`
	Variants            []ProductVariantType           `xml:"Variants>Variant,omitempty"`
	Datas               []ProductDataType              `xml:"Datas>Data,omitempty"`
	Params              []ProductParamType             `xml:"Params>Param,omitempty"`
	AdditionalDatas     []ProductAdditionalDataType    `xml:"AdditionalDatas>AdditionalData"`
	PackageProduct      string                         `xml:"PackageProduct,omitempty"` // A termék csomagtermék e vagy sem
	Stocks              *ProductStocksType             `xml:"Stocks,omitempty"`
	OnlineContent       *ProductOnlineContentType      `xml:"OnlineContent,omitempty"`
	Types               *ProductTypesType              `xml:"Types,omitempty"`
	Meta                *ProductMetaType               `xml:"Meta,omitempty"`
	AutomaticMeta       *ProductAutomaticMetaType      `xml:"AutomaticMeta,omitempty"`
	QtyDiscount         *ProductQtyDiscountType        `xml:"QtyDiscount,omitempty"`
	SimilarProducts     []ProductSimilarProductType    `xml:"SimilarProducts>SimilarProduct,omitempty"`
	AdditionalProducts  []ProductAdditionalProductType `xml:"AdditionalProducts>AdditionalProduct,omitempty"`
}

type ProductAdditionalDataType

type ProductAdditionalDataType struct {
	ID      string `xml:"Id,omitempty"`
	Title   string `xml:"Title,omitempty"`
	Content string `xml:"Content,omitempty"`
}

type ProductAdditionalProductType

type ProductAdditionalProductType struct {
	ID   string `xml:"Id,omitempty"`
	Sku  string `xml:"Sku,omitempty"`
	Name string `xml:"Name,omitempty"`
}

type ProductAlterUnitType

type ProductAlterUnitType struct {
	Quantity uint64 `xml:"Qty"`
	Unit     string `xml:"Unit"`
}

type ProductAutomaticMetaType

type ProductAutomaticMetaType struct {
	Keywords    string `xml:"Keywords,omitempty"`
	Description string `xml:"Description,omitempty"`
	Title       string `xml:"Title,omitempty"`
}

type ProductCategoryType

type ProductCategoryType struct {
	Type string `xml:"Type"`
	ID   string `xml:"Id"`
	Name string `xml:"Name"`
}

type ProductDataType

type ProductDataType struct {
	Id    uint64 `xml:"Id"`
	Name  string `xml:"Name"`
	Value string `xml:"Value"`
}

type ProductDescriptionType

type ProductDescriptionType struct {
	Short string `xml:"Short"`
	Long  string `xml:"Long"`
}

type ProductEventType

type ProductEventType struct {
	Action string `xml:"Action"`
	Time   string `xml:"Time"`
	Sku    string `xml:"Sku"`
	SkuOld string `xml:"SkuOld,omitempty"`
}

type ProductExportType

type ProductExportType struct {
	Status    bool     `xml:"Status"` // Engedélyezve(1) vagy Tiltva(0)
	Forbidden []string `xml:"Forbidden>Format"`
}

type ProductImageImportType

type ProductImageImportType struct {
	Url     string `xml:"Url"`
	Encoded string `xml:"Encoded"`
}

type ProductImageType

type ProductImageType struct {
	Type     string                  `xml:"Type,omitempty"`
	Id       *uint64                 `xml:"Id,omitempty"`
	SefUrl   string                  `xml:"SefUrl,omitempty"`
	FileName string                  `xml:"FileName,omitempty"`
	Alt      string                  `xml:"Alt,omitempty"`
	Import   *ProductImageImportType `xml:"Import,omitempty"`
}

type ProductImagesType

type ProductImagesType struct {
	DefaultFilename string             `xml:"DefaultFilename,omitempty"`
	DefaultAlt      string             `xml:"DefaultAlt,omitempty"`
	Og              *uint64            `xml:"OG,omitempty"`
	Version         string             `xml:"Version,omitempty"`
	Image           []ProductImageType `xml:"Image,omitempty"`
}

type ProductMetaType

type ProductMetaType struct {
	Keywords    string `xml:"Keywords,omitempty"`
	Description string `xml:"Description,omitempty"`
	Title       string `xml:"Title,omitempty"`
}

type ProductOnlineContentType

type ProductOnlineContentType struct {
	URL      string `xml:"Url,omitempty"`
	Limit    string `xml:"Limit,omitempty"`
	Filename string `xml:"Filename,omitempty"`
}

type ProductParamType

type ProductParamType struct {
	Id     string `xml:"Id,omitempty"`
	Type   string `xml:"Type,omitempty"`
	Name   string `xml:"Name,omitempty"`
	Group  string `xml:"Group,omitempty"`
	Value  string `xml:"Value,omitempty"`
	Before string `xml:"Before,omitempty"`
	After  string `xml:"After,omitempty"`
}

type ProductPriceType

type ProductPriceType struct {
	Type      string   `xml:"Type"`
	Area      string   `xml:"Area,omitempty"`
	AreaName  string   `xml:"AreaName,omitempty"`
	Group     string   `xml:"Group,omitempty"`
	GroupName string   `xml:"GroupName,omitempty"`
	Net       float64  `xml:"Net"`
	Gross     float64  `xml:"Gross"`
	Start     *string  `xml:"Start,omitempty"` // TODO: sajat tipus
	End       *string  `xml:"End,omitempty"`   // TODO: sajat tipus
	SaleNet   *float64 `xml:"SaleNet,omitempty"`
	SaleGross *float64 `xml:"SaleGross,omitempty"`
	SaleStart *string  `xml:"SaleStart,omitempty"`
	SaleEnd   *string  `xml:"SaleEnd,omitempty"`
	Percent   *string  `xml:"Percent,omitempty"`
}

type ProductPublicIntervalType

type ProductPublicIntervalType struct {
	Start string `xml:"Start,omitempty"` // TODO: format miatt kulon tipus
	End   string `xml:"End,omitempty"`   // TODO: format miatt kulon tipus
}

type ProductQtyDiscountType

type ProductQtyDiscountType struct {
	Step []struct {
		Limit struct {
			Lower string `xml:"Lower,omitempty"`
			Upper string `xml:"Upper,omitempty"`
		} `xml:"Limit,omitempty"`
		Discount string `xml:"Discount,omitempty"`
	} `xml:"Step,omitempty"`
}

type ProductSimilarProductType

type ProductSimilarProductType struct {
	ID   string `xml:"Id,omitempty"`
	Sku  string `xml:"Sku,omitempty"`
	Name string `xml:"Name,omitempty"`
}

type ProductStatusType

type ProductStatusType struct {
	Type  string         `xml:"Type"`
	Id    string         `xml:"Id,omitempty"`
	Name  string         `xml:"Name,omitempty"`
	Value statusBaseEnum `xml:"Value"`
}

type ProductStockData added in v0.0.5

type ProductStockData struct {
	Sku   string `xml:"Sku,omitempty"`
	Stock []struct {
		Variant []string `xml:"Variants>Variant"`
		Qty     string   `xml:"Qty"`
	} `xml:"Stocks>Stock"`
}

type ProductStocksType

type ProductStocksType struct {
	Status struct {
		Active  string `xml:"Active,omitempty"`
		Empty   string `xml:"Empty,omitempty"`
		Variant string `xml:"Variant,omitempty"`
	} `xml:"Status"`
	Stock []struct {
		Variant []string `xml:"Variants>Variant,omitempty"`
		Qty     *uint64  `xml:"Qty,omitempty"`
	} `xml:"Stock,omitempty"`
}

type ProductTypesType

type ProductTypesType struct {
	Type    string `xml:"Type,omitempty"`
	Parent  string `xml:"Parent,omitempty"`
	Display string `xml:"Display,omitempty"`
	Order   string `xml:"Order,omitempty"`
}

type ProductVariantType

type ProductVariantType struct {
	Name   string                    `xml:"Name"`
	Values []ProductVariantValueType `xml:"Values>Value,omitempty"`
}

type ProductVariantValueType

type ProductVariantValueType struct {
	Name       string   `xml:"Name"`
	ExtraPrice *float64 `xml:"ExtraPrice,omitempty"`
}

type ScriptTag

type ScriptTag struct {
	Action string `xml:"Action"`
	ID     string `xml:"Id"`
	Status string `xml:"Status"`
	Dates  struct {
		Creation     UnasTimeDate `xml:"Creation"`
		Modification UnasTimeDate `xml:"Modification"`
	} `xml:"Dates"`
	Pages struct {
		Page []struct {
			ID string `xml:"Id"`
		} `xml:"Page"`
	} `xml:"Pages"`
	Type    string `xml:"Type"`
	Title   string `xml:"Title"`
	Content string `xml:"Content"`
}

type SetCategoryRequestTypes added in v0.0.5

type SetCategoryRequestTypes struct {
	XMLName xml.Name `xml:"Category"`
	ID      string   `xml:"Id,omitempty"`
	Name    string   `xml:"Name,omitempty"`
	Action  string   `xml:"Action,omitempty"`
}

type SetCategoryResponseTypes added in v0.0.5

type SetCategoryResponseTypes struct {
	XMLName xml.Name `xml:"Category"`
	ID      string   `xml:"Id"`
	Action  string   `xml:"Action"`
	Status  string   `xml:"Status"`
	Error   string   `xml:"Error"`
}

type SetNewsletterSubscriberParams

type SetNewsletterSubscriberParams struct {
	XMLName xml.Name `xml:"Params"`
	Action  string   `xml:"Action,omitempty"`
	Email   string   `xml:"Email,omitempty"`
	Name    string   `xml:"Name,omitempty"`
}

type SetNewsletterSubscriberStatus

type SetNewsletterSubscriberStatus struct {
	Action string `xml:"Action,omitempty"`
	Email  string `xml:"Email,omitempty"`
	Name   string `xml:"Name,omitempty"`
	Status string `xml:"Status,omitempty"`
}

type SetProductDBParams

type SetProductDBParams struct {
	URL     string `xml:"Url"`
	DB      string `xml:"DB"`
	DelType string `xml:"DelType"`
	Lang    string `xml:"Lang"`
}

SetProductDBParams Request params for SetProductDB request, where a URL can be set for import, more info at: https://unas.hu/tudastar/api/product#setproductdb-keres

type SetProductDBResponse

type SetProductDBResponse struct {
	ModifiedProducts uint64                     `xml:"setProductDB>Ok>Modify,omitempty"`
	AddedProducts    uint64                     `xml:"setProductDB>Ok>Add,omitempty"`
	DeletedProducts  uint64                     `xml:"setProductDB>Ok>Delete,omitempty"`
	Errors           SetProductDBResponseErrors `xml:"setProductDB>Error,omitempty"`
}

SetProductDBResponse Response from a SetProductDB request that contains logs from the result of the import, more info at: https://unas.hu/tudastar/api/product#setproductdb-valasz

type SetProductDBResponseErrors

type SetProductDBResponseErrors struct {
	UnknownColumns    uint64 `xml:"UnknownColumns,omitempty"`
	FaultyProducts    uint64 `xml:"FaultyProducts,omitempty"`
	SkuDuplicity      uint64 `xml:"SKU_Duplicity,omitempty"`
	NewProductFewData uint64 `xml:"NewProductFewData,omitempty"`
	LimitError        uint64
}

type SetScriptTagElement

type SetScriptTagElement struct {
	ID     string `xml:"ScriptTag>Id,omitempty"`
	Action string `xml:"ScriptTag>Action,omitempty"`
	Status string `xml:"ScriptTag>Status,omitempty"`
}

type SetScriptTagStatus

type SetScriptTagStatus struct {
	ID     string `xml:"Id"`
	Action string `xml:"Action"`
	Status string `xml:"Status"`
}

type SetStockParams added in v0.0.5

type SetStockParams struct {
	XMLName xml.Name `xml:"Products"`
	Product []struct {
		Action string `xml:"Action,omitempty"`
		Sku    string `xml:"Sku,omitempty"`
		Stocks struct {
			Stock []struct {
				Qty      string `xml:"Qty,omitempty"`
				Price    string `xml:"Price,omitempty"`
				Variants struct {
					Variant []string `xml:"Variant,omitempty"`
				} `xml:"Variants,omitempty"`
			} `xml:"Stock,omitempty"`
		} `xml:"Stocks,omitempty"`
	} `xml:"Product"`
}

type SetStockProductStatus added in v0.0.5

type SetStockProductStatus struct {
	ID     string `xml:"Id"`
	Sku    string `xml:"Sku"`
	Action string `xml:"Action"`
	Status string `xml:"Status"`
	Error  string `xml:"Error"`
}

type StorageItem

type StorageItem struct {
	Type        string       `xml:"Type,omitempty"`
	Name        string       `xml:"Name,omitempty"`
	ActualSpace string       `xml:"ActualSpace,omitempty"` //TODO type
	SpaceLimit  string       `xml:"SpaceLimit,omitempty"`  //TODO type
	ModifyDate  UnasTimeDate `xml:"ModifyDate,omitempty"`
	FileType    string       `xml:"FileType,omitempty"` //TODO file extension type?
	Path        string       `xml:"Path,omitempty"`
}

type UnasDate

type UnasDate time.Time

UnasDate YYYY.MM.DD Date format

func (UnasDate) MarshalXML

func (date UnasDate) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*UnasDate) ToTime

func (date *UnasDate) ToTime() *time.Time

func (*UnasDate) UnmarshalXML

func (date *UnasDate) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type UnasObject

type UnasObject struct {
	Login login
}

func AuthwithAPIKey

func AuthwithAPIKey(apikey string) (*UnasObject, error)

AuthwithAPIKey Authenticating using an API key. https://unas.hu/tudastar/api/authorization#api-kulcs-alapu-azonositas

func AuthwithPass

func AuthwithPass(a Auth) (*UnasObject, error)

func (*UnasObject) CheckCustomer

func (uo *UnasObject) CheckCustomer(user *string, password *string) (*bool, error)

func (*UnasObject) GetCategory added in v0.0.5

func (uo *UnasObject) GetCategory(params *GetCategoryRequestParams) ([]*Category, error)

func (UnasObject) GetNewsletter

func (uo UnasObject) GetNewsletter(params *GetNewsletterParams) ([]*NewsletterSubscriber, error)

GetNewsletter Queries newsletter subscribers of the webshop https://unas.hu/tudastar/api/newsletter#getnewsletter-funkcio

func (*UnasObject) GetProduct

func (uo *UnasObject) GetProduct(p *GetProductRequestParams) ([]*Product, error)

func (UnasObject) GetProductDB

func (uo UnasObject) GetProductDB(params *GetProductDBParameters) (*url.URL, error)

GetProductDB Returns an url where all the products can be downloaded in a .csv file, the link expires after 1 hour more info at: https://unas.hu/tudastar/api/product#getproductdb-funkcio

func (*UnasObject) GetProductParallel added in v0.0.5

func (uo *UnasObject) GetProductParallel(p *GetProductRequestParams, chunkSize uint32, allProductNumber uint32) ([]*Product, error)

func (UnasObject) GetScriptTag

func (uo UnasObject) GetScriptTag(Params *GetScriptTagParams) ([]*ScriptTag, error)

func (*UnasObject) GetStorage

func (uo *UnasObject) GetStorage(params *GetStorageParams) ([]*StorageItem, error)

func (*UnasObject) SetCategory added in v0.0.5

func (uo *UnasObject) SetCategory(params []*SetCategoryRequestTypes) ([]*SetCategoryResponseTypes, error)

func (UnasObject) SetNewsletter

func (uo UnasObject) SetNewsletter(subscribers []*SetNewsletterSubscriberParams) ([]*SetNewsletterSubscriberStatus, error)

SetNewsletter Add/Modify/Delete data of newsletter subscribers https://unas.hu/tudastar/api/newsletter#setnewsletter-funkcio

func (*UnasObject) SetProduct

func (uo *UnasObject) SetProduct(products []*Product) ([]*productStatus, error)

func (UnasObject) SetProductDB

func (uo UnasObject) SetProductDB(params *SetProductDBParams) (*SetProductDBResponse, error)

SetProductDB Importing a csv? from an url into the webshop database, more info at: https://unas.hu/tudastar/api/product#setproductdb-funkcio

type UnasTimeDate

type UnasTimeDate time.Time

UnasTimeDate UnasDate YYYY.MM.DD HH:MM:SS TimeDate format

func (UnasTimeDate) MarshalXML

func (timedate UnasTimeDate) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*UnasTimeDate) ToTime

func (timedate *UnasTimeDate) ToTime() *time.Time

func (*UnasTimeDate) UnmarshalXML

func (timedate *UnasTimeDate) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type UnasTimeStamp

type UnasTimeStamp time.Time

UnasTimeStamp Unix timestamp format

func (UnasTimeStamp) MarhsalXML

func (timestamp UnasTimeStamp) MarhsalXML(e *xml.Encoder, start xml.StartElement) error

func (*UnasTimeStamp) ToTime

func (timestamp *UnasTimeStamp) ToTime() *time.Time

func (*UnasTimeStamp) UnmarshalXML

func (timestamp *UnasTimeStamp) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

Jump to

Keyboard shortcuts

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