github.com/muxinc/mux-go@v1.1.1/examples/data/incidents/exercise-incidents.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  
     7  	muxgo "github.com/muxinc/mux-go"
     8  	"github.com/muxinc/mux-go/examples/common"
     9  )
    10  
    11  func main() {
    12  
    13  	// API Client Initialization
    14  	client := muxgo.NewAPIClient(
    15  		muxgo.NewConfiguration(
    16  			muxgo.WithBasicAuth(os.Getenv("MUX_TOKEN_ID"), os.Getenv("MUX_TOKEN_SECRET")),
    17  		))
    18  
    19  	// Test coverage here is poor due to not knowning if the account we're testing against has any incidents.
    20  
    21  	// ========== list-incidents ==========
    22  	i, err := client.IncidentsApi.ListIncidents()
    23  	common.AssertNoError(err)
    24  	common.AssertNotNil(i.Data)
    25  	fmt.Println("list-incidents ✅")
    26  
    27  	// ========== get-incident ==========
    28  	fmt.Println("get-incident SKIP ⚠️")
    29  
    30  	// ========== list-related-incidents ==========
    31  	fmt.Println("list-related-incidents SKIP ⚠️")
    32  }