summaryrefslogtreecommitdiffstats
path: root/modules/structs/repo_tag.go
blob: 1bea5b36a560b60d118c5712663b4a44a68d3206 (plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT

package structs

import "time"

// Tag represents a repository tag
type Tag struct {
	Name                 string                   `json:"name"`
	Message              string                   `json:"message"`
	ID                   string                   `json:"id"`
	Commit               *CommitMeta              `json:"commit"`
	ZipballURL           string                   `json:"zipball_url"`
	TarballURL           string                   `json:"tarball_url"`
	ArchiveDownloadCount *TagArchiveDownloadCount `json:"archive_download_count"`
}

// AnnotatedTag represents an annotated tag
type AnnotatedTag struct {
	Tag                  string                     `json:"tag"`
	SHA                  string                     `json:"sha"`
	URL                  string                     `json:"url"`
	Message              string                     `json:"message"`
	Tagger               *CommitUser                `json:"tagger"`
	Object               *AnnotatedTagObject        `json:"object"`
	Verification         *PayloadCommitVerification `json:"verification"`
	ArchiveDownloadCount *TagArchiveDownloadCount   `json:"archive_download_count"`
}

// AnnotatedTagObject contains meta information of the tag object
type AnnotatedTagObject struct {
	Type string `json:"type"`
	URL  string `json:"url"`
	SHA  string `json:"sha"`
}

// CreateTagOption options when creating a tag
type CreateTagOption struct {
	// required: true
	TagName string `json:"tag_name" binding:"Required"`
	Message string `json:"message"`
	Target  string `json:"target"`
}

// TagArchiveDownloadCount counts how many times a archive was downloaded
type TagArchiveDownloadCount struct {
	Zip   int64 `json:"zip"`
	TarGz int64 `json:"tar_gz"`
}

// TagProtection represents a tag protection
type TagProtection struct {
	ID                 int64    `json:"id"`
	NamePattern        string   `json:"name_pattern"`
	WhitelistUsernames []string `json:"whitelist_usernames"`
	WhitelistTeams     []string `json:"whitelist_teams"`
	// swagger:strfmt date-time
	Created time.Time `json:"created_at"`
	// swagger:strfmt date-time
	Updated time.Time `json:"updated_at"`
}

// CreateTagProtectionOption options for creating a tag protection
type CreateTagProtectionOption struct {
	NamePattern        string   `json:"name_pattern"`
	WhitelistUsernames []string `json:"whitelist_usernames"`
	WhitelistTeams     []string `json:"whitelist_teams"`
}

// EditTagProtectionOption options for editing a tag protection
type EditTagProtectionOption struct {
	NamePattern        *string  `json:"name_pattern"`
	WhitelistUsernames []string `json:"whitelist_usernames"`
	WhitelistTeams     []string `json:"whitelist_teams"`
}