github.com/wtfutil/wtf@v0.43.0/modules/newrelic/client/mobile_applications.go (about) 1 package newrelic 2 3 import ( 4 "strconv" 5 ) 6 7 // MobileApplicationSummary describes an Application's host. 8 type MobileApplicationSummary struct { 9 ActiveUsers int `json:"active_users,omitempty"` 10 LaunchCount int `json:"launch_count,omitempty"` 11 Throughput float64 `json:"throughput,omitempty"` 12 ResponseTime float64 `json:"response_time,omitempty"` 13 CallsPerSession float64 `json:"calls_per_session,omitempty"` 14 InteractionTime float64 `json:"interaction_time,omitempty"` 15 FailedCallRate float64 `json:"failed_call_rate,omitempty"` 16 RemoteErrorRate float64 `json:"remote_error_rate"` 17 } 18 19 // MobileApplicationCrashSummary describes a MobileApplication's crash data. 20 type MobileApplicationCrashSummary struct { 21 SupportsCrashData bool `json:"supports_crash_data,omitempty"` 22 UnresolvedCrashCount int `json:"unresolved_crash_count,omitempty"` 23 CrashCount int `json:"crash_count,omitempty"` 24 CrashRate float64 `json:"crash_rate,omitempty"` 25 } 26 27 // MobileApplication describes a New Relic Application Host. 28 type MobileApplication struct { 29 ID int `json:"id,omitempty"` 30 Name string `json:"name,omitempty"` 31 HealthStatus string `json:"health_status,omitempty"` 32 Reporting bool `json:"reporting,omitempty"` 33 MobileSummary MobileApplicationSummary `json:"mobile_summary,omitempty"` 34 CrashSummary MobileApplicationCrashSummary `json:"crash_summary,omitempty"` 35 } 36 37 // GetMobileApplications returns a slice of New Relic Mobile Applications. 38 func (c *Client) GetMobileApplications() ([]MobileApplication, error) { 39 resp := &struct { 40 Applications []MobileApplication `json:"applications,omitempty"` 41 }{} 42 path := "mobile_applications.json" 43 err := c.doGet(path, nil, resp) 44 if err != nil { 45 return nil, err 46 } 47 return resp.Applications, nil 48 } 49 50 // GetMobileApplication returns a single Mobile Application with the id. 51 func (c *Client) GetMobileApplication(id int) (*MobileApplication, error) { 52 resp := &struct { 53 Application MobileApplication `json:"application,omitempty"` 54 }{} 55 path := "mobile_applications/" + strconv.Itoa(id) + ".json" 56 err := c.doGet(path, nil, resp) 57 if err != nil { 58 return nil, err 59 } 60 return &resp.Application, nil 61 }