Move sdk structs to modules/structs (#6905)
* move sdk structs to moduels/structs * fix tests * fix fmt * fix swagger * fix vendortokarchuk/v1.17
parent
1658cd04e9
commit
34eee25bd4
@ -0,0 +1,27 @@ |
|||||||
|
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package structs // import "code.gitea.io/gitea/modules/structs"
|
||||||
|
import ( |
||||||
|
"time" |
||||||
|
) |
||||||
|
|
||||||
|
// Attachment a generic attachment
|
||||||
|
// swagger:model
|
||||||
|
type Attachment struct { |
||||||
|
ID int64 `json:"id"` |
||||||
|
Name string `json:"name"` |
||||||
|
Size int64 `json:"size"` |
||||||
|
DownloadCount int64 `json:"download_count"` |
||||||
|
// swagger:strfmt date-time
|
||||||
|
Created time.Time `json:"created_at"` |
||||||
|
UUID string `json:"uuid"` |
||||||
|
DownloadURL string `json:"browser_download_url"` |
||||||
|
} |
||||||
|
|
||||||
|
// EditAttachmentOptions options for editing attachments
|
||||||
|
// swagger:model
|
||||||
|
type EditAttachmentOptions struct { |
||||||
|
Name string `json:"name"` |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package structs |
||||||
|
|
||||||
|
// CreateForkOption options for creating a fork
|
||||||
|
type CreateForkOption struct { |
||||||
|
// organization name, if forking into an organization
|
||||||
|
Organization *string `json:"organization"` |
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package structs |
||||||
|
|
||||||
|
// GitHook represents a Git repository hook
|
||||||
|
type GitHook struct { |
||||||
|
Name string `json:"name"` |
||||||
|
IsActive bool `json:"is_active"` |
||||||
|
Content string `json:"content,omitempty"` |
||||||
|
} |
||||||
|
|
||||||
|
// GitHookList represents a list of Git hooks
|
||||||
|
type GitHookList []*GitHook |
||||||
|
|
||||||
|
// EditGitHookOption options when modifying one Git hook
|
||||||
|
type EditGitHookOption struct { |
||||||
|
Content string `json:"content"` |
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
// Copyright 2016 The Gogs Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package structs |
||||||
|
|
||||||
|
import ( |
||||||
|
"time" |
||||||
|
) |
||||||
|
|
||||||
|
// Comment represents a comment on a commit or issue
|
||||||
|
type Comment struct { |
||||||
|
ID int64 `json:"id"` |
||||||
|
HTMLURL string `json:"html_url"` |
||||||
|
PRURL string `json:"pull_request_url"` |
||||||
|
IssueURL string `json:"issue_url"` |
||||||
|
Poster *User `json:"user"` |
||||||
|
Body string `json:"body"` |
||||||
|
// swagger:strfmt date-time
|
||||||
|
Created time.Time `json:"created_at"` |
||||||
|
// swagger:strfmt date-time
|
||||||
|
Updated time.Time `json:"updated_at"` |
||||||
|
} |
||||||
|
|
||||||
|
// CreateIssueCommentOption options for creating a comment on an issue
|
||||||
|
type CreateIssueCommentOption struct { |
||||||
|
// required:true
|
||||||
|
Body string `json:"body" binding:"Required"` |
||||||
|
} |
||||||
|
|
||||||
|
// EditIssueCommentOption options for editing a comment
|
||||||
|
type EditIssueCommentOption struct { |
||||||
|
// required: true
|
||||||
|
Body string `json:"body" binding:"Required"` |
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
// Copyright 2016 The Gogs Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package structs |
||||||
|
|
||||||
|
// Label a label to an issue or a pr
|
||||||
|
// swagger:model
|
||||||
|
type Label struct { |
||||||
|
ID int64 `json:"id"` |
||||||
|
Name string `json:"name"` |
||||||
|
// example: 00aabb
|
||||||
|
Color string `json:"color"` |
||||||
|
URL string `json:"url"` |
||||||
|
} |
||||||
|
|
||||||
|
// CreateLabelOption options for creating a label
|
||||||
|
type CreateLabelOption struct { |
||||||
|
// required:true
|
||||||
|
Name string `json:"name" binding:"Required"` |
||||||
|
// required:true
|
||||||
|
// example: #00aabb
|
||||||
|
Color string `json:"color" binding:"Required;Size(7)"` |
||||||
|
} |
||||||
|
|
||||||
|
// EditLabelOption options for editing a label
|
||||||
|
type EditLabelOption struct { |
||||||
|
Name *string `json:"name"` |
||||||
|
Color *string `json:"color"` |
||||||
|
} |
||||||
|
|
||||||
|
// IssueLabelsOption a collection of labels
|
||||||
|
type IssueLabelsOption struct { |
||||||
|
// list of label IDs
|
||||||
|
Labels []int64 `json:"labels"` |
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
// Copyright 2016 The Gogs Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package structs |
||||||
|
|
||||||
|
import ( |
||||||
|
"time" |
||||||
|
) |
||||||
|
|
||||||
|
// Milestone milestone is a collection of issues on one repository
|
||||||
|
type Milestone struct { |
||||||
|
ID int64 `json:"id"` |
||||||
|
Title string `json:"title"` |
||||||
|
Description string `json:"description"` |
||||||
|
State StateType `json:"state"` |
||||||
|
OpenIssues int `json:"open_issues"` |
||||||
|
ClosedIssues int `json:"closed_issues"` |
||||||
|
// swagger:strfmt date-time
|
||||||
|
Closed *time.Time `json:"closed_at"` |
||||||
|
// swagger:strfmt date-time
|
||||||
|
Deadline *time.Time `json:"due_on"` |
||||||
|
} |
||||||
|
|
||||||
|
// CreateMilestoneOption options for creating a milestone
|
||||||
|
type CreateMilestoneOption struct { |
||||||
|
Title string `json:"title"` |
||||||
|
Description string `json:"description"` |
||||||
|
// swagger:strfmt date-time
|
||||||
|
Deadline *time.Time `json:"due_on"` |
||||||
|
} |
||||||
|
|
||||||
|
// EditMilestoneOption options for editing a milestone
|
||||||
|
type EditMilestoneOption struct { |
||||||
|
Title string `json:"title"` |
||||||
|
Description *string `json:"description"` |
||||||
|
State *string `json:"state"` |
||||||
|
Deadline *time.Time `json:"due_on"` |
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package structs |
||||||
|
|
||||||
|
import ( |
||||||
|
"time" |
||||||
|
) |
||||||
|
|
||||||
|
// TrackedTime worked time for an issue / pr
|
||||||
|
type TrackedTime struct { |
||||||
|
ID int64 `json:"id"` |
||||||
|
// swagger:strfmt date-time
|
||||||
|
Created time.Time `json:"created"` |
||||||
|
// Time in seconds
|
||||||
|
Time int64 `json:"time"` |
||||||
|
UserID int64 `json:"user_id"` |
||||||
|
IssueID int64 `json:"issue_id"` |
||||||
|
} |
||||||
|
|
||||||
|
// TrackedTimes represent a list of tracked times
|
||||||
|
type TrackedTimes []*TrackedTime |
||||||
|
|
||||||
|
// AddTimeOption options for adding time to an issue
|
||||||
|
type AddTimeOption struct { |
||||||
|
// time in seconds
|
||||||
|
// required: true
|
||||||
|
Time int64 `json:"time" binding:"Required"` |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
// Copyright 2016 The Gogs Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package structs |
||||||
|
|
||||||
|
// AddOrgMembershipOption add user to organization options
|
||||||
|
type AddOrgMembershipOption struct { |
||||||
|
Role string `json:"role" binding:"Required"` |
||||||
|
} |
@ -0,0 +1,50 @@ |
|||||||
|
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package structs |
||||||
|
|
||||||
|
import ( |
||||||
|
"time" |
||||||
|
) |
||||||
|
|
||||||
|
// Release represents a repository release
|
||||||
|
type Release struct { |
||||||
|
ID int64 `json:"id"` |
||||||
|
TagName string `json:"tag_name"` |
||||||
|
Target string `json:"target_commitish"` |
||||||
|
Title string `json:"name"` |
||||||
|
Note string `json:"body"` |
||||||
|
URL string `json:"url"` |
||||||
|
TarURL string `json:"tarball_url"` |
||||||
|
ZipURL string `json:"zipball_url"` |
||||||
|
IsDraft bool `json:"draft"` |
||||||
|
IsPrerelease bool `json:"prerelease"` |
||||||
|
// swagger:strfmt date-time
|
||||||
|
CreatedAt time.Time `json:"created_at"` |
||||||
|
// swagger:strfmt date-time
|
||||||
|
PublishedAt time.Time `json:"published_at"` |
||||||
|
Publisher *User `json:"author"` |
||||||
|
Attachments []*Attachment `json:"assets"` |
||||||
|
} |
||||||
|
|
||||||
|
// CreateReleaseOption options when creating a release
|
||||||
|
type CreateReleaseOption struct { |
||||||
|
// required: true
|
||||||
|
TagName string `json:"tag_name" binding:"Required"` |
||||||
|
Target string `json:"target_commitish"` |
||||||
|
Title string `json:"name"` |
||||||
|
Note string `json:"body"` |
||||||
|
IsDraft bool `json:"draft"` |
||||||
|
IsPrerelease bool `json:"prerelease"` |
||||||
|
} |
||||||
|
|
||||||
|
// EditReleaseOption options when editing a release
|
||||||
|
type EditReleaseOption struct { |
||||||
|
TagName string `json:"tag_name"` |
||||||
|
Target string `json:"target_commitish"` |
||||||
|
Title string `json:"name"` |
||||||
|
Note string `json:"body"` |
||||||
|
IsDraft *bool `json:"draft"` |
||||||
|
IsPrerelease *bool `json:"prerelease"` |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
// Copyright 2016 The Gogs Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package structs |
||||||
|
|
||||||
|
// Branch represents a repository branch
|
||||||
|
type Branch struct { |
||||||
|
Name string `json:"name"` |
||||||
|
Commit *PayloadCommit `json:"commit"` |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
// Copyright 2016 The Gogs Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package structs |
||||||
|
|
||||||
|
// AddCollaboratorOption options when adding a user as a collaborator of a repository
|
||||||
|
type AddCollaboratorOption struct { |
||||||
|
Permission *string `json:"permission"` |
||||||
|
} |
@ -0,0 +1,41 @@ |
|||||||
|
// Copyright 2015 The Gogs Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package structs |
||||||
|
|
||||||
|
import ( |
||||||
|
"time" |
||||||
|
) |
||||||
|
|
||||||
|
// DeployKey a deploy key
|
||||||
|
type DeployKey struct { |
||||||
|
ID int64 `json:"id"` |
||||||
|
KeyID int64 `json:"key_id"` |
||||||
|
Key string `json:"key"` |
||||||
|
URL string `json:"url"` |
||||||
|
Title string `json:"title"` |
||||||
|
Fingerprint string `json:"fingerprint"` |
||||||
|
// swagger:strfmt date-time
|
||||||
|
Created time.Time `json:"created_at"` |
||||||
|
ReadOnly bool `json:"read_only"` |
||||||
|
Repository *Repository `json:"repository,omitempty"` |
||||||
|
} |
||||||
|
|
||||||
|
// CreateKeyOption options when creating a key
|
||||||
|
type CreateKeyOption struct { |
||||||
|
// Title of the key to add
|
||||||
|
//
|
||||||
|
// required: true
|
||||||
|
// unique: true
|
||||||
|
Title string `json:"title" binding:"Required"` |
||||||
|
// An armored SSH key to add
|
||||||
|
//
|
||||||
|
// required: true
|
||||||
|
// unique: true
|
||||||
|
Key string `json:"key" binding:"Required"` |
||||||
|
// Describe if the key has only read access or read/write
|
||||||
|
//
|
||||||
|
// required: false
|
||||||
|
ReadOnly bool `json:"read_only"` |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
// Copyright 2018 The Gitea Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package structs |
||||||
|
|
||||||
|
// Reference represents a Git reference.
|
||||||
|
type Reference struct { |
||||||
|
Ref string `json:"ref"` |
||||||
|
URL string `json:"url"` |
||||||
|
Object *GitObject `json:"object"` |
||||||
|
} |
||||||
|
|
||||||
|
// GitObject represents a Git object.
|
||||||
|
type GitObject struct { |
||||||
|
Type string `json:"type"` |
||||||
|
SHA string `json:"sha"` |
||||||
|
URL string `json:"url"` |
||||||
|
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue