mirror of
https://github.com/cubixle/go-ebay.git
synced 2026-04-24 23:04:44 +01:00
some small changes
This commit is contained in:
199
commands/add_fixed_price_item.go
Normal file
199
commands/add_fixed_price_item.go
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
package commands
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/xml"
|
||||||
|
|
||||||
|
"github.com/cubixle2/go-ebay/config"
|
||||||
|
"github.com/cubixle2/go-ebay/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewAddFixedPriceItemRequest(cfg *config.Config, item *types.Item) *AddFixedPriceItemRequest {
|
||||||
|
// condition is always new (for now).
|
||||||
|
item.ConditionID = 1000
|
||||||
|
item.Country = "GB"
|
||||||
|
item.Currency = "GBP"
|
||||||
|
item.Site = "UK"
|
||||||
|
item.PaymentMethods = types.BuyerPaymentMethodCodeTypePayPal
|
||||||
|
item.HitCounter = "NoHitCounter"
|
||||||
|
item.ListingType = types.ListingTypeCodeTypeFixedPriceItem
|
||||||
|
|
||||||
|
return &AddFixedPriceItemRequest{
|
||||||
|
Item: *item,
|
||||||
|
RequesterCredentials: RequesterCredentials{
|
||||||
|
EBayAuthToken: cfg.AuthToken,
|
||||||
|
},
|
||||||
|
Xmlns: "urn:ebay:apis:eBLBaseComponents",
|
||||||
|
DetailLevel: "ItemReturnDescription",
|
||||||
|
Version: "837",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type AddFixedPriceItemRequest struct {
|
||||||
|
Item types.Item `xml:"Item"`
|
||||||
|
Xmlns string `xml:"xmlns,attr"`
|
||||||
|
RequesterCredentials RequesterCredentials `xml:"RequesterCredentials"`
|
||||||
|
DetailLevel string
|
||||||
|
Version string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c AddFixedPriceItemRequest) CallName() string {
|
||||||
|
return "AddFixedPriceItem"
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRequestBody returns bytes
|
||||||
|
func (c AddFixedPriceItemRequest) GetRequestBody() []byte {
|
||||||
|
body, _ := xml.Marshal(c)
|
||||||
|
return body
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c AddFixedPriceItemRequest) SetToken(token string) {
|
||||||
|
c.RequesterCredentials.EBayAuthToken = token
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddFixedPriceItemResponse was generated 2018-09-11 14:04:26 by lukerodham on Lukes-MacBook-Pro.local.
|
||||||
|
type AddFixedPriceItemResponse struct {
|
||||||
|
XMLName xml.Name `xml:"AddFixedPriceItemResponse"`
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
Xmlns string `xml:"xmlns,attr"`
|
||||||
|
Category2ID struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"Category2ID"`
|
||||||
|
CategoryID struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"CategoryID"`
|
||||||
|
DiscountReason struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"DiscountReason"`
|
||||||
|
EndTime struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"EndTime"`
|
||||||
|
Fees struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
Fee struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
Fee struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
CurrencyID string `xml:"currencyID,attr"`
|
||||||
|
} `xml:"Fee"`
|
||||||
|
Name struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"Name"`
|
||||||
|
PromotionalDiscount struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
CurrencyID string `xml:"currencyID,attr"`
|
||||||
|
} `xml:"PromotionalDiscount"`
|
||||||
|
} `xml:"Fee"`
|
||||||
|
} `xml:"Fees"`
|
||||||
|
ItemID struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"ItemID"`
|
||||||
|
ListingRecommendations struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
Recommendation struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
Code struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"Code"`
|
||||||
|
FieldName struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"FieldName"`
|
||||||
|
Group struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"Group"`
|
||||||
|
Message struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"Message"`
|
||||||
|
Metadata struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
Name struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"Name"`
|
||||||
|
Value struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"Value"`
|
||||||
|
} `xml:"Metadata"`
|
||||||
|
Type struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"Type"`
|
||||||
|
Value struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"Value"`
|
||||||
|
} `xml:"Recommendation"`
|
||||||
|
} `xml:"ListingRecommendations"`
|
||||||
|
ProductSuggestions struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
ProductSuggestion struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
EPID struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"EPID"`
|
||||||
|
Recommended struct {
|
||||||
|
Text bool `xml:",chardata"`
|
||||||
|
} `xml:"Recommended"`
|
||||||
|
StockPhoto struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"StockPhoto"`
|
||||||
|
Title struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"Title"`
|
||||||
|
} `xml:"ProductSuggestion"`
|
||||||
|
} `xml:"ProductSuggestions"`
|
||||||
|
SKU struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"SKU"`
|
||||||
|
StartTime struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"StartTime"`
|
||||||
|
Ack struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"Ack"`
|
||||||
|
Build struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"Build"`
|
||||||
|
CorrelationID struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"CorrelationID"`
|
||||||
|
DuplicateInvocationDetails struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
Status struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"Status"`
|
||||||
|
} `xml:"DuplicateInvocationDetails"`
|
||||||
|
Errors struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
ErrorClassification struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"ErrorClassification"`
|
||||||
|
ErrorCode struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"ErrorCode"`
|
||||||
|
ErrorParameters struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
ParamID string `xml:"ParamID,attr"`
|
||||||
|
Value struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"Value"`
|
||||||
|
} `xml:"ErrorParameters"`
|
||||||
|
LongMessage struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"LongMessage"`
|
||||||
|
SeverityCode struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"SeverityCode"`
|
||||||
|
ShortMessage struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"ShortMessage"`
|
||||||
|
} `xml:"Errors"`
|
||||||
|
HardExpirationWarning struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"HardExpirationWarning"`
|
||||||
|
Message struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"Message"`
|
||||||
|
Timestamp struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"Timestamp"`
|
||||||
|
Version struct {
|
||||||
|
Text string `xml:",chardata"`
|
||||||
|
} `xml:"Version"`
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ package commands
|
|||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
|
||||||
"github.com/cubixle/go-ebay/config"
|
"github.com/cubixle2/go-ebay/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewGetItemRequest(cfg *config.Config, itemID string) *GetItemRequest {
|
func NewGetItemRequest(cfg *config.Config, itemID string) *GetItemRequest {
|
||||||
@@ -53,6 +53,9 @@ type ItemResponse struct {
|
|||||||
Quantity int `xml:"Quantity"`
|
Quantity int `xml:"Quantity"`
|
||||||
SellingStatus SellingStatus `xml:"SellingStatus"`
|
SellingStatus SellingStatus `xml:"SellingStatus"`
|
||||||
ProductListingDetails ProductListingDetails `xml:"ProductListingDetails"`
|
ProductListingDetails ProductListingDetails `xml:"ProductListingDetails"`
|
||||||
|
ConditionID int `xml:"ConditionID"`
|
||||||
|
Country string `xml:"country"`
|
||||||
|
Currency string `xml:"Currency"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PictureDetails struct {
|
type PictureDetails struct {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package commands
|
|||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
|
||||||
"github.com/cubixle/go-ebay/config"
|
"github.com/cubixle2/go-ebay/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewGetMyEbaySelling(cfg *config.Config, version string, pageNumber string, perPage string) *GetMyeBaySellingRequest {
|
func NewGetMyEbaySelling(cfg *config.Config, version string, pageNumber string, perPage string) *GetMyeBaySellingRequest {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package commands
|
|||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
|
||||||
"github.com/cubixle/go-ebay/config"
|
"github.com/cubixle2/go-ebay/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewGetOrdersRequest returns struct
|
// NewGetOrdersRequest returns struct
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ package commands
|
|||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
|
||||||
"github.com/cubixle/go-ebay/config"
|
"github.com/cubixle2/go-ebay/config"
|
||||||
|
"github.com/cubixle2/go-ebay/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewReviseItemRequest(cfg *config.Config, item ItemResponse) *ReviseItemRequest {
|
func NewReviseItemRequest(cfg *config.Config, item *types.Item) *ReviseItemRequest {
|
||||||
return &ReviseItemRequest{
|
return &ReviseItemRequest{
|
||||||
Item: item,
|
Item: item,
|
||||||
RequesterCredentials: RequesterCredentials{
|
RequesterCredentials: RequesterCredentials{
|
||||||
@@ -17,7 +18,7 @@ func NewReviseItemRequest(cfg *config.Config, item ItemResponse) *ReviseItemRequ
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ReviseItemRequest struct {
|
type ReviseItemRequest struct {
|
||||||
Item ItemResponse
|
Item *types.Item `xml:"Item"`
|
||||||
Xmlns string `xml:"xmlns,attr"`
|
Xmlns string `xml:"xmlns,attr"`
|
||||||
RequesterCredentials RequesterCredentials `xml:"RequesterCredentials"`
|
RequesterCredentials RequesterCredentials `xml:"RequesterCredentials"`
|
||||||
}
|
}
|
||||||
|
|||||||
6
ebay.go
6
ebay.go
@@ -21,7 +21,7 @@ func execute(request *Request) ([]byte, error) {
|
|||||||
xmlBody := []byte("<?xml version=\"1.0\" encoding=\"utf-8\"?>")
|
xmlBody := []byte("<?xml version=\"1.0\" encoding=\"utf-8\"?>")
|
||||||
xmlBody = append(xmlBody, request.Command.GetRequestBody()...)
|
xmlBody = append(xmlBody, request.Command.GetRequestBody()...)
|
||||||
body := bytes.NewReader(xmlBody)
|
body := bytes.NewReader(xmlBody)
|
||||||
|
// panic(string(xmlBody))
|
||||||
req, _ := http.NewRequest(
|
req, _ := http.NewRequest(
|
||||||
"POST",
|
"POST",
|
||||||
fmt.Sprintf("%s/ws/api.dll", config.BaseUrl),
|
fmt.Sprintf("%s/ws/api.dll", config.BaseUrl),
|
||||||
@@ -50,6 +50,10 @@ func execute(request *Request) ([]byte, error) {
|
|||||||
return []byte{}, fmt.Errorf("<%d> - %s", resp.StatusCode, rspBody)
|
return []byte{}, fmt.Errorf("<%d> - %s", resp.StatusCode, rspBody)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reqBody, _ := ioutil.ReadAll(resp.Request.Body)
|
||||||
|
|
||||||
|
log.Println(string(reqBody))
|
||||||
|
|
||||||
rspBody, _ := ioutil.ReadAll(resp.Body)
|
rspBody, _ := ioutil.ReadAll(resp.Body)
|
||||||
|
|
||||||
return rspBody, nil
|
return rspBody, nil
|
||||||
|
|||||||
70
fixtures/add-fixed-price-item-response.xml
Normal file
70
fixtures/add-fixed-price-item-response.xml
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<AddFixedPriceItemResponse xmlns="urn:ebay:apis:eBLBaseComponents">
|
||||||
|
<!-- Call-specific Output Fields -->
|
||||||
|
<Category2ID> string </Category2ID>
|
||||||
|
<CategoryID> string </CategoryID>
|
||||||
|
<DiscountReason> DiscountReasonCodeType </DiscountReason>
|
||||||
|
<!-- ... more DiscountReason values allowed here ... -->
|
||||||
|
<EndTime> dateTime </EndTime>
|
||||||
|
<Fees> FeesType
|
||||||
|
<Fee> FeeType
|
||||||
|
<Fee currencyID="CurrencyCodeType"> AmountType (double) </Fee>
|
||||||
|
<Name> string </Name>
|
||||||
|
<PromotionalDiscount currencyID="CurrencyCodeType"> AmountType (double) </PromotionalDiscount>
|
||||||
|
</Fee>
|
||||||
|
<!-- ... more Fee nodes allowed here ... -->
|
||||||
|
</Fees>
|
||||||
|
<ItemID> ItemIDType (string) </ItemID>
|
||||||
|
<ListingRecommendations> ListingRecommendationsType
|
||||||
|
<Recommendation> ListingRecommendationType
|
||||||
|
<Code> string </Code>
|
||||||
|
<FieldName> string </FieldName>
|
||||||
|
<Group> string </Group>
|
||||||
|
<Message> string </Message>
|
||||||
|
<Metadata> MetadataType
|
||||||
|
<Name> string </Name>
|
||||||
|
<Value> string </Value>
|
||||||
|
<!-- ... more Value values allowed here ... -->
|
||||||
|
</Metadata>
|
||||||
|
<!-- ... more Metadata nodes allowed here ... -->
|
||||||
|
<Type> string </Type>
|
||||||
|
<Value> string </Value>
|
||||||
|
<!-- ... more Value values allowed here ... -->
|
||||||
|
</Recommendation>
|
||||||
|
<!-- ... more Recommendation nodes allowed here ... -->
|
||||||
|
</ListingRecommendations>
|
||||||
|
<ProductSuggestions> ProductSuggestionsType
|
||||||
|
<ProductSuggestion> ProductSuggestionType
|
||||||
|
<EPID> string </EPID>
|
||||||
|
<Recommended> boolean </Recommended>
|
||||||
|
<StockPhoto> string </StockPhoto>
|
||||||
|
<Title> string </Title>
|
||||||
|
</ProductSuggestion>
|
||||||
|
<!-- ... more ProductSuggestion nodes allowed here ... -->
|
||||||
|
</ProductSuggestions>
|
||||||
|
<SKU> SKUType (string) </SKU>
|
||||||
|
<StartTime> dateTime </StartTime>
|
||||||
|
<!-- Standard Output Fields -->
|
||||||
|
<Ack> AckCodeType </Ack>
|
||||||
|
<Build> string </Build>
|
||||||
|
<CorrelationID> string </CorrelationID>
|
||||||
|
<DuplicateInvocationDetails> DuplicateInvocationDetailsType
|
||||||
|
<Status> InvocationStatusType </Status>
|
||||||
|
</DuplicateInvocationDetails>
|
||||||
|
<Errors> ErrorType
|
||||||
|
<ErrorClassification> ErrorClassificationCodeType </ErrorClassification>
|
||||||
|
<ErrorCode> token </ErrorCode>
|
||||||
|
<ErrorParameters ParamID="string"> ErrorParameterType
|
||||||
|
<Value> string </Value>
|
||||||
|
</ErrorParameters>
|
||||||
|
<!-- ... more ErrorParameters nodes allowed here ... -->
|
||||||
|
<LongMessage> string </LongMessage>
|
||||||
|
<SeverityCode> SeverityCodeType </SeverityCode>
|
||||||
|
<ShortMessage> string </ShortMessage>
|
||||||
|
</Errors>
|
||||||
|
<!-- ... more Errors nodes allowed here ... -->
|
||||||
|
<HardExpirationWarning> string </HardExpirationWarning>
|
||||||
|
<Message> string </Message>
|
||||||
|
<Timestamp> dateTime </Timestamp>
|
||||||
|
<Version> string </Version>
|
||||||
|
</AddFixedPriceItemResponse>
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package ebay
|
package ebay
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/cubixle/go-ebay/commands"
|
"github.com/cubixle2/go-ebay/commands"
|
||||||
"github.com/cubixle/go-ebay/config"
|
"github.com/cubixle2/go-ebay/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
const xmlns = "urn:ebay:apis:eBLBaseComponents"
|
const xmlns = "urn:ebay:apis:eBLBaseComponents"
|
||||||
|
|||||||
61
types/enums.go
Normal file
61
types/enums.go
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
const (
|
||||||
|
PeriodCodeCustom string = "CustomCode"
|
||||||
|
PeriodCodeDays1 string = "Days_1"
|
||||||
|
PeriodCodeDays180 string = "Days_180"
|
||||||
|
PeriodCodeDays30 string = "Days_30"
|
||||||
|
PeriodCodeDays360 string = "Days_360"
|
||||||
|
PeriodCodeDays540 string = "Days_540"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
HitCountCodeTypeBasicStyle string = "BasicStyle"
|
||||||
|
HitCountCodeTypeCustomCode string = "CustomCode"
|
||||||
|
HitCountCodeTypeGreenLED string = "GreenLED"
|
||||||
|
HitCountCodeTypeHidden string = "Hidden"
|
||||||
|
HitCountCodeTypeHiddenStyle string = "HiddenStyle"
|
||||||
|
HitCountCodeTypeHonestyStyle string = "HonestyStyle"
|
||||||
|
HitCountCodeTypeNoHitCounter string = "NoHitCounter"
|
||||||
|
HitCountCodeTypeRetroStyle string = "RetroStyle"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
InventoryTrackingMethodCodeTypeCustomCode string = "CustomCode"
|
||||||
|
InventoryTrackingMethodCodeTypeItemID string = "ItemID"
|
||||||
|
InventoryTrackingMethodCodeTypeSKU string = "SKU"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
ListingEnhancementsCodeTypeBoldTitle string = "BoldTitle"
|
||||||
|
ListingEnhancementsCodeTypeCustomCode string = "CustomCode"
|
||||||
|
ListingEnhancementsCodeTypeHomePageFeatured string = "HomePageFeatured"
|
||||||
|
ListingEnhancementsCodeTypeValuePackBundle string = "ValuePackBundle"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
ListingTypeCodeTypeAdType string = "AdType"
|
||||||
|
ListingTypeCodeTypeAuction string = "Auction"
|
||||||
|
ListingTypeCodeTypeChinese string = "Chinese"
|
||||||
|
ListingTypeCodeTypeCustomCode string = "CustomCode"
|
||||||
|
ListingTypeCodeTypeFixedPriceItem string = "FixedPriceItem"
|
||||||
|
ListingTypeCodeTypeLeadGeneration string = "LeadGeneration"
|
||||||
|
ListingTypeCodeTypePersonalOffer string = "PersonalOffer"
|
||||||
|
ListingTypeCodeTypeUnkown string = "Unkown"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
BuyerPaymentMethodCodeTypePayPal string = "PayPal"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
ShippingTypeCodeTypeCalculated string = "Calculated"
|
||||||
|
ShippingTypeCodeTypeCalculatedDomesticFlatInternational string = "CalculatedDomesticFlatInternational"
|
||||||
|
ShippingTypeCodeTypeCustomCode string = "CustomCode"
|
||||||
|
ShippingTypeCodeTypeFlat string = "Flat"
|
||||||
|
ShippingTypeCodeTypeFlatDomesticCalculatedInternational string = "FlatDomesticCalculatedInternational"
|
||||||
|
ShippingTypeCodeTypeFree string = "Free"
|
||||||
|
ShippingTypeCodeTypeFreight string = "Freight"
|
||||||
|
ShippingTypeCodeTypeFreightFlat string = "FreightFlat"
|
||||||
|
ShippingTypeCodeTypeNotSpecified string = "NotSpecified"
|
||||||
|
)
|
||||||
366
types/types.go
Normal file
366
types/types.go
Normal file
@@ -0,0 +1,366 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type Item struct {
|
||||||
|
AutoPay bool
|
||||||
|
|
||||||
|
BestOfferDetails BestOfferDetails `xml:"BestOfferDetails"`
|
||||||
|
|
||||||
|
BuyerRequirementDetails *BuyerRequirementDetails `xml:"BuyerRequirementDetails,omitempty"`
|
||||||
|
CategoryBasedAttributesPrefill bool `xml:"CategoryBasedAttributesPrefill"`
|
||||||
|
CategoryMappingAllowed bool `xml:"CategoryMappingAllowed"`
|
||||||
|
Charity *Charity `xml:"Charity,omitempty"`
|
||||||
|
ConditionDescription string `xml:"ConditionDescription,omitempty"`
|
||||||
|
ConditionID int `xml:"ConditionID,omitempty"`
|
||||||
|
Country string `xml:"Country,omitempty"`
|
||||||
|
CrossBorderTrade string `xml:"CrossBorderTrade,omitempty"`
|
||||||
|
Currency string `xml:"Currency,omitempty"`
|
||||||
|
Description string `xml:"Description,omitempty"`
|
||||||
|
|
||||||
|
DigitalGoodInfo struct {
|
||||||
|
DigitalDelivery bool `xml:"DigitalDelivery"`
|
||||||
|
} `xml:"DigitalGoodInfo"`
|
||||||
|
|
||||||
|
DisableBuyerRequirements bool `xml:"DisableBuyerRequirements"`
|
||||||
|
DiscountPriceInfo *DiscountPriceInfo `xml:"DiscountPriceInfo"`
|
||||||
|
|
||||||
|
DispatchTimeMax int `xml:"DispatchTimeMax"`
|
||||||
|
EBayNowEligible bool `xml:"eBayNowEligible"`
|
||||||
|
EBayPlus bool `xml:"eBayPlus"`
|
||||||
|
HitCounter string `xml:"HitCounter,omitempty"`
|
||||||
|
IncludeRecommendations bool `xml:"IncludeRecommendations"`
|
||||||
|
InventoryTrackingMethod string `xml:"InventoryTrackingMethod,omitempty"`
|
||||||
|
|
||||||
|
ItemCompatibilityList *struct {
|
||||||
|
Compatibility struct {
|
||||||
|
CompatibilityNotes string `xml:"CompatibilityNotes"`
|
||||||
|
NameValueList []struct {
|
||||||
|
Name string `xml:"Name"`
|
||||||
|
Value string `xml:"Value"`
|
||||||
|
} `xml:"NameValueList"`
|
||||||
|
} `xml:"Compatibility"`
|
||||||
|
} `xml:"ItemCompatibilityList,omitempty"`
|
||||||
|
|
||||||
|
ItemSpecifics ItemSpecifics `xml:"ItemSpecifics"`
|
||||||
|
|
||||||
|
ListingDesigner *struct {
|
||||||
|
LayoutID int `xml:"LayoutID"`
|
||||||
|
OptimalPictureSize bool `xml:"OptimalPictureSize"`
|
||||||
|
ThemeID int `xml:"ThemeID"`
|
||||||
|
} `xml:"ListingDesigner,omitempty"`
|
||||||
|
|
||||||
|
ListingDetails *struct {
|
||||||
|
BestOfferAutoAcceptPrice float32 `xml:"BestOfferAutoAcceptPrice"`
|
||||||
|
LocalListingDistance string `xml:"LocalListingDistance"`
|
||||||
|
MinimumBestOfferPrice float32 `xml:"MinimumBestOfferPrice"`
|
||||||
|
} `xml:"ListingDetails,omitempty"`
|
||||||
|
|
||||||
|
ListingDuration string `xml:"ListingDuration,omitempty"`
|
||||||
|
ListingEnhancement string `xml:"ListingEnhancement,omitempty"`
|
||||||
|
ListingType string `xml:"ListingType,omitempty"`
|
||||||
|
Location string `xml:"Location,omitempty"`
|
||||||
|
|
||||||
|
PaymentMethods string `xml:"PaymentMethods,omitempty"`
|
||||||
|
PayPalEmailAddress string `xml:"PayPalEmailAddress"`
|
||||||
|
PickupInStoreDetails struct {
|
||||||
|
EligibleForPickupInStore bool `xml:"EligibleForPickupInStore"`
|
||||||
|
} `xml:"PickupInStoreDetails"`
|
||||||
|
|
||||||
|
PictureDetails PictureDetails `xml:"PictureDetails"`
|
||||||
|
|
||||||
|
PostalCode string `xml:"PostalCode"`
|
||||||
|
PrimaryCategory CategoryID `xml:"PrimaryCategory"`
|
||||||
|
PrivateNotes string `xml:"PrivateNotes,omitempty"`
|
||||||
|
ProductListingDetails ProductListingDetails `xml:"ProductListingDetails"`
|
||||||
|
Quantity int `xml:"Quantity"`
|
||||||
|
|
||||||
|
QuantityInfo *struct {
|
||||||
|
MinimumRemnantSet int `xml:"MinimumRemnantSet"`
|
||||||
|
} `xml:"QuantityInfo,omitempty"`
|
||||||
|
|
||||||
|
QuantityRestrictionPerBuyer *struct {
|
||||||
|
MaximumQuantity int `xml:"MaximumQuantity"`
|
||||||
|
} `xml:"QuantityRestrictionPerBuyer,omitempty"`
|
||||||
|
|
||||||
|
ReturnPolicy *ReturnPolicy `xml:"ReturnPolicy,omitempty"`
|
||||||
|
|
||||||
|
ScheduleTime *time.Time `xml:"ScheduleTime,omitempty"`
|
||||||
|
SecondaryCategory *CategoryID `xml:"SecondaryCategory,omitempty"`
|
||||||
|
SellerProfiles *struct {
|
||||||
|
SellerPaymentProfile struct {
|
||||||
|
PaymentProfileID int64 `xml:"PaymentProfileID"`
|
||||||
|
PaymentProfileName string `xml:"PaymentProfileName"`
|
||||||
|
} `xml:"SellerPaymentProfile"`
|
||||||
|
SellerReturnProfile struct {
|
||||||
|
ReturnProfileID int64 `xml:"ReturnProfileID"`
|
||||||
|
ReturnProfileName string `xml:"ReturnProfileName"`
|
||||||
|
} `xml:"SellerReturnProfile"`
|
||||||
|
SellerShippingProfile struct {
|
||||||
|
ShippingProfileID int64 `xml:"ShippingProfileID"`
|
||||||
|
ShippingProfileName string `xml:"ShippingProfileName"`
|
||||||
|
} `xml:"SellerShippingProfile"`
|
||||||
|
} `xml:"SellerProfiles,omitempty"`
|
||||||
|
|
||||||
|
SellerProvidedTitle string `xml:"SellerProvidedTitle,omitempty"`
|
||||||
|
ShippingDetails *ShippingDetails `xml:"ShippingDetails"`
|
||||||
|
ShippingPackageDetails *ShippingPackageDetails `xml:"ShippingPackageDetails,omitempty"`
|
||||||
|
ShippingServiceCostOverrideList *ShippingServiceCostOverrideList `xml:"ShippingServiceCostOverrideList,omitempty"`
|
||||||
|
ShippingTermsInDescription bool `xml:"ShippingTermsInDescription"`
|
||||||
|
ShipToLocations string `xml:"ShipToLocations"`
|
||||||
|
Site string `xml:"Site"` // https://developer.ebay.com/devzone/xml/docs/reference/ebay/types/SiteCodeType.html
|
||||||
|
SKU string `xml:"SKU"`
|
||||||
|
StartPrice float32 `xml:"StartPrice,omitempty"`
|
||||||
|
Storefront *StoreFront `xml:"Storefront,omitempty"`
|
||||||
|
SubTitle string `xml:"SubTitle,omitempty"`
|
||||||
|
TaxCategory string `xml:"TaxCategory,omitempty"`
|
||||||
|
Title string `xml:"Title"`
|
||||||
|
UseTaxTable bool `xml:"UseTaxTable,omitempty"`
|
||||||
|
UUID string `xml:"UUID,omitempty"`
|
||||||
|
Variations *Variations `xml:"Variations,omitempty"`
|
||||||
|
VATDetails *VATDetails `xml:"VATDetails,omitempty"`
|
||||||
|
VIN string `xml:"VIN,omitempty"`
|
||||||
|
VRM string `xml:"VRM,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ShippingDetails struct {
|
||||||
|
CalculatedShippingRate *struct {
|
||||||
|
InternationalPackagingHandlingCosts float32 `xml:"InternationalPackagingHandlingCosts,omitempty"`
|
||||||
|
MeasurementUnit string `xml:"MeasurementUnit,omitempty"` // English/Metric MeasurementSystemCodeType
|
||||||
|
OriginatingPostalCode string `xml:"OriginatingPostalCode"`
|
||||||
|
PackagingHandlingCosts float32 `xml:"PackagingHandlingCosts"`
|
||||||
|
ShippingIrregular bool `xml:"ShippingIrregular"`
|
||||||
|
} `xml:"CalculatedShippingRate,omitempty"`
|
||||||
|
|
||||||
|
CODCost float32 `xml:"CODCost"`
|
||||||
|
ExcludeShipToLocation string `xml:"ExcludeShipToLocation,omitempty"`
|
||||||
|
|
||||||
|
GlobalShipping bool `xml:"GlobalShipping"`
|
||||||
|
InternationalPromotionalShippingDiscount bool `xml:"InternationalPromotionalShippingDiscount,omitempty"`
|
||||||
|
InternationalShippingDiscountProfileID string `xml:"InternationalShippingDiscountProfileID,omitempty"`
|
||||||
|
InternationalShippingServiceOption *struct {
|
||||||
|
ShippingService string `xml:"ShippingService"`
|
||||||
|
ShippingServiceAdditionalCost float32 `xml:"ShippingServiceAdditionalCost"`
|
||||||
|
ShippingServiceCost float32 `xml:"ShippingServiceCost"`
|
||||||
|
ShippingServicePriority int `xml:"ShippingServicePriority"`
|
||||||
|
ShipToLocation string `xml:"ShipToLocation"`
|
||||||
|
} `xml:"InternationalShippingServiceOption,omitempty"`
|
||||||
|
PaymentInstructions string `xml:"PaymentInstructions"`
|
||||||
|
PromotionalShippingDiscount bool `xml:"PromotionalShippingDiscount"`
|
||||||
|
RateTableDetails *struct {
|
||||||
|
DomesticRateTable string `xml:"DomesticRateTable"`
|
||||||
|
DomesticRateTableID string `xml:"DomesticRateTableId"`
|
||||||
|
InternationalRateTable string `xml:"InternationalRateTable"`
|
||||||
|
InternationalRateTableID string `xml:"InternationalRateTableId"`
|
||||||
|
} `xml:"RateTableDetails,omitempty"`
|
||||||
|
SalesTax *struct {
|
||||||
|
SalesTaxPercent float32 `xml:"SalesTaxPercent"`
|
||||||
|
SalesTaxState string `xml:"SalesTaxState"`
|
||||||
|
ShippingIncludedInTax bool `xml:"ShippingIncludedInTax"`
|
||||||
|
} `xml:"SalesTax,omitempty"`
|
||||||
|
ShippingDiscountProfileID string `xml:"ShippingDiscountProfileID,omitempty"`
|
||||||
|
ShippingServiceOptions []ShippingServiceOptions `xml:"ShippingServiceOptions,omitempty"`
|
||||||
|
ShippingType string `xml:"ShippingType"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CategoryID struct {
|
||||||
|
CategoryID string `xml:"CategoryID"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProductListingDetails struct {
|
||||||
|
BrandMPN BrandMPN `xml:"BrandMPN"`
|
||||||
|
EAN string `xml:"EAN,omitempty"`
|
||||||
|
IncludeeBayProductDetails bool `xml:"IncludeeBayProductDetails"`
|
||||||
|
IncludeStockPhotoURL bool `xml:"IncludeStockPhotoURL"`
|
||||||
|
ISBN string `xml:"ISBN,omitempty"`
|
||||||
|
ProductReferenceID string `xml:"ProductReferenceID,omitempty"`
|
||||||
|
ReturnSearchResultOnDuplicates bool `xml:"ReturnSearchResultOnDuplicates"`
|
||||||
|
TicketListingDetails *struct {
|
||||||
|
EventTitle string `xml:"EventTitle"`
|
||||||
|
PrintedDate string `xml:"PrintedDate"`
|
||||||
|
PrintedTime string `xml:"PrintedTime"`
|
||||||
|
Venue string `xml:"Venue"`
|
||||||
|
} `xml:"TicketListingDetails,omitempty"`
|
||||||
|
UPC string `xml:"UPC,omitempty"`
|
||||||
|
UseFirstProduct bool `xml:"UseFirstProduct"`
|
||||||
|
UseStockPhotoURLAsGallery bool `xml:"UseStockPhotoURLAsGallery"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type BrandMPN struct {
|
||||||
|
Brand string `xml:"Brand"`
|
||||||
|
MPN string `xml:"MPN"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type BuyerRequirementDetails struct {
|
||||||
|
MaximumItemRequirements MaximumItemRequirements `xml:"MaximumItemRequirements"`
|
||||||
|
MaximumUnpaidItemStrikesInfo MaximumUnpaidItemStrikesInfo `xml:"MaximumUnpaidItemStrikesInfo"`
|
||||||
|
ShipToRegistrationCountry bool `xml:"ShipToRegistrationCountry"`
|
||||||
|
ZeroFeedbackScore bool `xml:"ZeroFeedbackScore"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MaximumItemRequirements struct {
|
||||||
|
MaximumItemCount int `xml:"MaximumItemCount"`
|
||||||
|
MinimumFeedbackScore int `xml:"MinimumFeedbackScore"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MaximumUnpaidItemStrikesInfo struct {
|
||||||
|
Count int `xml:"Count"`
|
||||||
|
Period string `xml:"Period"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DiscountPriceInfo struct {
|
||||||
|
MadeForOutletComparisonPrice float32 `xml:"MadeForOutletComparisonPrice"`
|
||||||
|
MinimumAdvertisedPrice float32 `xml:"MinimumAdvertisedPrice"`
|
||||||
|
MinimumAdvertisedPriceExposure string `xml:"MinimumAdvertisedPriceExposure"`
|
||||||
|
OriginalRetailPrice float32 `xml:"OriginalRetailPrice"`
|
||||||
|
SoldOffeBay bool `xml:"SoldOffeBay"`
|
||||||
|
SoldOneBay bool `xml:"SoldOneBay"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ShippingServiceOptions struct {
|
||||||
|
FreeShipping bool `xml:"FreeShipping"`
|
||||||
|
ShippingService string `xml:"ShippingService,omitempty"`
|
||||||
|
ShippingServiceAdditionalCost float32 `xml:"ShippingServiceAdditionalCost,omitempty"`
|
||||||
|
ShippingServiceCost float32 `xml:"ShippingServiceCost,omitempty"`
|
||||||
|
ShippingServicePriority int `xml:"ShippingServicePriority,omitempty"`
|
||||||
|
ShippingSurcharge float32 `xml:"ShippingSurcharge,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ShippingPackageDetails struct {
|
||||||
|
MeasurementUnit string `xml:"MeasurementUnit"` // English/Metric MeasurementSystemCodeType
|
||||||
|
PackageDepth float32 `xml:"PackageDepth"`
|
||||||
|
PackageLength float32 `xml:"PackageLength"`
|
||||||
|
PackageWidth float32 `xml:"PackageWidth"`
|
||||||
|
ShippingIrregular bool `xml:"ShippingIrregular"`
|
||||||
|
ShippingPackage string `xml:"ShippingPackage"` // https://developer.ebay.com/devzone/xml/docs/reference/ebay/types/ShippingPackageCodeType.html
|
||||||
|
WeightMajor float32 `xml:"WeightMajor"`
|
||||||
|
WeightMinor float32 `xml:"WeightMinor"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ShippingServiceCostOverrideList struct {
|
||||||
|
ShippingServiceCostOverride struct {
|
||||||
|
ShippingServiceAdditionalCost struct {
|
||||||
|
} `xml:"ShippingServiceAdditionalCost"`
|
||||||
|
ShippingServiceCost struct {
|
||||||
|
} `xml:"ShippingServiceCost"`
|
||||||
|
ShippingServicePriority struct {
|
||||||
|
} `xml:"ShippingServicePriority"`
|
||||||
|
ShippingServiceType struct {
|
||||||
|
} `xml:"ShippingServiceType"`
|
||||||
|
ShippingSurcharge struct {
|
||||||
|
} `xml:"ShippingSurcharge"`
|
||||||
|
} `xml:"ShippingServiceCostOverride"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type StoreFront struct {
|
||||||
|
StoreCategory2ID int64 `xml:"StoreCategory2ID"`
|
||||||
|
StoreCategory2Name string `xml:"StoreCategory2Name"`
|
||||||
|
StoreCategoryID int64 `xml:"StoreCategoryID"`
|
||||||
|
StoreCategoryName string `xml:"StoreCategoryName"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Variations struct {
|
||||||
|
Pictures struct {
|
||||||
|
VariationSpecificName struct {
|
||||||
|
} `xml:"VariationSpecificName"`
|
||||||
|
VariationSpecificPictureSet struct {
|
||||||
|
PictureURL struct {
|
||||||
|
} `xml:"PictureURL"`
|
||||||
|
VariationSpecificValue struct {
|
||||||
|
} `xml:"VariationSpecificValue"`
|
||||||
|
} `xml:"VariationSpecificPictureSet"`
|
||||||
|
} `xml:"Pictures"`
|
||||||
|
Variation struct {
|
||||||
|
DiscountPriceInfo struct {
|
||||||
|
MadeForOutletComparisonPrice struct {
|
||||||
|
} `xml:"MadeForOutletComparisonPrice"`
|
||||||
|
MinimumAdvertisedPrice struct {
|
||||||
|
} `xml:"MinimumAdvertisedPrice"`
|
||||||
|
MinimumAdvertisedPriceExposure struct {
|
||||||
|
} `xml:"MinimumAdvertisedPriceExposure"`
|
||||||
|
OriginalRetailPrice struct {
|
||||||
|
} `xml:"OriginalRetailPrice"`
|
||||||
|
SoldOffeBay struct {
|
||||||
|
} `xml:"SoldOffeBay"`
|
||||||
|
SoldOneBay struct {
|
||||||
|
} `xml:"SoldOneBay"`
|
||||||
|
} `xml:"DiscountPriceInfo"`
|
||||||
|
Quantity struct {
|
||||||
|
} `xml:"Quantity"`
|
||||||
|
SKU struct {
|
||||||
|
} `xml:"SKU"`
|
||||||
|
StartPrice struct {
|
||||||
|
} `xml:"StartPrice"`
|
||||||
|
VariationProductListingDetails struct {
|
||||||
|
EAN struct {
|
||||||
|
} `xml:"EAN"`
|
||||||
|
ISBN struct {
|
||||||
|
} `xml:"ISBN"`
|
||||||
|
ProductReferenceID struct {
|
||||||
|
} `xml:"ProductReferenceID"`
|
||||||
|
UPC struct {
|
||||||
|
} `xml:"UPC"`
|
||||||
|
} `xml:"VariationProductListingDetails"`
|
||||||
|
VariationSpecifics struct {
|
||||||
|
NameValueList struct {
|
||||||
|
Name struct {
|
||||||
|
} `xml:"Name"`
|
||||||
|
Value struct {
|
||||||
|
} `xml:"Value"`
|
||||||
|
} `xml:"NameValueList"`
|
||||||
|
} `xml:"VariationSpecifics"`
|
||||||
|
} `xml:"Variation"`
|
||||||
|
VariationSpecificsSet struct {
|
||||||
|
NameValueList struct {
|
||||||
|
Name struct {
|
||||||
|
} `xml:"Name"`
|
||||||
|
Value struct {
|
||||||
|
} `xml:"Value"`
|
||||||
|
} `xml:"NameValueList"`
|
||||||
|
} `xml:"VariationSpecificsSet"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type VATDetails struct {
|
||||||
|
BusinessSeller bool `xml:"BusinessSeller"`
|
||||||
|
RestrictedToBusiness bool `xml:"RestrictedToBusiness"`
|
||||||
|
VATPercent float32 `xml:"VATPercent"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Charity struct {
|
||||||
|
CharityID string `xml:"CharityID"`
|
||||||
|
CharityNumber int `xml:"CharityNumber"`
|
||||||
|
DonationPercent float32 `xml:"DonationPercent"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReturnPolicy struct {
|
||||||
|
Description string `xml:"Description"`
|
||||||
|
InternationalRefundOption string `xml:"InternationalRefundOption"`
|
||||||
|
InternationalReturnsAcceptedOption string `xml:"InternationalReturnsAcceptedOption"`
|
||||||
|
InternationalReturnsWithinOption string `xml:"InternationalReturnsWithinOption"`
|
||||||
|
InternationalShippingCostPaidByOption string `xml:"InternationalShippingCostPaidByOption"`
|
||||||
|
RefundOption string `xml:"RefundOption"`
|
||||||
|
ReturnsAcceptedOption string `xml:"ReturnsAcceptedOption"`
|
||||||
|
ReturnsWithinOption string `xml:"ReturnsWithinOption"`
|
||||||
|
ShippingCostPaidByOption string `xml:"ShippingCostPaidByOption"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PictureDetails struct {
|
||||||
|
GalleryDuration string `xml:"GalleryDuration,omitempty"`
|
||||||
|
GalleryType string `xml:"GalleryType,omitempty"`
|
||||||
|
PhotoDisplay string `xml:"PhotoDisplay,omitempty"`
|
||||||
|
PictureSource string `xml:"PictureSource,omitempty"`
|
||||||
|
PictureURL []string `xml:"PictureURL"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type NameValueList struct {
|
||||||
|
Name string `xml:"Name"`
|
||||||
|
Value string `xml:"Value"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ItemSpecifics struct {
|
||||||
|
NameValueList []NameValueList `xml:"NameValueList"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type BestOfferDetails struct {
|
||||||
|
BestOfferEnabled bool `xml:"BestOfferEnabled"`
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user