github.com/ungtb10d/cli/v2@v2.0.0-20221110210412-98537dd9d6a1/pkg/cmd/repo/archive/http.go (about) 1 package archive 2 3 import ( 4 "net/http" 5 6 "github.com/ungtb10d/cli/v2/api" 7 "github.com/shurcooL/githubv4" 8 ) 9 10 func archiveRepo(client *http.Client, repo *api.Repository) error { 11 var mutation struct { 12 ArchiveRepository struct { 13 Repository struct { 14 ID string 15 } 16 } `graphql:"archiveRepository(input: $input)"` 17 } 18 19 variables := map[string]interface{}{ 20 "input": githubv4.ArchiveRepositoryInput{ 21 RepositoryID: repo.ID, 22 }, 23 } 24 25 gql := api.NewClientFromHTTP(client) 26 err := gql.Mutate(repo.RepoHost(), "ArchiveRepository", &mutation, variables) 27 return err 28 }