Esempio n. 1
0
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
}
Esempio n. 2
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
}
Esempio n. 3
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
}