forked from cli/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttp.go
More file actions
32 lines (27 loc) · 730 Bytes
/
http.go
File metadata and controls
32 lines (27 loc) · 730 Bytes
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 archive
import (
"context"
"net/http"
"github.com/cli/cli/v2/api"
"github.com/cli/cli/v2/internal/ghinstance"
graphql "github.com/cli/shurcooL-graphql"
"github.com/shurcooL/githubv4"
)
func archiveRepo(client *http.Client, repo *api.Repository) error {
var mutation struct {
ArchiveRepository struct {
Repository struct {
ID string
}
} `graphql:"archiveRepository(input: $input)"`
}
variables := map[string]interface{}{
"input": githubv4.ArchiveRepositoryInput{
RepositoryID: repo.ID,
},
}
host := repo.RepoHost()
gql := graphql.NewClient(ghinstance.GraphQLEndpoint(host), client)
err := gql.MutateNamed(context.Background(), "ArchiveRepository", &mutation, variables)
return err
}