tiktok

package module
v0.0.0-...-6eb2caa Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 18 Imported by: 0

README

tiktok

Go Reference Go Report Card build Coverage Status

Go SDK for Tiktok Shop Open Platform.

Feature

  • Authentication
    • Get your auth code url
    • Use auth code to get access_token
    • Refresh your access token
  • Webhook
  • Order API
    • GetOrderList
    • GetOrderDetail
    • ShipOrder
  • Fulfillment API
    • SearchPreCombinePkg
    • ConfirmPreCombinePkg
    • RemovePackageOrder
    • GetPackagePickupConfig
    • ShipPackage
    • SearchPackage
    • GetPackageDetail
    • GetPackageShippingInfo
    • UpdatePackageShippingInfo
    • GetPackageShippingDocument
    • VerifyOrderSplit
    • ConfirmOrderSplit
  • Logistics API
    • GetShippingInfo
    • UpdateShippingInfo
    • GetShippingDocument
    • GetWarehouseList
    • GetShippingProvider
  • Product API
    • GetCategory
    • GetAttribute
    • GetCategoryRule
    • GetBrand
    • UploadImg
    • UploadFile
    • CreateProduct
    • EditProduct
    • GetProductList
    • GetProductDetail
    • UpdatePrice
    • UpdateStock
    • DeactivateProducts
    • DeleteProducts
    • RecoverProduct
    • ActivateProduct
  • Shop API
    • GetAuthorizedShop
  • Finance API
    • SearchSettlements
    • GetOrderSettlements
    • SearchTransactions
  • Reverse Order API
    • ConfirmReverse
    • RejectReverse
    • GetReverseList
    • GetReverseReason
TODO
  • All Feature supports
  • Integraion tests

API Call Flow

https://bytedance.feishu.cn/docs/doccnZ15f4vPK4qOOBTKhgc2xNh

HOWTO Contribuate

Install taskfile before you start.

Setup Intergration Environment Variables

edit .env file in root directory:

APPKEY=<app id for tiktok>
APPSECRET=<app secret for tiktok>
AK=<access token>
RK=<refresh token>
OPENID=<seller's openid>
SELLER=<seller's name>
Run Tests
task  # run tests.
task integration # run integration tests.

If env is not setup, all integration tests will be skipped.

Documentation

Index

Constants

View Source
const (
	SearchPreCombinePkgPATH        = "/api/fulfillment/pre_combine_pkg/list"
	ConfirmPreCombinePkgPATH       = "/api/fulfillment/pre_combine_pkg/confirm"
	RemovePackageOrderPATH         = "/api/fulfillment/package/remove"
	GetPackagePickupConfigPATH     = "/api/fulfillment/package_pickup_config/list"
	ShipPackagePATH                = "/api/fulfillment/rts"
	SearchPackagePATH              = "/api/fulfillment/search"
	GetPackageDetailPATH           = "/api/fulfillment/detail"
	GetPackageShippingInfoPATH     = "/api/fulfillment/shipping_info"
	UpdatePackageShippingInfoPATH  = "/api/fulfillment/shipping_info/update"
	GetPackageShippingDocumentPATH = "/api/fulfillment/shipping_document"
	VerifyOrderSplitPATH           = "/api/fulfillment/order_split/verify"
	ConfirmOrderSplitPATH          = "/api/fulfillment/order_split/confirm"
)
View Source
const (
	GetShippingInfoPATH       = "/api/logistics/ship/get"
	UpdateShippingInfoPATH    = "/api/logistics/tracking"
	GetShippingDocumentPATH   = "/api/logistics/shipping_document"
	GetWarehouseListPATH      = "/api/logistics/get_warehouse_list"
	GetShippingProviderPATH   = "/api/logistics/shipping_providers"
	GetSubscribedDeliveryPATH = "/api/logistics/get_subscribed_deliveryoptions"
)

Variables

View Source
var (
	// AuthBaseURL for auth related api call.
	AuthBaseURL = "https://auth.tiktok-shops.com"
	// APIBaseURL other apis except auth.
	APIBaseURL = "https://open-api.tiktokglobalshop.com"
)
View Source
var ErrAppInfoEmpty = Error("AppKey or AppSecret is empty")

ErrAppInfoEmpty means something is Missing.

View Source
var Timestamp func() string = func() string {
	return fmt.Sprintf("%d", time.Now().Unix())
}

Timestamp mock this if you want to repeatable request.

Functions

func CheckEmpty

func CheckEmpty(vals ...string) bool

func ErrCode

func ErrCode(err error) int

Types

type APIError

type APIError struct {
	Code      int
	Message   string
	RequestID string
}

func (*APIError) Error

func (a *APIError) Error() string

type AccessTokenResponse

type AccessTokenResponse struct {
	AccessToken          string `json:"access_token"`
	AccessTokenExpireIn  int    `json:"access_token_expire_in"`
	RefreshToken         string `json:"refresh_token"`
	RefreshTokenExpireIn int    `json:"refresh_token_expire_in"`
	OpenID               string `json:"open_id"`
	SellerName           string `json:"seller_name"`
}

type Attribute

type Attribute struct {
	ID            string    `json:"id"`
	Name          string    `json:"name"`
	AttributeType int       `json:"attribute_type"`
	InputType     InputType `json:"input_type"`
	Values        []Value   `json:"values"`
}

type AttributeList

type AttributeList struct {
	Attributes []Attribute `json:"attributes"`
}

type AttributeValue

type AttributeValue struct {
	ValueID   string `json:"value_id"`
	ValueName string `json:"value_name"`
}

type Brand

type Brand struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Status int    `json:"status"` // ONLINE=1;  OFFLINE=2;
}

type BrandList

type BrandList struct {
	BrandList []Brand `json:"brand_list"`
}

type CancelOrderRequest

type CancelOrderRequest struct {
	OrderID         string `json:"order_id" validate:"required"`
	CancelReasonKey string `json:"cancel_reason_key" validate:"required"`
}

type CancelOrderResponse

type CancelOrderResponse struct {
	ReverseMainOrderID int64 `json:"reverse_main_order_id"`
}

type Category

type Category struct {
	ID               string `json:"id"`
	ParentID         string `json:"parent_id"`
	LocalDisplayName string `json:"local_display_name"`
	IsLeaf           bool   `json:"is_leaf"`
}

type CategoryList

type CategoryList struct {
	CategoryList []Category `json:"category_list"`
}

type CategoryRule

type CategoryRule struct {
	ProductCertifications     []ProductCertification    `json:"product_certifications"`
	SupportSizeChart          bool                      `json:"support_size_chart"`
	SupportCod                bool                      `json:"support_cod"`
	ExemptionOfIdentifierCode ExemptionOfIdentifierCode `json:"exemption_of_identifier_code"`
}

type CategoryRules

type CategoryRules struct {
	CategoryRules []CategoryRule `json:"category_rules"`
}

type Certification

