예제 #1
0
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
}
예제 #2
0
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
}