Documentation
¶
Overview ¶
Package tradera provides a Go client for the Tradera SOAP API.
This client wraps all 6 Tradera API services:
- SearchClient: Item search operations
- PublicClient: Public data (items, categories, users)
- ListingClient: Listing information
- RestrictedClient: Seller operations (requires user auth)
- OrderClient: Order management (requires user auth)
- BuyerClient: Buyer operations (requires user auth)
Features:
- Full context.Context support for timeouts and cancellation
- Optional rate limiting
- Optional automatic retry with exponential backoff
- Optional response caching
Basic usage:
client, err := tradera.NewClient(tradera.DefaultConfig(1234, "your-app-key"))
if err != nil {
log.Fatal(err)
}
result, err := client.Search().Search(ctx, "vintage camera", 0)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Found %d items\n", result.TotalNumberOfItems)
Example (AdvancedSearch) ¶
This example shows advanced search with filters.
package main
import (
"context"
"fmt"
"log"
tradera "github.com/pristabell/tradera-api-client"
)
func main() {
client, err := tradera.NewClient(tradera.DefaultConfig(12345, "your-app-key"))
if err != nil {
log.Fatal(err)
}
defer client.Close()
ctx := context.Background()
// Search with advanced filters
minPrice := int32(1000)
maxPrice := int32(5000)
params := tradera.SearchAdvancedRequest{
SearchWords: "iPhone",
CategoryID: 345262, // Electronics > Phones
PriceMinimum: &minPrice,
PriceMaximum: &maxPrice,
OrderBy: "EndDateAscending",
}
result, err := client.Search().SearchAdvanced(ctx, params)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Found %d iPhones between 1000-5000 SEK\n", result.TotalNumberOfItems)
}
Example (BasicSearch) ¶
This example shows how to create a basic client and search for items.
package main
import (
"context"
"fmt"
"log"
tradera "github.com/pristabell/tradera-api-client"
)
func main() {
// Create a client with your App ID and App Key
client, err := tradera.NewClient(tradera.DefaultConfig(12345, "your-app-key"))
if err != nil {
log.Fatal(err)
}
defer client.Close()
ctx := context.Background()
// Search for items
result, err := client.Search().Search(ctx, "vintage camera", 0)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Found %d items\n", result.TotalNumberOfItems)
for _, item := range result.Items {
fmt.Printf("- %s (ID: %d)\n", item.ShortDescription, item.ID)
}
}
Example (GetCategories) ¶
This example shows how to browse categories.
package main
import (
"context"
"fmt"
"log"
tradera "github.com/pristabell/tradera-api-client"
)
func main() {
client, err := tradera.NewClient(tradera.DefaultConfig(12345, "your-app-key"))
if err != nil {
log.Fatal(err)
}
defer client.Close()
ctx := context.Background()
// Get all categories
categories, err := client.Public().GetCategories(ctx)
if err != nil {
log.Fatal(err)
}
fmt.Println("Categories:")
for _, cat := range categories {
fmt.Printf("- %s (ID: %d)\n", cat.Name, cat.ID)
}
}
Example (GetItem) ¶
This example shows how to get detailed information about a specific item.
package main
import (
"context"
"fmt"
"log"
"time"
tradera "github.com/pristabell/tradera-api-client"
)
func main() {
client, err := tradera.NewClient(tradera.DefaultConfig(12345, "your-app-key"))
if err != nil {
log.Fatal(err)
}
defer client.Close()
ctx := context.Background()
// Get item details by ID
item, err := client.Public().GetItem(ctx, 123456789)
if err != nil {
log.Fatal(err)
}
if item != nil {
fmt.Printf("Item: %s\n", item.ShortDescription)
fmt.Printf("Price: %d SEK\n", item.MaxBid)
fmt.Printf("Ends: %s\n", item.EndDate.Format(time.RFC3339))
}
}
Example (OauthFlow) ¶
This example shows how to use the OAuth token flow.
package main
import (
"context"
"fmt"
"log"
tradera "github.com/pristabell/tradera-api-client"
)
func main() {
client, err := tradera.NewClient(tradera.DefaultConfig(12345, "your-app-key"))
if err != nil {
log.Fatal(err)
}
defer client.Close()
ctx := context.Background()
// Step 1: Get a login URL for the user to authorize your app
// The user should be directed to: https://api.tradera.com/v3/Authenticate.aspx?appId=YOUR_APP_ID
// After authorization, they receive a secret key
// Step 2: Exchange the user ID and secret key for an access token
userID := int32(12345) // User ID from authorization
secretKey := "secret-from-auth" // Secret key from authorization callback
token, err := client.Public().FetchToken(ctx, userID, secretKey)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Access token: %s\n", token)
// Step 3: Create a new client with the user's credentials
userConfig := tradera.DefaultConfig(12345, "your-app-key")
userConfig.UserID = int(userID)
userConfig.Token = token
userClient, err := tradera.NewClient(userConfig)
if err != nil {
log.Fatal(err)
}
defer userClient.Close()
// Now you can use authenticated endpoints
userInfo, err := userClient.Restricted().GetUserInfo(ctx)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Logged in as: %s\n", userInfo.Alias)
}
Example (SellerOperations) ¶
This example shows how to use authenticated operations for sellers.
package main
import (
"context"
"fmt"
"log"
tradera "github.com/pristabell/tradera-api-client"
)
func main() {
// Create a client with user authentication
config := tradera.DefaultConfig(12345, "your-app-key")
config.UserID = 67890
config.Token = "user-oauth-token"
client, err := tradera.NewClient(config)
if err != nil {
log.Fatal(err)
}
defer client.Close()
ctx := context.Background()
// Get seller's transactions
transactions, err := client.Restricted().GetSellerTransactions(ctx)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Found %d transactions\n", len(transactions))
for _, tx := range transactions {
fmt.Printf("- Transaction %d: %d SEK\n", tx.ID, tx.Amount)
}
}
Example (WithMiddleware) ¶
This example shows how to configure the client with rate limiting and retries.
package main
import (
"context"
"fmt"
"log"
"time"
tradera "github.com/pristabell/tradera-api-client"
)
func main() {
config := tradera.Config{
AppID: 12345,
AppKey: "your-app-key",
// Rate limit to 5 requests per second
RateLimit: 5,
// Enable automatic retries
RetryEnabled: true,
MaxRetries: 3,
RetryBaseDelay: 500 * time.Millisecond,
// Cache responses for 5 minutes
CacheTTL: 5 * time.Minute,
// Request timeout
Timeout: 30 * time.Second,
}
client, err := tradera.NewClient(config)
if err != nil {
log.Fatal(err)
}
defer client.Close()
// Use client as normal - middleware is applied automatically
ctx := context.Background()
result, err := client.Search().Search(ctx, "test", 0)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Found %d items\n", result.TotalNumberOfItems)
}
Index ¶
- Constants
- Variables
- func BuildSOAPHeaderXML(cfg Config) ([]byte, error)
- func IsRetryable(err error) bool
- func RequireUserAuth(cfg Config) error
- type APIError
- type AuctionBiddingInfo
- type AuthenticationHeader
- type AuthorizationHeader
- type BuyResult
- type BuyerClient
- func (c *BuyerClient) AddToMemorylist(ctx context.Context, itemIDs []int32) error
- func (c *BuyerClient) Buy(ctx context.Context, itemID int32, buyAmount int32) (*BuyResult, error)
- func (c *BuyerClient) GetBiddingInfo(ctx context.Context, minDate, maxDate *time.Time, ...) ([]*AuctionBiddingInfo, error)
- func (c *BuyerClient) GetBuyerTransactions(ctx context.Context, minDate, maxDate *time.Time) ([]*BuyerTransaction, error)
- func (c *BuyerClient) GetMemorylistItems(ctx context.Context, filterActive *string, minEndDate, maxEndDate *time.Time) ([]*MemorylistItem, error)
- func (c *BuyerClient) GetSellerInfo(ctx context.Context, userID int32) (*SellerInfo, error)
- func (c *BuyerClient) MarkTransactionsPaid(ctx context.Context, transactionIDs []int32, markedAsPaid bool) error
- func (c *BuyerClient) RemoveFromMemorylist(ctx context.Context, itemIDs []int32) error
- func (c *BuyerClient) SendQuestionToSeller(ctx context.Context, itemID int32, question string, sendCopyToSender bool) (string, error)
- type BuyerTransaction
- type Category
- type CategoryCountRequest
- type CategoryCountResult
- type Client
- func (c *Client) Buyer() *BuyerClient
- func (c *Client) Close()
- func (c *Client) Config() Config
- func (c *Client) Listing() *ListingClient
- func (c *Client) Order() *OrderClient
- func (c *Client) Public() *PublicClient
- func (c *Client) Restricted() *RestrictedClient
- func (c *Client) Search() *SearchClient
- type Config
- func (c Config) HasUserAuth() bool
- func (c Config) Validate() error
- func (c Config) WithCache(ttl time.Duration) Config
- func (c Config) WithRateLimit(requestsPerSecond float64) Config
- func (c Config) WithRetry(maxRetries int, baseDelay time.Duration) Config
- func (c Config) WithTimeout(timeout time.Duration) Config
- func (c Config) WithUserAuth(userID int, token string) Config
- type DetailedSellerRating
- type IdDescriptionPair
- type ImageLink
- type Item
- type ItemRestarts
- type ItemShipping
- type ListingClient
- type MemorylistItem
- type NetworkError
- type OrderClient
- type PublicClient
- func (c *PublicClient) FetchToken(ctx context.Context, userID int32, secretKey string) (string, error)
- func (c *PublicClient) GetCategories(ctx context.Context) ([]*Category, error)
- func (c *PublicClient) GetCounties(ctx context.Context) ([]*IdDescriptionPair, error)
- func (c *PublicClient) GetItem(ctx context.Context, itemID int32) (*Item, error)
- func (c *PublicClient) GetOfficialTime(ctx context.Context) (time.Time, error)
- func (c *PublicClient) GetSellerItems(ctx context.Context, userID int32, categoryID int32) ([]*Item, error)
- func (c *PublicClient) GetUserByAlias(ctx context.Context, alias string) (*User, error)
- type RestartedItem
- type RestrictedClient
- func (c *RestrictedClient) EndItem(ctx context.Context, itemID int32) error
- func (c *RestrictedClient) GetSellerTransactions(ctx context.Context) ([]*SellerTransaction, error)
- func (c *RestrictedClient) GetShopSettings(ctx context.Context) (*ShopSettings, error)
- func (c *RestrictedClient) GetUserInfo(ctx context.Context) (*UserInfo, error)
- type SOAPFault
- type SOAPHeaders
- type SearchAdvancedRequest
- type SearchCategory
- type SearchClient
- func (c *SearchClient) Search(ctx context.Context, query string, categoryID int32) (*SearchResult, error)
- func (c *SearchClient) SearchAdvanced(ctx context.Context, req SearchAdvancedRequest) (*SearchResult, error)
- func (c *SearchClient) SearchByFixedCriteria(ctx context.Context, name string, pageNumber int32, itemType string, ...) (*SearchResult, error)
- func (c *SearchClient) SearchByZipCode(ctx context.Context, zipCode string, pageNumber int32, orderBy string) (*SearchResult, error)
- func (c *SearchClient) SearchCategoryCount(ctx context.Context, req CategoryCountRequest) (*CategoryCountResult, error)
- func (c *SearchClient) SearchWithOptions(ctx context.Context, req SearchRequest) (*SearchResult, error)
- type SearchError
- type SearchItem
- type SearchRequest
- type SearchResult
- type SellerInfo
- type SellerOrder
- type SellerTransaction
- type ShopSettings
- type User
- type UserInfo
Examples ¶
Constants ¶
const ( // TraderaNamespace is the XML namespace for Tradera SOAP headers. TraderaNamespace = "http://api.tradera.com" // SOAP namespaces SOAPEnvelopeNamespace = "http://schemas.xmlsoap.org/soap/envelope/" )
const ( SearchServiceURL = "https://api.tradera.com/v3/SearchService.asmx" PublicServiceURL = "https://api.tradera.com/v3/PublicService.asmx" ListingServiceURL = "https://api.tradera.com/v3/ListingService.asmx" RestrictedServiceURL = "https://api.tradera.com/v3/RestrictedService.asmx" OrderServiceURL = "https://api.tradera.com/v3/OrderService.asmx" BuyerServiceURL = "https://api.tradera.com/v3/BuyerService.asmx" )
WSDL URLs for Tradera services
Variables ¶
var ( // ErrInvalidAppID is returned when the AppID is not set or invalid. ErrInvalidAppID = errors.New("tradera: invalid or missing AppID") // ErrInvalidAppKey is returned when the AppKey is not set or invalid. ErrInvalidAppKey = errors.New("tradera: invalid or missing AppKey") // ErrAuthRequired is returned when user authentication is required but not provided. ErrAuthRequired = errors.New("tradera: user authentication required (UserID and Token)") // ErrRateLimited is returned when the rate limit has been exceeded. ErrRateLimited = errors.New("tradera: rate limit exceeded") // ErrTimeout is returned when a request times out. ErrTimeout = errors.New("tradera: request timeout") // ErrNotFound is returned when the requested resource is not found. ErrNotFound = errors.New("tradera: resource not found") )
Sentinel errors for common error conditions.
Functions ¶
func BuildSOAPHeaderXML ¶
BuildSOAPHeaderXML creates the XML bytes for SOAP headers.
func IsRetryable ¶
IsRetryable returns true if the error is potentially retryable.
func RequireUserAuth ¶
RequireUserAuth is a helper that returns an error if user auth is not configured.
Types ¶
type APIError ¶
type APIError struct {
// Code is the error code from the API.
Code string
// Message is the error message from the API.
Message string
// Details contains additional error details if available.
Details string
}
APIError represents an error returned by the Tradera API.
func NewAPIError ¶
NewAPIError creates a new APIError.
func NewAPIErrorWithDetails ¶
NewAPIErrorWithDetails creates a new APIError with additional details.
type AuctionBiddingInfo ¶
type AuctionBiddingInfo struct {
ID int32
ShortDescription string
SellerID int32
EndDate time.Time
ThumbnailLink string
ReservePriceReached bool
HasBuyItNowOption bool
BuyItNowPrice int32
IsEnded bool
NextBid int32
MaxBid int32
MaxBidderID int32
TotalBids int32
MaxAutoBid int32
}
AuctionBiddingInfo represents bidding information for an auction.
type AuthenticationHeader ¶
type AuthenticationHeader struct {
XMLName xml.Name `xml:"tra:AuthenticationHeader"`
AppID int `xml:"tra:AppId"`
AppKey string `xml:"tra:AppKey"`
}
AuthenticationHeader is the SOAP header for app authentication. This header is required for all API calls.
type AuthorizationHeader ¶
type AuthorizationHeader struct {
XMLName xml.Name `xml:"tra:AuthorizationHeader"`
UserID int `xml:"tra:UserId"`
Token string `xml:"tra:Token"`
}
AuthorizationHeader is the SOAP header for user authentication. This header is required for Restricted, Order, and Buyer services.
type BuyerClient ¶
type BuyerClient struct {
// contains filtered or unexported fields
}
BuyerClient provides access to the Tradera Buyer API. Requires user authentication (UserID and Token in config).
func (*BuyerClient) AddToMemorylist ¶
func (c *BuyerClient) AddToMemorylist(ctx context.Context, itemIDs []int32) error
AddToMemorylist adds items to the user's memory list (watchlist).
func (*BuyerClient) GetBiddingInfo ¶
func (c *BuyerClient) GetBiddingInfo(ctx context.Context, minDate, maxDate *time.Time, filterActive, filterLeading *string, includeHidden *bool) ([]*AuctionBiddingInfo, error)
GetBiddingInfo retrieves bidding information for items the user has bid on.
func (*BuyerClient) GetBuyerTransactions ¶
func (c *BuyerClient) GetBuyerTransactions(ctx context.Context, minDate, maxDate *time.Time) ([]*BuyerTransaction, error)
GetBuyerTransactions retrieves transactions for the authenticated buyer.
func (*BuyerClient) GetMemorylistItems ¶
func (c *BuyerClient) GetMemorylistItems(ctx context.Context, filterActive *string, minEndDate, maxEndDate *time.Time) ([]*MemorylistItem, error)
GetMemorylistItems retrieves items from the user's memory list (watchlist).
func (*BuyerClient) GetSellerInfo ¶
func (c *BuyerClient) GetSellerInfo(ctx context.Context, userID int32) (*SellerInfo, error)
GetSellerInfo retrieves public information about a seller.
func (*BuyerClient) MarkTransactionsPaid ¶
func (c *BuyerClient) MarkTransactionsPaid(ctx context.Context, transactionIDs []int32, markedAsPaid bool) error
MarkTransactionsPaid marks transactions as paid by the buyer.
func (*BuyerClient) RemoveFromMemorylist ¶
func (c *BuyerClient) RemoveFromMemorylist(ctx context.Context, itemIDs []int32) error
RemoveFromMemorylist removes items from the user's memory list (watchlist).
func (*BuyerClient) SendQuestionToSeller ¶
func (c *BuyerClient) SendQuestionToSeller(ctx context.Context, itemID int32, question string, sendCopyToSender bool) (string, error)
SendQuestionToSeller sends a question to the seller of an item.
type BuyerTransaction ¶
type BuyerTransaction struct {
ID int32
Date time.Time
Amount int32
LastUpdatedDate time.Time
IsMarkedAsPaid bool
IsMarkedAsPaidConfirmed bool
IsMarkedAsShipped bool
IsFeedbackLeftBySeller bool
IsFeedbackLeftByBuyer bool
ItemID int32
ItemTitle string
SellerID int32
SellerAlias string
}
BuyerTransaction represents a transaction from the buyer's perspective.
type CategoryCountRequest ¶
type CategoryCountRequest struct {
CategoryID int32
SearchWords string
Alias string
CountyID int32
SearchInDescription bool
ItemCondition string
ZipCode string
OnlyItemsWithThumbnail bool
OnlyAuctionsWithBuyNow bool
Mode string
PriceMinimum *int32
PriceMaximum *int32
BidsMinimum *int32
BidsMaximum *int32
ItemStatus string
ItemType string
SellerType string
}
CategoryCountRequest contains parameters for a category count search.
type CategoryCountResult ¶
type CategoryCountResult struct {
Categories []*SearchCategory
Errors []*SearchError
}
CategoryCountResult represents the result of a category count search.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the main Tradera API client. It provides access to all Tradera services with optional middleware support.
func (*Client) Buyer ¶
func (c *Client) Buyer() *BuyerClient
Buyer returns the BuyerClient for buyer operations. Requires user authentication (UserID and Token in config).
func (*Client) Listing ¶
func (c *Client) Listing() *ListingClient
Listing returns the ListingClient for listing operations.
func (*Client) Order ¶
func (c *Client) Order() *OrderClient
Order returns the OrderClient for order management operations. Requires user authentication (UserID and Token in config).
func (*Client) Public ¶
func (c *Client) Public() *PublicClient
Public returns the PublicClient for public data operations.
func (*Client) Restricted ¶
func (c *Client) Restricted() *RestrictedClient
Restricted returns the RestrictedClient for seller operations. Requires user authentication (UserID and Token in config).
func (*Client) Search ¶
func (c *Client) Search() *SearchClient
Search returns the SearchClient for item search operations.
type Config ¶
type Config struct {
// AppID is your Tradera application ID (required)
AppID int
// AppKey is your Tradera application key/GUID (required)
AppKey string
// UserID is the user ID for authenticated operations (optional)
// Required for Restricted, Order, and Buyer services
UserID int
// Token is the authorization token for authenticated operations (optional)
// Required for Restricted, Order, and Buyer services
// Obtain via PublicClient.FetchToken()
Token string
// RateLimit is the maximum number of requests per second (0 = disabled)
RateLimit float64
// RetryEnabled enables automatic retry with exponential backoff
RetryEnabled bool
// MaxRetries is the maximum number of retry attempts (default: 3)
MaxRetries int
// RetryBaseDelay is the base delay for exponential backoff (default: 1s)
RetryBaseDelay time.Duration
// CacheTTL enables caching with the specified TTL (0 = disabled)
// Useful for caching relatively static data like categories
CacheTTL time.Duration
// Timeout is the default timeout for API requests (default: 30s)
Timeout time.Duration
}
Config holds the configuration for the Tradera API client.
func DefaultConfig ¶
DefaultConfig returns a Config with sensible defaults.
func (Config) HasUserAuth ¶
HasUserAuth returns true if user authentication is configured.
func (Config) WithRateLimit ¶
WithRateLimit returns a copy of the config with rate limiting enabled.
func (Config) WithTimeout ¶
WithTimeout returns a copy of the config with the specified timeout.
type DetailedSellerRating ¶
type DetailedSellerRating struct {
ItemAsDescribedCount *int32
ItemAsDescribedAverage *float64
CommResponsivenessCount *int32
CommResponsivenessAverage *float64
ShippingTimeCount *int32
ShippingTimeAverage *float64
ShippingHandlingChargesCount *int32
ShippingHandlingChargesAverage *float64
}
DetailedSellerRating contains detailed seller rating information.
type IdDescriptionPair ¶
IdDescriptionPair represents a simple ID-description pair.
type Item ¶
type Item struct {
ID int32
ShortDescription string
LongDescription string
StartDate time.Time
EndDate time.Time
CategoryID int32
OpeningBid int32
ReservePrice *int32
BuyItNowPrice *int32
NextBid int32
MaxBid int32
TotalBids int32
ItemType string
StartQuantity int32
RemainingQuantity int32
VAT *int32
PaymentCondition string
ShippingCondition string
AcceptsPickup bool
Bold bool
Thumbnail bool
Highlight bool
FeaturedItem bool
ItemLink string
ThumbnailLink string
Restarts int32
Duration int32
Seller *User
MaxBidder *User
Buyers []*User
ImageLinks []string
ShippingOptions []*ItemShipping
}
Item represents a Tradera item with full details.
type ItemRestarts ¶
type ItemRestarts struct {
LastRestartedItemID int32
AncestorItemID int32
RestartedItems []*RestartedItem
}
ItemRestarts represents information about item restarts.
type ItemShipping ¶
type ItemShipping struct {
ShippingOptionID *int32
Cost int32
ShippingWeight *float64
ShippingProductID *int32
ShippingProviderID *int32
}
ItemShipping represents shipping options for an item.
type ListingClient ¶
type ListingClient struct {
// contains filtered or unexported fields
}
ListingClient provides access to the Tradera Listing API.
func (*ListingClient) GetItemRestarts ¶
func (c *ListingClient) GetItemRestarts(ctx context.Context, itemID int32) (*ItemRestarts, error)
GetItemRestarts retrieves item restart information.
type MemorylistItem ¶
type MemorylistItem struct {
ID int32
Title string
EndDate time.Time
CurrentPrice int32
BuyItNowPrice *int32
ThumbnailLink string
IsEnded bool
TotalBids int32
RemainingQuantity int32
}
MemorylistItem represents an item in the user's memory list (watchlist).
type NetworkError ¶
NetworkError wraps network-related errors.
func (*NetworkError) Error ¶
func (e *NetworkError) Error() string
Error implements the error interface.
func (*NetworkError) Unwrap ¶
func (e *NetworkError) Unwrap() error
Unwrap implements errors.Unwrap.
type OrderClient ¶
type OrderClient struct {
// contains filtered or unexported fields
}
OrderClient provides access to the Tradera Order API. Requires user authentication (UserID and Token in config).
func (*OrderClient) GetSellerOrders ¶
func (c *OrderClient) GetSellerOrders(ctx context.Context) ([]*SellerOrder, error)
GetSellerOrders retrieves orders for the authenticated seller.
func (*OrderClient) SetSellerOrderAsPaid ¶
func (c *OrderClient) SetSellerOrderAsPaid(ctx context.Context, orderID int32) error
SetSellerOrderAsPaid marks an order as paid.
func (*OrderClient) SetSellerOrderAsShipped ¶
func (c *OrderClient) SetSellerOrderAsShipped(ctx context.Context, orderID int32) error
SetSellerOrderAsShipped marks an order as shipped.
type PublicClient ¶
type PublicClient struct {
// contains filtered or unexported fields
}
PublicClient provides access to the Tradera Public API.
func (*PublicClient) FetchToken ¶
func (c *PublicClient) FetchToken(ctx context.Context, userID int32, secretKey string) (string, error)
FetchToken retrieves an authorization token for a user. This token is required for authenticated operations.
func (*PublicClient) GetCategories ¶
func (c *PublicClient) GetCategories(ctx context.Context) ([]*Category, error)
GetCategories retrieves the full category tree.
func (*PublicClient) GetCounties ¶
func (c *PublicClient) GetCounties(ctx context.Context) ([]*IdDescriptionPair, error)
GetCounties retrieves the list of Swedish counties.
func (*PublicClient) GetOfficialTime ¶
GetOfficialTime retrieves the official Tradera server time.
func (*PublicClient) GetSellerItems ¶
func (c *PublicClient) GetSellerItems(ctx context.Context, userID int32, categoryID int32) ([]*Item, error)
GetSellerItems retrieves items for a specific seller.
func (*PublicClient) GetUserByAlias ¶
GetUserByAlias retrieves a user by their alias.
type RestartedItem ¶
RestartedItem represents a single restart event.
type RestrictedClient ¶
type RestrictedClient struct {
// contains filtered or unexported fields
}
RestrictedClient provides access to the Tradera Restricted API. Requires user authentication (UserID and Token in config).
func (*RestrictedClient) EndItem ¶
func (c *RestrictedClient) EndItem(ctx context.Context, itemID int32) error
EndItem ends an active item.
func (*RestrictedClient) GetSellerTransactions ¶
func (c *RestrictedClient) GetSellerTransactions(ctx context.Context) ([]*SellerTransaction, error)
GetSellerTransactions retrieves transactions for the authenticated seller.
func (*RestrictedClient) GetShopSettings ¶
func (c *RestrictedClient) GetShopSettings(ctx context.Context) (*ShopSettings, error)
GetShopSettings retrieves the shop settings for the authenticated user.
func (*RestrictedClient) GetUserInfo ¶
func (c *RestrictedClient) GetUserInfo(ctx context.Context) (*UserInfo, error)
GetUserInfo retrieves information about the authenticated user.
type SOAPHeaders ¶
type SOAPHeaders struct {
Authentication AuthenticationHeader
Authorization *AuthorizationHeader // nil if not using user auth
}
SOAPHeaders contains all headers to be included in a SOAP request.
func NewSOAPHeaders ¶
func NewSOAPHeaders(cfg Config) SOAPHeaders
NewSOAPHeaders creates SOAP headers from the config.
func (SOAPHeaders) MarshalXML ¶
func (h SOAPHeaders) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements xml.Marshaler for SOAPHeaders.
type SearchAdvancedRequest ¶
type SearchAdvancedRequest struct {
SearchWords string
CategoryID int32
SearchInDescription bool
Mode string // "AllWords" or "AnyWords"
PriceMinimum *int32
PriceMaximum *int32
BidsMinimum *int32
BidsMaximum *int32
ZipCode string
CountyID int32
Alias string
OrderBy string
ItemStatus string // "Active" or "Ended"
ItemType string // "All", "Auction", "FixedPrice"
OnlyAuctionsWithBuyNow bool
OnlyItemsWithThumbnail bool
ItemsPerPage int32
PageNumber int32
ItemCondition string // "All", "OnlyNew", "OnlySecondHand"
SellerType string // "All", "OnlyPrivate", "OnlyBusiness"
Brands []string
}
SearchAdvancedRequest contains parameters for an advanced search.
type SearchCategory ¶
type SearchCategory struct {
ID int32
Name string
NoOfItemsInCategory int32
NoOfItemsInCategoryIncludingChildren int32
ChildCategories []*SearchCategory
}
SearchCategory represents a category with item counts.
type SearchClient ¶
type SearchClient struct {
// contains filtered or unexported fields
}
SearchClient provides access to the Tradera Search API.
func (*SearchClient) Search ¶
func (c *SearchClient) Search(ctx context.Context, query string, categoryID int32) (*SearchResult, error)
Search performs a basic item search.
func (*SearchClient) SearchAdvanced ¶
func (c *SearchClient) SearchAdvanced(ctx context.Context, req SearchAdvancedRequest) (*SearchResult, error)
SearchAdvanced performs an advanced search with filters.
func (*SearchClient) SearchByFixedCriteria ¶
func (c *SearchClient) SearchByFixedCriteria(ctx context.Context, name string, pageNumber int32, itemType string, orderBy string) (*SearchResult, error)
SearchByFixedCriteria searches items by predefined criteria.
func (*SearchClient) SearchByZipCode ¶
func (c *SearchClient) SearchByZipCode(ctx context.Context, zipCode string, pageNumber int32, orderBy string) (*SearchResult, error)
SearchByZipCode searches items by zip code.
func (*SearchClient) SearchCategoryCount ¶
func (c *SearchClient) SearchCategoryCount(ctx context.Context, req CategoryCountRequest) (*CategoryCountResult, error)
SearchCategoryCount gets item counts per category.
func (*SearchClient) SearchWithOptions ¶
func (c *SearchClient) SearchWithOptions(ctx context.Context, req SearchRequest) (*SearchResult, error)
SearchWithOptions performs a search with custom options.
type SearchError ¶
SearchError represents an error from the search API.
type SearchItem ¶
type SearchItem struct {
ID int32
ShortDescription string
LongDescription string
BuyItNowPrice *int32
SellerID int32
SellerAlias string
MaxBid *int32
ThumbnailLink string
SellerDsrAverage float64
EndDate soap.XSDDateTime
NextBid *int32
HasBids bool
IsEnded bool
ItemType string
ItemURL string
CategoryID int32
BidCount int32
ImageLinks []ImageLink
}
SearchItem represents an item in search results.
type SearchRequest ¶
SearchRequest contains parameters for a basic search.
type SearchResult ¶
type SearchResult struct {
TotalNumberOfItems int32
TotalNumberOfPages int32
Items []*SearchItem
Errors []*SearchError
}
SearchResult represents the result of a search operation.
type SellerInfo ¶
type SellerInfo struct {
TotalRating int32
PositiveFeedbackPercent *int32
PersonalMessage string
IsCompany bool
HasShop bool
DetailedRating *DetailedSellerRating
}
SellerInfo represents public information about a seller.
type SellerOrder ¶
type SellerOrder struct {
ID int32
BuyerID int32
BuyerAlias string
TotalAmount int32
ShippingAmount int32
Status string
CreatedDate string
IsPaid bool
IsShipped bool
}
SellerOrder represents an order for a seller.
type SellerTransaction ¶
type SellerTransaction struct {
ID int32
Date string
Amount int32
LastUpdatedDate string
IsMarkedAsPaidConfirmed bool
IsMarkedAsShipped bool
IsShippingBooked bool
BuyerID int32
BuyerAlias string
ItemID int32
ItemTitle string
}
SellerTransaction represents a seller transaction.
type ShopSettings ¶
type ShopSettings struct {
CompanyInformation string
PurchaseTerms string
ShowGalleryMode *bool
ShowAuctionView *bool
BannerColor string
IsTemporaryClosed *bool
TemporaryClosedMessage string
ContactInformation string
LogoImageUrl string
MaxActiveItems int32
MaxInventoryItems int32
}
ShopSettings represents shop settings.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
getitem
command
Command getitem demonstrates how to get detailed information about a Tradera item.
|
Command getitem demonstrates how to get detailed information about a Tradera item. |
|
search
command
Command search demonstrates how to search for items on Tradera.
|
Command search demonstrates how to search for items on Tradera. |
|
seller
command
Command seller demonstrates how to use authenticated seller operations on Tradera.
|
Command seller demonstrates how to use authenticated seller operations on Tradera. |
|
generated
|
|