type Certification struct {
	ID     string  `json:"id"`
	Title  string  `json:"title"`
	Files  []File  `json:"files"`
	Images []Image `json:"images"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client for tiktok

func New

func New(appKey, appSecret string, opts ...Option) (c *Client, err error)

New for create a client.

func (*Client) ActivateProduct

func (c *Client) ActivateProduct(ctx context.Context, p Param, ids []string) (list FailedProductIDs, err error)

func (*Client) CancelOrder

func (c *Client) CancelOrder(ctx context.Context, p Param, req CancelOrderRequest) (resp CancelOrderResponse, err error)

CancelOrder to cancel the order.

func (*Client) ConfirmOrderSplit

func (c *Client) ConfirmOrderSplit(ctx context.Context, p Param, req ConfirmOrderSplitRequest) (data ConfirmOrderSplitData, err error)

func (*Client) ConfirmPreCombinePkg

func (c *Client) ConfirmPreCombinePkg(ctx context.Context, p Param, req ConfirmPreCombinePkgRequest) (data PreCombinePkgData, err error)

func (*Client) ConfirmReverse

func (c *Client) ConfirmReverse(ctx context.Context, p Param, orderID string) (err error)

func (*Client) CreateProduct

func (c *Client) CreateProduct(ctx context.Context, p Param, req CreateProductRequest) (product ProductData, err error)

func (*Client) DeactivateProducts

func (c *Client) DeactivateProducts(ctx context.Context, p Param, productIDs []string) (list FailedProductIDs, err error)

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, path string, param url.Values, body interface{}, resp interface{}) (err error)

Delete request for TikTok requests. I don't known why there is body in delete request. Note: Timestamp, appkey and signature will auto-management by action.

func (*Client) DeleteProducts

func (c *Client) DeleteProducts(ctx context.Context, p Param, ids []string) (list FailedProductIDs, err error)

func (*Client) EditProduct

func (c *Client) EditProduct(ctx context.Context, p Param, req EditProductRequest) (product ProductData, err error)

func (*Client) GenerateAuthURL

func (c *Client) GenerateAuthURL(state string) string

GenerateAuthURL generate auth url for user to login. Doc: https://bytedance.feishu.cn/docs/doccnROmkE6WI9zFeJuT3DQ3YOg#ckvNFO

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, param url.Values, resp interface{}) (err error)

Get request for TikTok requests. Note: Timestamp, appkey and signature will auto-management by action.

func (*Client) GetAccessToken

func (c *Client) GetAccessToken(ctx context.Context, code string) (resp AccessTokenResponse, err error)

*

{
    "code": 0,
    "message": "success",
    "data": {
        "access_token": "TTP_F9t7wQAAAAAqhavs-UCqgsvpfMbIeHkgwjhz2JUhelGklA6pyvNhPVwHj71v__F-4IefdT09TAOGrHU03LeN5KTM7qJS3d8U2Qq1LU6bJX_IObRgyyGryge7l3rmiduQmBv7hMbZE5mOw1_5ot0xiIhncRC3eCF9h5bqq6zxpPsVtrGjig4tuQ",
        "access_token_expire_in": 1705073850,
        "refresh_token": "TTP_lYnukAAAAADclTdpedWBWCOfn95DH4j49d9SSmMkEDvgXMGcHhB7HtnXzjqPmrKKddFx4eVQZuY",
        "refresh_token_expire_in": 1710994818,
        "open_id": "mRd0RgAAAAAwOD86290YUwIp0iecIUEKfZsTlfulY3QHZ4s-ShhS4w",
        "seller_name": "TestMaker",
        "seller_base_region": "US",
        "user_type": 0
    },
    "request_id": "2024010515382517EBC389FB2D9801AF2B"
}

* GetAccessToken get access token from tiktok server. Doc: https://bytedance.feishu.cn/docs/doccnROmkE6WI9zFeJuT3DQ3YOg#qYtWHF

func (*Client) GetAttribute

func (c *Client) GetAttribute(ctx context.Context, p Param, categoryID string) (list AttributeList, err error)

func (*Client) GetAuthorizedShop

func (c *Client) GetAuthorizedShop(ctx context.Context, ak string, shop_id string) (list ShopList, err error)

func (*Client) GetBrand

func (c *Client) GetBrand(ctx context.Context, p Param, categoryID string) (list BrandList, err error)

func (*Client) GetCategory

func (c *Client) GetCategory(ctx context.Context, p Param) (list CategoryList, err error)

GetCategory WARN: DO NOT CACHE THIS FUNCTION RESULT.

func (*Client) GetCategoryRule

func (c *Client) GetCategoryRule(ctx context.Context, p Param, categoryID string) (list CategoryRules, err error)

func (*Client) GetOrderDetail

func (c *Client) GetOrderDetail(ctx context.Context, p Param, ordersID []string) (list OrderDetailList, err error)

GetOrderDetail get order detail.

func (*Client) GetOrderList

func (c *Client) GetOrderList(ctx context.Context, p Param, query GetOrderListRequest) (list OrdersList, err error)

GetOrderList get order list. Default PageSize is 50.

func (*Client) GetOrderSettlements

func (c *Client) GetOrderSettlements(ctx context.Context, p Param, ordersID string) (list SettlementsList, err error)

GetOrderSettlements get order settlements.

func (*Client) GetPackageDetail

func (c *Client) GetPackageDetail(ctx context.Context, p Param, req PackageIDRequest) (data GetPackageDetailData, err error)

func (*Client) GetPackagePickupConfig

func (c *Client) GetPackagePickupConfig(ctx context.Context, p Param, req PackageIDRequest) (data GetPackagePickupConfigData, err error)

func (*Client) GetPackageShippingDocument

func (c *Client) GetPackageShippingDocument(ctx context.Context, p Param, req GetPackageShippingDocumentRequest) (data GetPackageShippingDocumentData, err error)

func (*Client) GetPackageShippingInfo

func (c *Client) GetPackageShippingInfo(ctx context.Context, p Param, req PackageIDRequest) (data GetPackageShippingInfoData, err error)

func (*Client) GetProductDetail

func (c *Client) GetProductDetail(ctx context.Context, p Param, productID string) (product ProductData, err error)

func (*Client) GetProductList

func (c *Client) GetProductList(ctx context.Context, p Param, req ProductSearchRequest) (list GetProductListData, err error)

func (*Client) GetReverseList

func (c *Client) GetReverseList(ctx context.Context, p Param, query GetReverseListRequest) (list ReverseOrdersList, err error)

func (*Client) GetReverseReason

func (c *Client) GetReverseReason(ctx context.Context, p Param, req GetReverseReasonRequest) (list ReverseReasonList, err error)

func (*Client) GetShippingDocument

func (c *Client) GetShippingDocument(ctx context.Context, p Param, req GetShippingDocumentRequest) (data GetShippingDocumentData, err error)

func (*Client) GetShippingInfo

func (c *Client) GetShippingInfo(ctx context.Context, p Param, req OrderIDReq) (data LogisticsGetShippingInfoData, err error)

func (*Client) GetShippingProvider

func (c *Client) GetShippingProvider(ctx context.Context, p Param) (data GetShippingProviderData, err error)

func (*Client) GetSubscribedDelivery

func (c *Client) GetSubscribedDelivery(ctx context.Context, p Param, req GetSubscribedDeliveryRequest) (data GetSubscribedDeliveryData, err error)

func (*Client) GetWarehouseList

func (c *Client) GetWarehouseList(ctx context.Context, p Param) (data GetWarehouseListData, err error)

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, param url.Values, body interface{}, resp interface{}) (err error)

Post request for TikTok requests. Note: Timestamp, appkey and signature will auto-management by action.

func (*Client) Put

func (c *Client) Put(ctx context.Context, path string, param url.Values, body interface{}, resp interface{}) (err error)

Put request for TikTok requests. Note: Timestamp, appkey and signature will auto-management by action.

func (*Client) RecoverProduct

func (c *Client) RecoverProduct(ctx context.Context, p Param, ids []string) (list FailedProductIDs, err error)

func (*Client) RefreshToken

func (c *Client) RefreshToken(ctx context.Context, rk string) (resp AccessTokenResponse, err error)

RefreshToken refresh access token. Doc: https://bytedance.feishu.cn/docs/doccnROmkE6WI9zFeJuT3DQ3YOg#bG2h09

func (*Client) RejectReverse

func (c *Client) RejectReverse(ctx context.Context, p Param, query RejectReverseRequest) (err error)

func (*Client) RemovePackageOrder

func (c *Client) RemovePackageOrder(ctx context.Context, p Param, req RemovePackageOrderRequest) (data PreCombinePkgData, err error)

func (*Client) SearchPackage

func (c *Client) SearchPackage(ctx context.Context, p Param, req SearchPackageRequest) (data SearchPackageData, err error)

func (*Client) SearchPreCombinePkg

func (c *Client) SearchPreCombinePkg(ctx context.Context, p Param, req SearchPreCombinePkgRequest) (data SearchPreCombinePkgData, err error)

func (*Client) SearchSettlements

func (c *Client) SearchSettlements(ctx context.Context, p Param, query SearchSettlementsRequest) (list SettlementsList, err error)

SearchSettlements search settlements. Default PageSize is 100.

func (*Client) SearchTransactions

func (c *Client) SearchTransactions(ctx context.Context, p Param, query SearchTransactionsRequest) (list TransactionsList, err error)

SearchTransactions search your seller account's transactions within a certain timeframe. Default PageSize is 100.

func (*Client) ShipOrder

func (c *Client) ShipOrder(ctx context.Context, p Param, req ShipOrderRequest) (code int, err error)

ShipOrder ship order.

func (*Client) ShipPackage

func (c *Client) ShipPackage(ctx context.Context, p Param, req ShipPackageRequest) (data ShipPackageData, err error)

func (*Client) UpdatePackageShippingInfo

func (c *Client) UpdatePackageShippingInfo(ctx context.Context, p Param, req UpdatePackageShippingInfoRequest) (data UpdatePackageShippingInfoData, err error)

func (*Client) UpdatePrice

func (c *Client) UpdatePrice(ctx context.Context, p Param, req UpdatePriceRequest) (list UpdatePriceData, err error)

func (*Client) UpdateShippingInfo

func (c *Client) UpdateShippingInfo(ctx context.Context, p Param, req UpdateShippingInfoReq) (err error)

func (*Client) UpdateStock

func (c *Client) UpdateStock(ctx context.Context, p Param, req UpdateStockRequest) (list UpdateStockFailedSKU, err error)

func (*Client) UploadFile

func (c *Client) UploadFile(ctx context.Context, p Param, fileName string, body []byte) (info FileInfo, err error)

func (*Client) UploadImg

func (c *Client) UploadImg(ctx context.Context, p Param, scene ImgScene, body string) (img ImageInfo, err error)

func (*Client) UploadImgReader

func (c *Client) UploadImgReader(ctx context.Context, p Param, scene ImgScene, r io.Reader) (img ImageInfo, err error)

func (*Client) VerifyOrderSplit

func (c *Client) VerifyOrderSplit(ctx context.Context, p Param, req VerifyOrderSplitRequest) (data VerifyOrderSplitData, err error)

type ConfirmOrderSplitData

type ConfirmOrderSplitData struct {
	ConfirmResultList []struct {
		PreSplitPkgID int  `json:"pre_split_pkg_id"`
		ConfirmResult bool `json:"confirm_result"`
	} `json:"confirm_result_list"`
	SuccessList []struct {
		PreSplitPkgID int `json:"pre_split_pkg_id"`
		PackageID     int `json:"package_id"`
	} `json:"success_list"`

	FailList []struct {
		PreSplitPkgID int64  `json:"pre_split_pkg_id"`
		FailReason    string `json:"fail_reason"`
	}
}

type ConfirmOrderSplitRequest

type ConfirmOrderSplitRequest struct {
	OrderID    int64 `json:"order_id" validate:"required"`
	SplitGroup []struct {
		PreSplitPkgID   int     `json:"pre_split_pkg_id" validate:"required"`
		OrderLineIDList []int64 `json:"order_line_id_list" validate:"min=1"`
	} `json:"split_group" validate:"min=1"`
}

type ConfirmPreCombinePkgRequest

type ConfirmPreCombinePkgRequest struct {
	PreCombinePkgList []struct {
		PreCombinePkgID string   `json:"pre_combine_pkg_id" validate:"required"`
		OrderIDList     []string `json:"order_id_list"  validate:"omitempty"`
	} `json:"pre_combine_pkg_list" validate:"required,min=1"`
}

type CreateProductRequest

type CreateProductRequest struct {
	ProductName           string                        `json:"product_name" validate:"required"`
	Description           string                        `json:"description"  validate:"required"`
	CategoryID            string                        `json:"category_id"  validate:"required"`
	BrandID               string                        `json:"brand_id"`
	Images                []ImgID                       `json:"images,omitempty"`
	WarrantyPeriod        int                           `json:"warranty_period"`
	WarrantyPolicy        string                        `json:"warranty_policy"`
	PackageLength         int                           `json:"package_length"`
	PackageWidth          int                           `json:"package_width"`
	PackageHeight         int                           `json:"package_height"`
	PackageWeight         string                        `json:"package_weight"  validate:"required"`
	SizeChart             SizePic                       `json:"size_chart"`
	ProductCertifications []ProductCertificationRequest `json:"product_certifications"`
	IsCodOpen             bool                          `json:"is_cod_open"`
	Skus                  []SKU                         `json:"skus"  validate:"required"`
	DeliveryServiceIDS    []string                      `json:"delivery_service_ids,omitempty"`
	ProductAttributes     []ProductAttr                 `json:"product_attributes,omitempty"`
}

CreateProductRequest is creating product https://developers.tiktok-shops.com/documents/document/234547

type DeliveryService

type DeliveryService struct {
	DeliveryServiceID     int64  `json:"delivery_service_id"`
	DeliveryOptionName    string `json:"delivery_option_name"`
	DeliveryServiceStatus bool   `json:"delivery_service_status"`
}

type EditAttributes

type EditAttributes []struct {
	AttributeID     string           `json:"attribute_id"`
	AttributeName   string           `json:"attribute_name"`
	AttributeValues []AttributeValue `json:"attribute_values"`
}

type EditProductCertifications

type EditProductCertifications []struct {
	Files  []File  `json:"files"` // no type field
	ID     string  `json:"id" validate:"required"`
	Images []ImgID `json:"images"`
}

type EditProductRequest

type EditProductRequest struct {
	ProductID          string                    `json:"product_id" validate:"required"`
	ProductName        string                    `json:"product_name" validate:"required"`
	Description        string                    `json:"description" validate:"required"`
	CategoryID         string                    `json:"category_id" validate:"required"`
	BrandID            string                    `json:"brand_id"`
	Images             []ImgID                   `json:"images,omitempty"`
	WarrantyPeriod     int                       `` /* 389-byte string literal not displayed */
	WarrantyPolicy     string                    `json:"warranty_policy"`
	PackageLength      int                       `json:"package_length" example:"14. unit is cm"`
	PackageHeight      int                       `json:"package_height" example:"14. unit is cm"`
	PackageWidth       int                       `json:"package_width" example:"14. unit is cm"`
	PackageWeight      string                    `json:"package_weight" validate:"required" example:"14. unit is cm"`
	SizeChart          SizePic                   `json:"size_chart,omitempty"`
	Certifications     EditProductCertifications `json:"product_certifications"`
	IsCodOpen          bool                      `json:"is_cod_open,omitempty"`
	Skus               []SKU                     `json:"skus"`
	DeliveryServiceIDS string                    `json:"delivery_service_ids"`
	Attribute          EditAttributes            `json:"product_attributes,omitempty"`
}

EditProductRequest is edit product attributes https://developers.tiktok-shops.com/documents/document/234555

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type ExemptionOfIdentifierCode

type ExemptionOfIdentifierCode struct {
	SupportIdentifierCodeExemption bool `json:"support_identifier_code_exemption"`
}

type FailedProductIDs

type FailedProductIDs struct {
	FailedProductIDs []string `json:"failed_product_ids"`
}

type FailedSKUStock

type FailedSKUStock struct {
	ID                 string   `json:"id"`
	FailedWarehouseIDs []string `json:"failed_warehouse_ids"`
}

type File

type File struct {
	ID   string   `json:"id"`
	List []string `json:"list,omitempty"`
	Name string   `json:"name"`
	Type string   `json:"type"`
}

type FileInfo

type FileInfo struct {
	FileID   string `json:"file_id"`
	FileURL  string `json:"file_url"`
	FileName string `json:"file_name"`
	FileType string `json:"file_type"`
}

type FulfillmentPickUp

type FulfillmentPickUp struct {
	PickUpStartTime int64 `json:"pick_up_start_time"`
	PickUpEndTime   int64 `json:"pick_up_end_time"`
}

type GetAccessTokenRequest

type GetAccessTokenRequest struct {
	AppKey    string `json:"app_key"`
	AppSecret string `json:"app_secret"`
	AuthCode  string `json:"auth_code"`
	GrantType string `json:"grant_type"`
}

type GetOrderDetailRequest

type GetOrderDetailRequest struct {
	OrderIDList []string `json:"order_id_list"`
}

type GetOrderListRequest

type GetOrderListRequest struct {
	CreateTimeFrom int    `json:"create_time_from,omitempty"`
	CreateTimeTo   int    `json:"create_time_to,omitempty"`
	UpdateTimeFrom int    `json:"update_time_from,omitempty"`
	UpdateTimeTo   int    `json:"update_time_to,omitempty"`
	OrderStatus    int    `json:"order_status,omitempty"`
	Cursor         string `json:"cursor,omitempty"`
	SortType       int    `json:"sort_type,omitempty"`
	SortBy         string `json:"sort_by,omitempty"`
	PageSize       int    `json:"page_size,omitempty"`
}

type GetPackageDetailData

type GetPackageDetailData struct {
	PackageID     int `json:"package_id"`
	OrderInfoList []struct {
		OrderID string `json:"order_id"`
		SkuList []struct {
			Quantity string `json:"quantity"`
			SkuID    string `json:"sku_id"`
			SkuImage string `json:"sku_image"`
			SkuName  string `json:"sku_name"`
		} `json:"sku_list"`
	} `json:"order_info_list"`
	PackageStatus       int      `json:"package_status"`
	PackageFreezeStatus int      `json:"package_freeze_status"`
	ScTag               int      `json:"sc_tag"`
	PrintTag            int      `json:"print_tag"`
	SkuTag              int      `json:"sku_tag"`
	NoteTag             int      `json:"note_tag"`
	DeliveryOption      int      `json:"delivery_option"`
	ShippingProvider    string   `json:"shipping_provider"`
	ShippingProviderID  string   `json:"shipping_provider_id"`
	TrackingNumber      string   `json:"tracking_number"`
	PickUpType          int      `json:"pick_up_type"`
	PickUpStartTime     int      `json:"pick_up_start_time"`
	PickUpEndTime       int      `json:"pick_up_end_time"`
	CreateTime          int      `json:"create_time"`
	UpdateTime          int      `json:"update_time"`
	OrderLineIDList     []string `json:"order_line_id_list"`
}

type GetPackagePickupConfigData

type GetPackagePickupConfigData struct {
	IsPickUp       bool `json:"is_pick_up"`
	IsDropOff      bool `json:"is_drop_off"`
	PickUpTimeList []struct {
		StartTime string `json:"start_time"`
		EndTime   string `json:"end_time"`
		Available bool   `json:"available"`
	} `json:"pick_up_time_list"`
	DropOffPointURL string `json:"drop_off_point_url"`
}

type GetPackageShippingDocumentData

type GetPackageShippingDocumentData struct {
	DocURL string `json:"doc_url"`
}

type GetPackageShippingDocumentRequest

type GetPackageShippingDocumentRequest struct {
	PackageID    string `json:"package_id"  url:"package_id" validate:"required"`
	DocumentType int    `` /* 186-byte string literal not displayed */
	DocumentSize int    `` /* 203-byte string literal not displayed */
}

type GetPackageShippingInfoData

type GetPackageShippingInfoData struct {
	TrackingInfoList []struct {
		UpdateTime  int    `json:"update_time"`
		Description string `json:"description"`
	} `json:"tracking_info_list"`
}

type GetProductListData

type GetProductListData struct {
	Products []ProductItem `json:"products"`
	Total    int           `json:"total"`
}

type GetReverseListRequest

type GetReverseListRequest struct {
	UpdateTimeFrom     int `json:"update_time_from,omitempty"`
	UpdateTimeTo       int `json:"update_time_to,omitempty"`
	ReverseType        int `json:"reverse_type,omitempty" example:"REFUND_ONLY = 2 RETURN_AND_REFUND = 3 REQUEST_CANCEL = 4"`
	SortBy             int `json:"sort_by,omitempty" example:"REQUEST_TIME=0(default) UPDATE_TIME=1 REFUND_TOTAL=2"`
	SortType           int `json:"sort_type,omitempty"  example:"ASC=0 DESC=1(default)"`
	Offset             int `json:"offset" validate:"min=0"`
	Size               int `json:"size" validate:"required,min=1,max=100"`
	ReverseOrderStatus int `json:"reverse_order_status,omitempty"`
	OrderID            int `json:"order_id,omitempty"`
	ReverseOrderID     int `json:"reverse_order_id,omitempty"`
}

type GetReverseReasonRequest

type GetReverseReasonRequest struct {
	ReverseActionType int `` /* 170-byte string literal not displayed */
	ReasonType        int `` /* 139-byte string literal not displayed */
}

type GetShippingDocumentData

type GetShippingDocumentData struct {
	DocURL string `json:"doc_url"`
}

type GetShippingDocumentRequest

type GetShippingDocumentRequest struct {
	OrderID      string `json:"order_id"   url:"order_id,omitempty" validate:"required"`
	DocumentType string `` /* 290-byte string literal not displayed */
	DocumentSize string `` /* 195-byte string literal not displayed */
}

type GetShippingProviderData

type GetShippingProviderData struct {
	DeliveryOptionList []struct {
		DeliveryOptionID   string `json:"delivery_option_id"`
		DeliveryOptionName string `json:"delivery_option_name"`
		ItemWeightLimit    struct {
			MaxWeight int `json:"max_weight"`
			MinWeight int `json:"min_weight"`
		} `json:"item_weight_limit"`
		ItemDimensionLimit struct {
			Length int `json:"length"`
			Width  int `json:"width"`
			Height int `json:"height"`
		} `json:"item_dimension_limit"`
		ShippingProviderList []struct {
			ShippingProviderID   string `json:"shipping_provider_id"`
			ShippingProviderName string `json:"shipping_provider_name"`
		} `json:"shipping_provider_list"`
	} `json:"delivery_option_list"`
}

type GetSubscribedDeliveryData

type GetSubscribedDeliveryData struct {
	WarehouseList []struct {
		WarehouseDelivery []struct {
			DeliveryOption string `json:"delivery_option"`
			ServiceID      string `json:"service_id"`
			ServiceName    string `json:"service_name"`
		} `json:"warehouse_delivery"`
		WarehouseID string `json:"warehouse_id"`
	} `json:"warehouse_list"`
}

type GetSubscribedDeliveryRequest

type GetSubscribedDeliveryRequest struct {
	WarehouseIDList []string `json:"warehouse_id_list"`
}

type GetWarehouseListData

type GetWarehouseListData struct {
	WarehouseList []struct {
		WarehouseID           string `json:"warehouse_id"`
		WarehouseName         string `json:"warehouse_name"`
		WarehouseType         int    `json:"warehouse_type"`
		WarehouseSubType      int    `json:"warehouse_sub_type"`
		WarehouseEffectStatus int    `json:"warehouse_effect_status"`
		WarehouseAddress      struct {
			Region        string `json:"region"`
			State         string `json:"state"`
			City          string `json:"city"`
			District      string `json:"district"`
			Town          string `json:"town"`
			FullAddress   string `json:"full_address"`
			Zipcode       string `json:"zipcode"`
			Phone         string `json:"phone"`
			ContactPerson string `json:"contact_person"`
		} `json:"warehouse_address"`
	} `json:"warehouse_list"`
}

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

type Image

type Image struct {
	ID           string   `json:"id"`
	Height       int      `json:"height"`
	Width        int      `json:"width"`
	ThumbUrlList []string `json:"thumb_url_list"`
	UrlList      []string `json:"url_list"`
}

type ImageInfo

type ImageInfo struct {
	ImgID     string `json:"img_id"`
	ImgURL    string `json:"img_url"`
	ImgHeight int    `json:"img_height"`
	ImgWidth  int    `json:"img_width"`
	ImgScene  int    `json:"img_scene"`
}

type ImgID

type ImgID struct {
	ID string `json:"id"`
}

type ImgScene

type ImgScene int
const (
	ImgSceneProductImage ImgScene = iota + 1
	ImgSceneDescriptionImage
	ImgSceneAttributeImage
	ImgSceneCertificationImage
	ImgSceneSizeChartImage
)

type InputType

type InputType struct {
	IsMandatory        bool `json:"is_mandatory"`
	IsMultipleSelected bool `json:"is_multiple_selected"`
	IsCustomized       bool `json:"is_customized"`
}

type Item

type Item struct {
	SkuID               string  `json:"sku_id"`
	ProductID           string  `json:"product_id"`
	SkuName             string  `json:"sku_name"`
	Quantity            int     `json:"quantity"`
	SellerSku           string  `json:"seller_sku"`
	ProductName         string  `json:"product_name"`
	SkuImage            string  `json:"sku_image"`
	SkuOriginalPrice    float64 `json:"sku_original_price"`
	SkuSalePrice        float64 `json:"sku_sale_price"`
	SkuPlatformDiscount float64 `json:"sku_platform_discount"`
	SkuSellerDiscount   float64 `json:"sku_seller_discount"`
	SkuExtStatus        int     `json:"sku_ext_status"`
	SkuDisplayStatus    int     `json:"sku_display_status"`
	SkuCancelReason     string  `json:"sku_cancel_reason"`
	SkuCancelUser       string  `json:"sku_cancel_user"`
	SkuRtsTime          int     `json:"sku_rts_time"`
	SkuType             int     `json:"sku_type"`
}

type Logger

type Logger interface {
	Print(...interface{})
	Printf(string, ...interface{})
}

type LogisticsGetShippingInfoData

type LogisticsGetShippingInfoData struct {
	TrackingInfoList []struct {
		TrackingInfo []struct {
			UpdateTime  int64  `json:"update_time"`
			Description string `json:"description"`
		} `json:"tracking_info"`
	} `json:"tracking_info_list"`
}

type Option

type Option func(o *option)

func WithEndpoint

func WithEndpoint(e string) Option

WithEndpoint setup endpoint for request. TikTok is not support sandbox mode yet, but it will be lauching soon. You can also use this for mocking purpose.

func WithHTTPClient

func WithHTTPClient(c HTTPClient) Option

WithHTTPClient setup HTTPClient with given client.

func WithLogger

func WithLogger(l Logger) Option

WithLogger setup logger for debug perporse. Default Logger will be discard.

type Order

type Order struct {
	OrderID     string `json:"order_id"`
	OrderStatus int    `json:"order_status"`
	UpdateTime  int    `json:"update_time"`
}

type OrderDetail

type OrderDetail struct {
	OrderID                string           `json:"order_id"`
	OrderStatus            int              `json:"order_status"`
	PaymentMethod          string           `json:"payment_method"`
	DeliveryOption         string           `json:"delivery_option"`
	ShippingProvider       string           `json:"shipping_provider"`
	ShippingProviderID     string           `json:"shipping_provider_id"`
	CreateTime             string           `json:"create_time"`
	PaidTime               int64            `json:"paid_time"`
	BuyerMessage           string           `json:"buyer_message"`
	PaymentInfo            PaymentInfo      `json:"payment_info,omitempty"`
	RecipientAddress       RecipientAddress `json:"recipient_address,omitempty"`
	ItemList               []Item           `json:"item_list,omitempty"`
	CancelReason           string           `json:"cancel_reason"`
	CancelUser             string           `json:"cancel_user"`
	ExtStatus              int              `json:"ext_status"`
	OrderStatusOld         string           `json:"order_status_old"`
	TrackingNumber         string           `json:"tracking_number"`
	RtsTime                int              `json:"rts_time"`
	RtsSLA                 int              `json:"rts_sla"`
	TtsSLA                 int              `json:"tts_sla"`
	CancelOrderSLA         int              `json:"cancel_order_sla"`
	UpdateTime             int              `json:"update_time"`
	PackageList            []OrderPackage   `json:"package_list"`
	ReceiverAddressUpdated int              `json:"receiver_address_updated"`
	BuyerUID               string           `json:"buyer_uid"`
	SplitOrCombineTag      string           `json:"split_or_combine_tag"`
	FulfillmentType        int              `json:"fulfillment_type"`
	SellerNote             string           `json:"seller_note"`
	OrderLineList          []OrderLineList  `json:"order_line_list"`
}

type OrderDetailList

type OrderDetailList struct {
	OrderList []OrderDetail `json:"order_list"`
}

type OrderIDReq

type OrderIDReq struct {
	OrderID string `json:"order_id" url:"order_id,omitempty" validate:"required"`
}

type OrderLineList

type OrderLineList struct {
	OrderLineID string `json:"order_line_id"`
	SkuID       string `json:"sku_id"`
}

type OrderPackage

type OrderPackage struct {
	PackageID string `json:"package_id"`
}

type OrdersList

type OrdersList struct {
	OrderList  []Order `json:"order_list,omitempty"`
	More       bool    `json:"more"`
	NextCursor string  `json:"next_cursor"`
	Total      int     `json:"total"`
}

type PackageIDRequest

type PackageIDRequest struct {
	PackageID string `json:"package_id" url:"package_id,omitempty" validate:"required"`
}

type Param

type Param struct {
	AccessToken string `validate:"required"`
	ShopID      string `validate:"required"`
}

type PaymentInfo

type PaymentInfo struct {
	Currency                    string  `json:"currency"`
	SubTotal                    float64 `json:"sub_total"`
	ShippingFee                 float64 `json:"shipping_fee"`
	SellerDiscount              float64 `json:"seller_discount"`
	PlatformDiscount            float64 `json:"platform_discount"`
	TotalAmount                 float64 `json:"total_amount"`
	OriginalTotalProductPrice   float64 `json:"original_total_product_price"`
	OriginalShippingFee         float64 `json:"original_shipping_fee"`
	ShippingFeeSellerDiscount   float64 `json:"shipping_fee_seller_discount"`
	ShippingFeePlatformDiscount float64 `json:"shipping_fee_platform_discount"`
	Taxes                       float64 `json:"taxes"`
}

type Pickup

type Pickup struct {
	SelfShipment SelfShipment `json:"self_shipment"`
}

type PreCombinePkgData

type PreCombinePkgData struct {
	PackageList []struct {
		PackageID   string   `json:"package_id"`
		OrderIDList []string `json:"order_id_list"`
	} `json:"package_list"`

	FailedPackageList []struct {
		PackageID string `json:"package_id"`
		Code      int    `json:"code"`
		Message   string `json:"message"`
	} `json:"failed_package_list"`
}

type Price

type Price struct {
	Currency        string `json:"currency"`
	OriginalPrice   string `json:"original_price"`
	PriceIncludeVat string `json:"price_include_vat"`
}

type ProductAttr

type ProductAttr struct {
	AttributeID     string           `json:"attribute_id"`
	AttributeName   string           `json:"attribute_name"`
	AttributeValues []AttributeValue `json:"attribute_values"`
}

type ProductAttribute

type ProductAttribute struct {
	ID     string  `json:"id"`
	Name   string  `json:"name"`
	Values []Value `json:"values"`
}

type ProductCertification

type ProductCertification struct {
	Name        string `json:"name"`
	ID          string `json:"id"`
	Sample      string `json:"sample"`
	IsMandatory bool   `json:"is_mandatory"`
}

type ProductCertificationRequest

type ProductCertificationRequest struct {
	ID     string  `json:"id"`
	Files  []File  `json:"files"`
	Images []ImgID `json:"images"`
}

type ProductData

type ProductData struct {
	ProductID             string             `json:"product_id"`
	ProductStatus         int                `json:"product_status"` // 1-draft、2-pending、3-failed(initial creation)、4-live、5-seller_deactivated、6-platform_deactivated、7-freeze 8-deleted
	ProductName           string             `json:"product_name"`
	CategoryList          []Category         `json:"category_list"`
	Brand                 Brand              `json:"brand"`
	Images                []Image            `json:"images"`
	Video                 Video              `json:"video"`
	Description           string             `json:"description"`
	WarrantyPeriod        WarrantyPeriod     `json:"warranty_period"`
	WarrantyPolicy        string             `json:"warranty_policy"`
	PackageHeight         int                `json:"package_height"`
	PackageLength         int                `json:"package_length"`
	PackageWidth          int                `json:"package_width"`
	PackageWeight         string             `json:"package_weight"`
	Skus                  []SKUData          `json:"skus"`
	ProductCertifications []Certification    `json:"product_certifications"`
	SizeChart             Image              `json:"size_chart"`
	IsCodOpen             bool               `json:"is_cod_open"`
	ProductAttributes     []ProductAttribute `json:"product_attributes"`
	QcReasons             []QCReason         `json:"qc_reasons"`
	UpdateTime            int64              `json:"update_time"`
	CreateTime            int64              `json:"create_time"`
	DeliveryServices      []DeliveryService  `json:"delivery_services"`
}

type ProductItem

type ProductItem struct {
	CreateTime  int       `json:"create_time"`
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	SaleRegions []string  `json:"sale_regions"`
	Skus        []SkuItem `json:"skus"`
	Status      int       `json:"status"`
	UpdateTime  int       `json:"update_time"`
}

type ProductSearchRequest

type ProductSearchRequest struct {
	PageSize       int      `json:"page_size" validate:"min=1,max=100"`
	PageNumber     int      `json:"page_number" validate:"min=1"`
	SearchStatus   int      `json:"search_status,omitempty"`
	SellerSkuList  []string `json:"seller_sku_list,omitempty"`
	UpdateTimeFrom int64    `json:"update_time_from,omitempty"`
	UpdateTimeTo   int64    `json:"update_time_to,omitempty"`
	CreateTimeFrom int64    `json:"create_time_from,omitempty" `
	CreateTimeTo   int64    `json:"create_time_to,omitempty"`
}

type QCReason

type QCReason struct {
	Reason     string   `json:"reason"`
	SubReasons []string `json:"sub_reasons"`
}

type RecipientAddress

type RecipientAddress struct {
	FullAddress     string   `json:"full_address"`
	Region          string   `json:"region"`
	State           string   `json:"state"`
	City            string   `json:"city"`
	District        string   `json:"district"`
	Town            string   `json:"town"`
	Phone           string   `json:"phone"`
	Name            string   `json:"name"`
	Zipcode         string   `json:"zipcode"`
	AddressDetail   string   `json:"address_detail"`
	AddressLineList []string `json:"address_line_list"`
	RegionCode      string   `json:"region_code"`
}

type RefreshTokenRequest

type RefreshTokenRequest struct {
	AppKey       string `json:"app_key"`
	AppSecret    string `json:"app_secret"`
	RefreshToken string `json:"refresh_token"`
	GrantType    string `json:"grant_type"`
}

type RejectReverseRequest

type RejectReverseRequest struct {
	ReverseOrderID         string `json:"reverse_order_id"`
	ReverseRejectReasonKey string `json:"reverse_reject_reason_key"`
	ReverseRejectComments  string `json:"reverse_reject_comments"`
}

type RemovePackageOrderRequest

type RemovePackageOrderRequest struct {
	PackageID   string   `json:"package_id" validate:"required"`
	OrderIDList []string `json:"order_id_list" validate:"required,min=1"`
}

type Response

type Response struct {
	Code      int             `json:"code"`
	Message   string          `json:"message"`
	RequestID string          `json:"request_id"`
	Data      json.RawMessage `json:"data"`
}

type ReturnItem

type ReturnItem struct {
	ReturnProductID   string `json:"return_product_id"`
	ReturnProductName string `json:"return_product_name"`
	SkuID             string `json:"sku_id"`
	SellerSku         string `json:"seller_sku"`
	SkuName           string `json:"sku_name"`
	ReturnQuantity    int    `json:"return_quantity"`
	ProductImages     string `json:"product_images"`
}

type Reverse

type Reverse struct {
	ReverseOrderID     string          `json:"reverse_order_id"`
	OrderID            string          `json:"order_id"`
	RefundTotal        string          `json:"refund_total"`
	Currency           string          `json:"currency"`
	ReverseType        int             `json:"reverse_type"`
	ReturnReason       string          `json:"return_reason"`
	ReturnItemList     []ReturnItem    `json:"return_item_list"`
	ReverseStatusValue int             `json:"reverse_status_value"`
	ReverseRequestTime int             `json:"reverse_request_time"`
	ReverseUpdateTime  int             `json:"reverse_update_time"`
	ReturnTrackingID   string          `json:"return_tracking_id"`
	ReverseRecordList  []ReverseRecord `json:"reverse_record_list"`
}

type ReverseOrdersList

type ReverseOrdersList struct {
	ReverseList []Reverse `json:"reverse_list"`
	More        bool      `json:"more"`
}

type ReverseReason

type ReverseReason struct {
	ReverseReasonKey         string `json:"reverse_reason_key"`
	ReverseReason            string `json:"reverse_reason"`
	AvailableOrderStatusList []int  `json:"available_order_status_list"`
}

type ReverseReasonList

type ReverseReasonList struct {
	ReverseReasonList []ReverseReason `json:"reverse_reason_list"`
}

type ReverseRecord

type ReverseRecord struct {
	Description         string   `json:"description"`
	UpdateTime          int      `json:"update_time"`
	ReasonText          string   `json:"reason_text"`
	AdditionalMessage   string   `json:"additional_message"`
	AdditionalImageList []string `json:"additional_image_list"`
}

type SKU

type SKU struct {
	ID              string           `json:"id,omitempty"`
	SalesAttributes []SalesAttribute `json:"sales_attributes,omitempty"`
	StockInfos      []StockInfo      `json:"stock_infos,omitempty"`
	SellerSku       string           `json:"seller_sku,omitempty"`
	OriginalPrice   string           `json:"original_price,omitempty"`
}

type SKUData

type SKUData struct {
	ID              string      `json:"id"`
	SellerSku       string      `json:"seller_sku"`
	Price           Price       `json:"price"`
	StockInfos      []StockInfo `json:"stock_infos"`
	SalesAttributes []SalesAttr `json:"sales_attributes"`
}

type SKUPriceItem

type SKUPriceItem struct {
	ID            string `json:"id" validate:"required"`
	OriginalPrice string `json:"original_price" validate:"required"`
}

type SalesAttr

type SalesAttr struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	ValueID   string `json:"value_id"`
	ValueName string `json:"value_name"`
	SkuImg    Image  `json:"sku_img"`
}

type SalesAttribute

type SalesAttribute struct {
	AttributeID string `json:"attribute_id"`
	CustomValue string `json:"custom_value,omitempty"`
	SKUImage    *ImgID `json:"sku_img,omitempty"`
	ValueID     string `json:"value_id,omitempty"`
}

type SearchPackageData

type SearchPackageData struct {
	More        bool   `json:"more"`
	NextCursor  string `json:"next_cursor"`
	PackageList []struct {
		PackageID     string `json:"package_id"`
		PackageStatus int    `json:"package_status"`
		CreateTime    int64  `json:"create_time"`
		UpdateTime    int64  `json:"update_time"`
	} `json:"package_list"`
	Total int `json:"total"`
}

type SearchPackageRequest

type SearchPackageRequest struct {
	CreateTimeFrom int64  `json:"create_time_from,omitempty" `
	CreateTimeTo   int64  `json:"create_time_to,omitempty"`
	UpdateTimeFrom int64  `json:"update_time_from,omitempty"`
	UpdateTimeTo   int64  `json:"update_time_to,omitempty"`
	PackageStatus  int    `json:"package_status,omitempty"`
	Cursor         string `json:"cursor,omitempty"`
	SortBy         int    `` /* 139-byte string literal not displayed */
	SortType       int    `json:"sort_type,omitempty" validate:"omitempty,oneof=1 2" example:"ASC = 1 DESC = 2"`
	PageSize       int    `json:"page_size,omitempty" validate:"min=1,max=50"`
}

type SearchPreCombinePkgData

type SearchPreCombinePkgData struct {
	PreCombinePkgList []struct {
		PreCombinePkgID string   `json:"pre_combine_pkg_id"`
		OrderIDList     []string `json:"order_id_list"`
	} `json:"pre_combine_pkg_list"`
	NextCursor string `json:"next_cursor"`
	More       bool   `json:"more"`
	Total      int    `json:"total"`
}

type SearchPreCombinePkgRequest

type SearchPreCombinePkgRequest struct {
	Cursor   string `json:"cursor" url:"cursor,omitempty"`
	PageSize int    `json:"page_size"  url:"page_size" validate:"required,min=1,max=50"`
}

type SearchSettlementsRequest

type SearchSettlementsRequest struct {
	RequestTimeFrom int    `json:"request_time_from,omitempty"`
	RequestTimeTo   int    `json:"request_time_to,omitempty"`
	PageSize        int    `json:"page_size" validate:"required,min=1,max=100"`
	Cursor          string `json:"cursor,omitempty"`
	SortType        int    `json:"sort_type"  validate:"required" example:"Available values: 1 (DESC), 2 (ASC) Default value 1"`
}

type SearchTransactionsRequest

type SearchTransactionsRequest struct {
	RequestTimeFrom int   `json:"request_time_from,omitempty"`
	RequestTimeTo   int   `json:"request_time_to,omitempty"`
	TransactionType []int `json:"transaction_type" validate:"required,min=1" example:"Withdraw:1 Settle:2 Transfer:3 Reverse:4"`
	PageSize        int   `json:"page_size" validate:"required,min=1,max=100" `
	Offset          int   `json:"offset" validate:"gte=0,lte=10000"`
}

type SelfShipment

type SelfShipment struct {
	TrackingNumber     string `json:"tracking_number"`
	ShippingProviderID string `json:"shipping_provider_id"`
}

type Settlement

type Settlement struct {
	UniqueKey      int64          `json:"unique_key"`
	OrderID        string         `json:"order_id"`
	AdjustmentID   string         `json:"adjustment_id"`
	RelatedOrderID string         `json:"related_order_id"`
	SkuID          string         `json:"sku_id"`
	SkuName        string         `json:"sku_name"`
	ProductName    string         `json:"product_name"`
	SettlementInfo SettlementInfo `json:"settlement_info"`
}

type SettlementInfo

type SettlementInfo struct {
	SettlementTime      int    `json:"settlement_time"`
	Currency            string `json:"currency"`
	UserPay             string `json:"user_pay"`
	PlatformPromotion   string `json:"platform_promotion"`
	Refund              string `json:"refund"`
	PaymentFee          string `json:"payment_fee"`
	PlatformCommission  string `json:"platform_commission"`
	AffiliateCommission string `json:"affiliate_commission"`
	Vat                 string `json:"vat"`
	ShippingFee         string `json:"shipping_fee"`
	SettlementAmount    string `json:"settlement_amount"`
}

type SettlementsList

type SettlementsList struct {
	More           bool         `json:"more"`
	NextCursor     string       `json:"next_cursor"`
	SettlementList []Settlement `json:"settlement_list"`
}

type ShipOrderRequest

type ShipOrderRequest struct {
	OrderID string  `json:"order_id" validate:"required"`
	Pickup  *Pickup `json:"pick_up,omitempty"`
}

type ShipPackageData

type ShipPackageData struct {
	FailPackages []struct {
		FailCode   int    `json:"fail_code"`
		FailReason string `json:"fail_reason"`
		PackageID  string `json:"package_id"`
	} `json:"fail_packages"`
}

type ShipPackageRequest

type ShipPackageRequest struct {
	PackageID  string `json:"package_id"`
	PickUpType int    `json:"pick_up_type"`
	PickUp     struct {
		PickUpStartTime int `json:"pick_up_start_time"`
		PickUpEndTime   int `json:"pick_up_end_time"`
	} `json:"pick_up"`
	SelfShipment *struct {
		TrackingNumber     string `json:"tracking_number"`
		ShippingProviderID string `json:"shipping_provider_id"`
	} `json:"self_shipment,omitempty"`
}

type Shop

type Shop struct {
	ShopID   string      `json:"shop_id"`
	ShopName string      `json:"shop_name"`
	Region   string      `json:"region"`
	Type     json.Number `json:"type"`
}

type ShopList

type ShopList struct {
	Shops []Shop `json:"shop_list"`
}

type SizePic

type SizePic struct {
	ImgID string `json:"img_id" validate:"required"`
}

type SkuItem

type SkuItem struct {
	ID         string      `json:"id"`
	Price      Price       `json:"price"`
	SellerSku  string      `json:"seller_sku"`
	StockInfos []StockInfo `json:"stock_infos"`
}

type SkuStockItem

type SkuStockItem struct {
	ID         string      `json:"id"`
	StockInfos []StockInfo `json:"stock_infos"`
}

type StockInfo

type StockInfo struct {
	WarehouseID    string `json:"warehouse_id,omitempty"`
	AvailableStock int    `json:"available_stock"`
}

type Transaction

type Transaction struct {
	TransactionType     int    `json:"transaction_type"`
	TransactionTime     int    `json:"transaction_time"`
	TransactionAmount   string `json:"transaction_amount"`
	TransactionCurrency string `json:"transaction_currency"`
	TransactionStatus   int    `json:"transaction_status"`
}

type TransactionsList

type TransactionsList struct {
	More            bool          `json:"more"`
	Total           int           `json:"total"`
	TransactionList []Transaction `json:"transaction_list"`
}

type UpdatePackageShippingInfoData

type UpdatePackageShippingInfoData struct {
	FailedReason  string `json:"failed_reason"`
	UpdateSuccess bool   `json:"update_success"`
}

type UpdatePackageShippingInfoRequest

type UpdatePackageShippingInfoRequest struct {
	PackageID      string `json:"package_id" validate:"required"`
	TrackingNumber string `json:"tracking_number" validate:"required"`
	ProviderID     string `json:"provider_id" validate:"required"`
}

type UpdatePriceData

type UpdatePriceData struct {
	FailedSKUIDs []string `json:"failed_sku_ids"`
}

type UpdatePriceRequest

type UpdatePriceRequest struct {
	ProductID string         `json:"product_id" validate:"required"`
	Skus      []SKUPriceItem `json:"skus" validate:"min=1"`
}

type UpdateShippingInfoReq

type UpdateShippingInfoReq struct {
	OrderID        string `json:"order_id" validate:"required"`
	TrackingNumber string `json:"tracking_number" validate:"required"`
	ProviderID     string `json:"provider_id" validate:"required"`
}

type UpdateStockFailedSKU

type UpdateStockFailedSKU struct {
	FailedSKUs []FailedSKUStock `json:"failed_skus"`
}

type UpdateStockRequest

type UpdateStockRequest struct {
	ProductID string         `json:"product_id"`
	Skus      []SkuStockItem `json:"skus"`
}

type Value

type Value struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type VerifyOrderSplitData

type VerifyOrderSplitData struct {
	FailList []struct {
		FailReason string `json:"fail_reason"`
		OrderID    int64  `json:"order_id"`
	} `json:"fail_list"`
	ResultList []struct {
		OrderID           int64 `json:"order_id"`
		VerifyOrderResult bool  `json:"verify_order_result"`
	} `json:"result_list"`
}

type VerifyOrderSplitRequest

type VerifyOrderSplitRequest struct {
	OrderIDList []int64 `json:"order_id_list" validate:"required,min=1,max=50"`
}

type Video

type Video struct {
	Duration   float64     `json:"duration"`
	ID         string      `json:"id"`
	MediaType  string      `json:"media_type"`
	PostUrl    string      `json:"post_url"`
	VideoInfos []VideoInfo `json:"video_infos"`
}

type VideoInfo

type VideoInfo struct {
	BackupUrl string `json:"backup_url"`
	Bitrate   int    `json:"bitrate"`
	FileHash  string `json:"file_hash"`
	Format    string `json:"format"`
	Height    int    `json:"height"`
	MainUrl   string `json:"main_url"`
	Size      int    `json:"size"`
	UrlExpire int64  `json:"url_expire"`
	Width     int    `json:"width"`
}

type WarrantyPeriod

type WarrantyPeriod struct {
	WarrantyID          int    `json:"warranty_id"`
	WarrantyDescription string `json:"warranty_description"`
}

Jump to

Keyboard shortcuts

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