func InitClient(config *CachetConfig) *cachet.Client {
	client, err := cachet.NewClient(config.CachetURL, nil)

	if err != nil {
		fmt.Printf("Error creating Cachet client: %s", err)
		return nil
	}

	_, resp, err := client.General.Ping()

	if resp.StatusCode != 200 || err == nil {
		fmt.Printf("Cachet server is not reachable: %s", err)
		return nil
	}

	switch config.AuthType {
	case "token":
		client.Authentication.SetTokenAuth(config.Token)
	case "basic":
		client.Authentication.SetBasicAuth(config.Username, config.Password)
	default:
		return nil
	}

	return client
}
// InitClient set up a client to connect to Cachet API
InitClient set up a client to connect to Cachet API
// InitClient set up a client to connect to Cachet API
func InitClient(config *CachetConfig) *cachet.Client {
	client, err := cachet.NewClient(config.CachetURL, nil)
	if err != nil {
		fmt.Printf("Error creating Cachet client: %s", err)
		return nil
	}
	_, resp, err := client.General.Ping()
	if resp.StatusCode != 200 || err == nil {
		fmt.Printf("Cachet server is not reachable: %s", err)
		return nil
	}
	switch config.AuthType {
	case "token":
		client.Authentication.SetTokenAuth(config.Token)
	case "basic":
		client.Authentication.SetBasicAuth(config.Username, config.Password)
	default:
		return nil
	}
	return client
}
func InitClient ( config * CachetConfig ) * cachet . Client { client , err := cachet . NewClient ( config . CachetURL , nil ) if err != nil { fmt . Printf ( " " , err ) return nil } _ , resp , err := client . General . Ping ( ) if resp . StatusCode != 200 || err == nil { fmt . Printf ( " " , err ) return nil } switch config . AuthType { case " " : client . Authentication . SetTokenAuth ( config . Token ) case " " : client . Authentication . SetBasicAuth ( config . Username , config . Password ) default : return nil } return client }
InitClient set up a client to connect to Cachet API
InitClient set up a client to connect to Cachet API