Debian Codegraph @

github/repos_lfs.go

raw
1 // Copyright 2022 The go-github AUTHORS. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file.
5
6 package github
7
8 import (
9 "context"
10 "fmt"
11 )
12
13 // EnableLFS turns the LFS (Large File Storage) feature ON for the selected repo.
14 //
15 // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/repos/lfs#enable-git-lfs-for-a-repository
16 //
17 //meta:operation PUT /repos/{owner}/{repo}/lfs
18 func (s *RepositoriesService) EnableLFS(ctx context.Context, owner, repo string) (*Response, error) {
19 u := fmt.Sprintf("repos/%v/%v/lfs", owner, repo)
20
21 req, err := s.client.NewRequest("PUT", u, nil)
22 if err != nil {
23 return nil, err
24 }
25
26 resp, err := s.client.Do(ctx, req, nil)
27 if err != nil {
28 return resp, err
29 }
30
31 return resp, nil
32 }
33
34 // DisableLFS turns the LFS (Large File Storage) feature OFF for the selected repo.
35 //
36 // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/repos/lfs#disable-git-lfs-for-a-repository
37 //
38 //meta:operation DELETE /repos/{owner}/{repo}/lfs
39 func (s *RepositoriesService) DisableLFS(ctx context.Context, owner, repo string) (*Response, error) {
40 u := fmt.Sprintf("repos/%v/%v/lfs", owner, repo)
41
42 req, err := s.client.NewRequest("DELETE", u, nil)
43 if err != nil {
44 return nil, err
45 }
46
47 resp, err := s.client.Do(ctx, req, nil)
48 if err != nil {
49 return resp, err
50 }
51
52 return resp, nil
53 }