request

package
v0.0.0-...-972b573 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCallYonSuiteAPIFailed = errors.New("call yonsuite api failed")    // 查询API未正确返回
	ErrYonSuiteAPIBizError   = errors.New("call yonsuite api biz error") // 查询API正常返回,但是结果不正确
	ErrAPILimit              = errors.New("reached yonsuite api limit")  // API限流
	ErrAPITooManyCalls       = errors.New("too many yonsuite api calls") // 操作过于频繁
	ErrNotFound              = errors.New("not found")
)
View Source
var AdminDeptTreeURL = URLRoot + "/yonbip/digitalModel/admindept/tree"
View Source
var CurrencyDetailURL = URLRoot + "/yonbip/digitalModel/currency/detail"
View Source
var CurrencyListURL = URLRoot + "/yonbip/digitalModel/currency/list"

digitalModel

View Source
var ExchangeRateListURL = URLRoot + "/yonbip/digitalModel/exchangerate/list"
View Source
var ExchangeRateTypeListURL = URLRoot + "/yonbip/digitalModel/exchangeratetype/list"
View Source
var GoodsPositionTree = URLRoot + "/yonbip/digitalModel/goodsposition/tree"
View Source
var GoodsProductSKUProList = URLRoot + "/yonbip/digitalModel/goodsproductskupro/list"
View Source
var LocationStockAnalysisList = URLRoot + "/yonbip/scm/locationstockanalysis/list"
View Source
var MerchantDetailURL = URLRoot + "/yonbip/digitalModel/merchant/detail"
View Source
var MerchantListURL = URLRoot + "/yonbip/digitalModel/merchant/list"
View Source
var MerchantProductPriceURL = URLRoot + "/yonbip/sd/goods/price/customerproduct/list"

sd

View Source
var MorphologyConversionBatchAuditURL = URLRoot + "/yonbip/scm/morphologyconversion/batchaudit"
View Source
var MorphologyConversionSaveURL = URLRoot + "/yonbip/scm/morphologyconversion/save"
View Source
var OrgUnitTreeURL = URLRoot + "/yonbip/digitalModel/orgunit/querytree"
View Source
var OthInRecordDetailURL = URLRoot + "/yonbip/scm/othinrecord/detail"
View Source
var OthInRecordListURL = URLRoot + "/yonbip/scm/othinrecord/list"

scm

View Source
var OthOutRecordDetailURL = URLRoot + "/yonbip/scm/othoutrecord/detail"
View Source
var OthOutRecordListURL = URLRoot + "/yonbip/scm/othoutrecord/list"
View Source
var ProductDetailURL = URLRoot + "/yonbip/digitalModel/product/detail"
View Source
var ProductListURL = URLRoot + "/yonbip/digitalModel/product/list"
View Source
var PurInRecordDetailURL = URLRoot + "/yonbip/scm/purinrecord/detail"
View Source
var PurInRecordListURL = URLRoot + "/yonbip/scm/purinrecord/list"
View Source
var QueryCurrentStocksByConditionURL = URLRoot + "/yonbip/scm/stock/QueryCurrentStocksByCondition"
View Source
var SNFlowDirectionListURL = URLRoot + "/yonbip/scm/snflowdirection/list"
View Source
var SNQuerySNStateListURL = URLRoot + "/yonbip/scm/snQuerysnstate/list"
View Source
var SalesOutDetailURL = URLRoot + "/yonbip/scm/salesout/detail"
View Source
var SalesOutListURL = URLRoot + "/yonbip/scm/salesout/list"
View Source
var StaffDetailURL = URLRoot + "/yonbip/digitalModel/staff/detail"
View Source
var StaffListURL = URLRoot + "/yonbip/digitalModel/staff/list"
View Source
var StockAnalysisList = URLRoot + "/yonbip/scm/stockanalysis/list"
View Source
var StoreInDetailURL = URLRoot + "/yonbip/scm/storein/detail"
View Source
var StoreInListURL = URLRoot + "/yonbip/scm/storein/list"
View Source
var StoreOutDetailURL = URLRoot + "/yonbip/scm/storeout/detail"
View Source
var StoreOutListURL = URLRoot + "/yonbip/scm/storeout/list"
View Source
var StoreTransferListURL = URLRoot + "/yonbip/scm/storetransfer/list"
View Source
var SuitGoodsQueryURL = URLRoot + "/yonbip/sd/dst/suitgoods/query"
View Source
var TradeOrderHoldURL = URLRoot + "/yonbip/sd/dst/tradeorder/tradehold"
View Source
var TradeOrderQueryURL = URLRoot + "/yonbip/sd/dst/tradeorder/query"
View Source
var TradeVouchImportURL = URLRoot + "/yonbip/sd/dst/tradevouch/import"

dst

