/
document.go
38 lines (33 loc) · 1.21 KB
/
document.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
33
34
35
36
37
38
package opslevel
import "github.com/shurcooL/graphql"
type ServiceDocumentSource struct {
Integration `graphql:"... on ApiDocIntegration"`
ServiceRepository `graphql:"... on ServiceRepository"`
}
type ServiceDocument struct {
Id graphql.ID `graphql:"id" json:"id"`
HtmlURL string `graphql:"htmlUrl" json:"htmUrl,omitempty"`
Source ServiceDocumentSource `graphql:"source" json:"source"`
Timestamps Timestamps `graphql:"timestamps" json:"timestamps"`
}
type ServiceDocumentContent struct {
ServiceDocument
Content string `graphql:"content" json:"content,omitempty"`
}
func (c *Client) ServiceApiDocSettingsUpdate(service string, docPath string, docSource *ApiDocumentSourceEnum) (*Service, error) {
var m struct {
Payload struct {
Service Service
Errors []OpsLevelErrors
} `graphql:"serviceApiDocSettingsUpdate(service: $service, apiDocumentPath: $docPath, preferredApiDocumentSource: $docSource)"`
}
v := PayloadVariables{
"service": *NewIdentifier(service),
"docPath": NewString(docPath),
"docSource": docSource,
}
if err := c.Mutate(&m, v); err != nil {
return nil, err
}
return &m.Payload.Service, FormatErrors(m.Payload.Errors)
}