Exposes in API the Repo entity's Size and IsBare property (#1668)
* Exposes in API the Repo entity's IsBare property as IsEmpty Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net> * Exposes in API the Repo entity's Size property Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
This commit is contained in:
		
							parent
							
								
									a503947fba
								
							
						
					
					
						commit
						98460a8d9d
					
				
					 4 changed files with 49 additions and 3 deletions
				
			
		|  | @ -285,6 +285,8 @@ func (repo *Repository) APIFormat(mode AccessMode) *api.Repository { | |||
| 		FullName:      repo.FullName(), | ||||
| 		Description:   repo.Description, | ||||
| 		Private:       repo.IsPrivate, | ||||
| 		Empty:         repo.IsBare, | ||||
| 		Size:          int(repo.Size/1024), | ||||
| 		Fork:          repo.IsFork, | ||||
| 		Mirror:        repo.IsMirror, | ||||
| 		HTMLURL:       repo.HTMLURL(), | ||||
|  |  | |||
							
								
								
									
										36
									
								
								vendor/code.gitea.io/sdk/gitea/hook.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										36
									
								
								vendor/code.gitea.io/sdk/gitea/hook.go
									
									
									
										generated
									
									
										vendored
									
									
								
							|  | @ -353,3 +353,39 @@ func (p *PullRequestPayload) SetSecret(secret string) { | |||
| func (p *PullRequestPayload) JSONPayload() ([]byte, error) { | ||||
| 	return json.MarshalIndent(p, "", "  ") | ||||
| } | ||||
| 
 | ||||
| //__________                           .__  __
 | ||||
| //\______   \ ____ ______   ____  _____|__|/  |_  ___________ ___.__.
 | ||||
| // |       _// __ \\____ \ /  _ \/  ___/  \   __\/  _ \_  __ <   |  |
 | ||||
| // |    |   \  ___/|  |_> >  <_> )___ \|  ||  | (  <_> )  | \/\___  |
 | ||||
| // |____|_  /\___  >   __/ \____/____  >__||__|  \____/|__|   / ____|
 | ||||
| //        \/     \/|__|              \/                       \/
 | ||||
| 
 | ||||
| // HookRepoAction an action that happens to a repo
 | ||||
| type HookRepoAction string | ||||
| 
 | ||||
| const ( | ||||
| 	// HookRepoCreated created
 | ||||
| 	HookRepoCreated HookRepoAction = "created" | ||||
| 	// HookRepoDeleted deleted
 | ||||
| 	HookRepoDeleted HookRepoAction = "deleted" | ||||
| ) | ||||
| 
 | ||||
| // RepositoryPayload payload for repository webhooks
 | ||||
| type RepositoryPayload struct { | ||||
| 	Secret       string         `json:"secret"` | ||||
| 	Action       HookRepoAction `json:"action"` | ||||
| 	Repository   *Repository    `json:"repository"` | ||||
| 	Organization *User          `json:"organization"` | ||||
| 	Sender       *User          `json:"sender"` | ||||
| } | ||||
| 
 | ||||
| // SetSecret set the payload's secret
 | ||||
| func (p *RepositoryPayload) SetSecret(secret string) { | ||||
| 	p.Secret = secret | ||||
| } | ||||
| 
 | ||||
| // JSONPayload JSON representation of the payload
 | ||||
| func (p *RepositoryPayload) JSONPayload() ([]byte, error) { | ||||
| 	return json.MarshalIndent(p, "", " ") | ||||
| } | ||||
|  |  | |||
							
								
								
									
										8
									
								
								vendor/code.gitea.io/sdk/gitea/repo.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/code.gitea.io/sdk/gitea/repo.go
									
									
									
										generated
									
									
										vendored
									
									
								
							|  | @ -26,9 +26,11 @@ type Repository struct { | |||
| 	Name          string      `json:"name"` | ||||
| 	FullName      string      `json:"full_name"` | ||||
| 	Description   string      `json:"description"` | ||||
| 	Empty         bool        `json:"empty"` | ||||
| 	Private       bool        `json:"private"` | ||||
| 	Fork          bool        `json:"fork"` | ||||
| 	Mirror        bool        `json:"mirror"` | ||||
| 	Size          int         `json:"size"` | ||||
| 	HTMLURL       string      `json:"html_url"` | ||||
| 	SSHURL        string      `json:"ssh_url"` | ||||
| 	CloneURL      string      `json:"clone_url"` | ||||
|  | @ -156,3 +158,9 @@ func (c *Client) MigrateRepo(opt MigrateRepoOption) (*Repository, error) { | |||
| 	repo := new(Repository) | ||||
| 	return repo, c.getParsedResponse("POST", "/repos/migrate", jsonHeader, bytes.NewReader(body), repo) | ||||
| } | ||||
| 
 | ||||
| // MirrorSync adds a mirrored repository to the mirror sync queue.
 | ||||
| func (c *Client) MirrorSync(owner, repo string) error { | ||||
| 	_, err := c.getResponse("POST", fmt.Sprintf("/repos/%s/%s/mirror-sync", owner, repo), nil, nil) | ||||
| 	return err | ||||
| } | ||||
|  |  | |||
							
								
								
									
										6
									
								
								vendor/vendor.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								vendor/vendor.json
									
									
									
									
										vendored
									
									
								
							|  | @ -9,10 +9,10 @@ | |||
| 			"revisionTime": "2017-05-04T06:58:26Z" | ||||
| 		}, | ||||
| 		{ | ||||
| 			"checksumSHA1": "vdziKobpPIkU/dLvSI8n7eWrIIE=", | ||||
| 			"checksumSHA1": "L58DGmGw5eZThPkaHEaY9vuz42g=", | ||||
| 			"path": "code.gitea.io/sdk/gitea", | ||||
| 			"revision": "d2f87fd3f9f2887b9f15112cec8d7f53b2825147", | ||||
| 			"revisionTime": "2017-04-30T15:33:16Z" | ||||
| 			"revision": "1350cdb0d049083453c93dcabfcac2e7ba553951", | ||||
| 			"revisionTime": "2017-05-04T17:35:58Z" | ||||
| 		}, | ||||
| 		{ | ||||
| 			"checksumSHA1": "IyfS7Rbl6OgR83QR7TOfKdDCq+M=", | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue