// Push sends a push notification
Push sends a push notification
// Push sends a push notification
func (c *Client) Push(push *Push) error {
	if push.Content == "" && push.PushContent == "" {
		return fmt.Errorf("Either Content, PushContent, or both must be provided")
	}
	reqJSON, err := json.Marshal(push)
	if err != nil {
		return err
	}
	req, err := http.NewRequest(http.MethodPost, fmt.Sprintf("%s/push", baseURL), bytes.NewBuffer(reqJSON))
	if err != nil {
		return err
	}
	req.Header.Add("Content-Type", "application/json")
	req.Header.Add("X-Authorization", c.config.key)
	req.Header.Add("X-UserId", c.config.userID)
	_, err = c.httpClient.Do(req)
	return err
}
func ( c * Client ) Push ( push * Push ) error { if push . Content == " " && push . PushContent == " " { return fmt . Errorf ( " " ) } reqJSON , err := json . Marshal ( push ) if err != nil { return err } req , err := http . NewRequest ( http . MethodPost , fmt . Sprintf ( " " , baseURL ) , bytes . NewBuffer ( reqJSON ) ) if err != nil { return err } req . Header . Add ( " " , " " ) req . Header . Add ( " " , c . config . key ) req . Header . Add ( " " , c . config . userID ) _ , err = c . httpClient . Do ( req ) return err }
Push sends a push notification
Push sends a push notification