github.com/google/go-github/v49@v49.1.0/github/repos_lfs.go (about) 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/en/rest/repos/lfs#enable-git-lfs-for-a-repository 16 func (s *RepositoriesService) EnableLFS(ctx context.Context, owner, repo string) (*Response, error) { 17 u := fmt.Sprintf("repos/%v/%v/lfs", owner, repo) 18 19 req, err := s.client.NewRequest("PUT", u, nil) 20 if err != nil { 21 return nil, err 22 } 23 24 resp, err := s.client.Do(ctx, req, nil) 25 if err != nil { 26 return resp, err 27 } 28 29 return resp, nil 30 } 31 32 // DisableLFS turns the LFS (Large File Storage) feature OFF for the selected repo. 33 // 34 // GitHub API docs: https://docs.github.com/en/rest/repos/lfs#disable-git-lfs-for-a-repository 35 func (s *RepositoriesService) DisableLFS(ctx context.Context, owner, repo string) (*Response, error) { 36 u := fmt.Sprintf("repos/%v/%v/lfs", owner, repo) 37 38 req, err := s.client.NewRequest("DELETE", u, nil) 39 if err != nil { 40 return nil, err 41 } 42 43 resp, err := s.client.Do(ctx, req, nil) 44 if err != nil { 45 return resp, err 46 } 47 48 return resp, nil 49 }