View Source
var TradeVouchQueryURL = URLRoot + "/yonbip/sd/dst/tradevouch/query"
View Source
var TransactionListURL = URLRoot + "/yonbip/digitalModel/transtype/list"
View Source
var TransactionTreeURL = URLRoot + "/yonbip/digitalModel/transtype/tree"
View Source
var TransferApplyBatchAuditURL = URLRoot + "/yonbip/scm/transferapply/batchaudit"
View Source
var TransferApplyListURL = URLRoot + "/yonbip/scm/transferapply/list"
View Source
var TransferApplySaveURL = URLRoot + "/yonbip/scm/transferapply/save"
View Source
var TransferReqBatchAuditURL = URLRoot + "/yonbip/scm/transferreq/batchaudit"
View Source
var TransferReqListURL = URLRoot + "/yonbip/scm/transferreq/list"
View Source
var TransferReqSaveURL = URLRoot + "/yonbip/scm/transferreq/save"
View Source
var URLRoot = "https://c2.yonyoucloud.com/iuap-api-gateway"
View Source
var VoucherDeliveryBatchDeleteURL = URLRoot + "/yonbip/sd/voucherdelivery/batchdelete"
View Source
var VoucherDeliveryListURL = URLRoot + "/yonbip/sd/voucherdelivery/list"
View Source
var VoucherDeliveryUnauditURL = URLRoot + "/yonbip/sd/voucherdelivery/unaudit"
View Source
var VoucherOrderBatchAuditURL = URLRoot + "/yonbip/sd/voucherorder/batchaudit"
View Source
var VoucherOrderCloseURL = URLRoot + "/yonbip/sd/voucherorder/close"
View Source
var VoucherOrderDetailURL = URLRoot + "/yonbip/sd/voucherorder/detail"
View Source
var VoucherOrderListURL = URLRoot + "/yonbip/sd/voucherorder/list"
View Source
var VoucherOrderSaveURL = URLRoot + "/yonbip/sd/voucherorder/save"
View Source
var VoucherSaleReturnDetailURL = URLRoot + "/yonbip/sd/vouchersalereturn/detail"
View Source
var VoucherSaleReturnListURL = URLRoot + "/yonbip/sd/vouchersalereturn/list"
View Source
var WarehouseDetailURL = URLRoot + "/yonbip/digitalModel/warehouse/detail"
View Source
var WarehouseListURL = URLRoot + "/yonbip/digitalModel/warehouse/list"

Functions

func ConvertValuesTo

func ConvertValuesTo[T any](input interface{}) (T, error)

Types

type EventContent

type EventContent struct {
	AccessToken    string      `json:"access_token"`
	YHTUser        string      `json:"yhtUser"`
	TenantId       string      `json:"tenantId"`
	Archive        string      `json:"archive"`
	YHTAccessToken string      `json:"yht_access_token"`
	Fullname       string      `json:"fullname"`
	Id             json.Number `json:"id"`
	EventParams    struct {
		Data []Values `json:"data"`
	} `json:"eventParams"` // 库存分配事件的数据在这里
	EventParam struct {
		Data []Values `json:"data"`
	} `json:"eventParam"` // sn状态变更事件的数据在这里
}

func (EventContent) String

func (e EventContent) String() string

func (EventContent) UnmarshalArchive

func (e EventContent) UnmarshalArchive() (Values, error)

type EventMessage

type EventMessage struct {
	Signature  string `json:"msgSignature"`
	Timestamp  int64  `json:"timestamp"`
	Nonce      string `json:"nonce"`
	Ciphertext string `json:"encrypt"`
}

func ParseEventMessage

func ParseEventMessage(message string) (EventMessage, error)

func (EventMessage) Decrypt

func (e EventMessage) Decrypt(appKey, appSecret string) (EventPlaintext, error)

func (EventMessage) String

func (e EventMessage) String() string

type EventPlaintext

type EventPlaintext struct {
	EventType     string   `json:"type"`
	EventId       string   `json:"eventId"`
	Timestamp     int64    `json:"timestamp"`
	TenantId      string   `json:"tenantId"`
	StaffIds      []string `json:"staffId"`
	DepartmentIds []string `json:"deptId"`
	UserIds       []string `json:"userId"`
	Content       string   `json:"content"`
}

func (EventPlaintext) String

func (e EventPlaintext) String() string

func (EventPlaintext) UnmarshalContent

func (e EventPlaintext) UnmarshalContent() (EventContent, error)

type Request

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

func New

func New(appKey, appSecret string) Request

func (Request) Get

func (req Request) Get(url string, params map[string]string) (Values, error)

func (Request) Post

func (req Request) Post(url string, body interface{}) (Values, error)

type URLRootResponse

type URLRootResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Data    struct {
		GatewayURL string `json:"gatewayUrl"`
		TokenURL   string `json:"tokenUrl"`
	} `json:"data"`
}

type Values

type Values map[string]interface{}

func (Values) Delete

func (vals Values) Delete(key string)

func (Values) Get

func (vals Values) Get(key string) interface{}

func (Values) GetResult

func (vals Values) GetResult(resType interface{}) (interface{}, error)

func (Values) Set

func (vals Values) Set(key string, value interface{})

func (Values) String

func (vals Values) String() string

func (Values) ToQueryParams

func (vals Values) ToQueryParams() (map[string]string, error)

Jump to

Keyboard shortcuts

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