func (c *Client) Notify(interests []string, pushNotification PushNotification) (*NotifyResponse, error) {
	pNRequest := notificationRequest{
		interests,
		&pushNotification,
	}

	err := pNRequest.validate()
	if err != nil {
		return nil, err
	}

	if c.PushNotificationHost == "" {
		return nil, errors.New("PushNotificationHost not provided")
	}

	requestBody, err := json.Marshal(pNRequest)
	if err != nil {
		return nil, err
	}

	path := fmt.Sprintf("/%s/%s/apps/%s/notifications", PushNotifAPIPrefixDefault, PushNotifAPIVersionDefault, c.AppId)

	url, err := createRequestURL("POST", c.PushNotificationHost, path, c.Key, c.Secret, authTimestamp(), c.Secure, requestBody, nil, c.Cluster)
	if err != nil {
		return nil, err
	}

	byteResponse, err := c.request("POST", url, requestBody)
	if err != nil {
		return nil, err
	}

	var response *NotifyResponse
	err = json.Unmarshal(byteResponse, &response)
	if err != nil {
		return nil, err
	}

	return response, err
}
func (c *Client) Notify(interests []string, pushNotification PushNotification) (*NotifyResponse, error) {
	pNRequest := notificationRequest{
		interests,
		&pushNotification,
	}

	err := pNRequest.validate()
	if err != nil {
		return nil, err
	}

	if c.PushNotificationHost == "" {
		return nil, errors.New("PushNotificationHost not provided")
	}

	requestBody, err := json.Marshal(pNRequest)
	if err != nil {
		return nil, err
	}

	path := fmt.Sprintf("/%s/%s/apps/%s/notifications", PushNotifAPIPrefixDefault, PushNotifAPIVersionDefault, c.AppId)

	url, err := createRequestURL("POST", c.PushNotificationHost, path, c.Key, c.Secret, authTimestamp(), c.Secure, requestBody, nil, c.Cluster)
	if err != nil {
		return nil, err
	}

	byteResponse, err := c.request("POST", url, requestBody)
	if err != nil {
		return nil, err
	}

	var response *NotifyResponse
	err = json.Unmarshal(byteResponse, &response)
	if err != nil {
		return nil, err
	}

	return response, err
}
func ( c * Client ) Notify ( interests [ ] string , pushNotification PushNotification ) ( * NotifyResponse , error ) { pNRequest := notificationRequest { interests , & pushNotification , } err := pNRequest . validate ( ) if err != nil { return nil , err } if c . PushNotificationHost == " " { return nil , errors . New ( " " ) } requestBody , err := json . Marshal ( pNRequest ) if err != nil { return nil , err } path := fmt . Sprintf ( " " , PushNotifAPIPrefixDefault , PushNotifAPIVersionDefault , c . AppId ) url , err := createRequestURL ( " " , c . PushNotificationHost , path , c . Key , c . Secret , authTimestamp ( ) , c . Secure , requestBody , nil , c . Cluster ) if err != nil { return nil , err } byteResponse , err := c . request ( " " , url , requestBody ) if err != nil { return nil , err } var response * NotifyResponse err = json . Unmarshal ( byteResponse , & response ) if err != nil { return nil , err } return response , err }
/*
Notify is used to send native push notifications via Apple APNS or Google GCM/FCM systems. Please make sure that
you have provided a Client.PushNotificationHost, please see Pusher docs for details: https://pusher.com/docs/push_notifications
*/
/ * Notify is used to send native push notifications via Apple APNS or Google GCM / FCM systems . Please make sure that you have provided a Client . PushNotificationHost please see Pusher docs for details : https : // pusher . com / docs / push_notifications