forked from thousandeyes/thousandeyes-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
integration.go
32 lines (28 loc) · 1.11 KB
/
integration.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package thousandeyes
import "fmt"
// Integration - Integration struct
type Integration struct {
AuthMethod *string `json:"authMethod,omitempty"`
AuthUser *string `json:"authUser,omitempty"`
AuthToken *string `json:"authToken,omitempty"`
Channel *string `json:"channel,omitempty"`
IntegrationID *string `json:"integrationId,omitempty"`
IntegrationName *string `json:"integrationName,omitempty"`
IntegrationType *string `json:"integrationType,omitempty"`
Target *string `json:"target,omitempty"`
}
// GetIntegrations - Get third party and webhook integrations
func (c *Client) GetIntegrations() (*[]Integration, error) {
resp, err := c.get("/integrations")
if err != nil {
return nil, err
}
var target map[string]map[string][]Integration
if dErr := c.decodeJSON(resp, &target); dErr != nil {
return nil, fmt.Errorf("Could not decode JSON response: %v", dErr)
}
var integrations []Integration
integrations = append(integrations, target["integrations"]["thirdParty"]...)
integrations = append(integrations, target["integrations"]["webhook"]...)
return &integrations, nil
}