本文整理汇总了Golang中github.com/gotokatsuya/growthpush/dispatcher.Client类的典型用法代码示例。如果您正苦于以下问题:Golang Client类的具体用法?Golang Client怎么用?Golang Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Client类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: CreateNewEvent
func CreateNewEvent(client *dispatcher.Client, req CreateNewEventRequest) (*CreateNewEventResponse, error) {
parameters, err := util.JSONToMapString(req)
if err != nil {
return nil, err
}
body, err := client.DispatchPostRequest(endpoint, parameters)
if err != nil {
return nil, err
}
resp := new(CreateNewEventResponse)
if err := json.Unmarshal(body, resp); err != nil {
return nil, err
}
return resp, nil
}
示例2: GetEvents
func GetEvents(client *dispatcher.Client, req GetEventsRequest) ([]GetEventsResponse, error) {
parameters, err := util.JSONToMapString(req)
if err != nil {
return nil, err
}
body, err := client.DispatchGetRequest(endpoint, parameters)
if err != nil {
return nil, err
}
var respList []GetEventsResponse
if err := json.Unmarshal(body, &respList); err != nil {
return nil, err
}
return respList, nil
}
示例3: GetClientByToken
func GetClientByToken(client *dispatcher.Client, req GetClientByTokenRequest) (*GetClientByTokenResponse, error) {
parameters, err := util.JSONToMapString(req)
if err != nil {
return nil, err
}
body, err := client.DispatchGetRequest(path.Join(endpoint, "token", req.Token), parameters)
if err != nil {
return nil, err
}
resp := new(GetClientByTokenResponse)
if err := json.Unmarshal(body, resp); err != nil {
return nil, err
}
return resp, nil
}