convert

package
v1.17.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2022 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToAPIIssue added in v1.12.0

func ToAPIIssue(issue *issues_model.Issue) *api.Issue

ToAPIIssue converts an Issue to API format it assumes some fields assigned with values: Required - Poster, Labels, Optional - Milestone, Assignee, PullRequest

func ToAPIIssueList added in v1.12.0

func ToAPIIssueList(il issues_model.IssueList) []*api.Issue

ToAPIIssueList converts an IssueList to API format

func ToAPIMilestone added in v1.12.0

func ToAPIMilestone(m *issues_model.Milestone) *api.Milestone

ToAPIMilestone converts Milestone into API Format

func ToAPIPullRequest added in v1.12.0

func ToAPIPullRequest(ctx context.Context, pr *issues_model.PullRequest, doer *user_model.User) *api.PullRequest

ToAPIPullRequest assumes following fields have been assigned with valid values: Required - Issue Optional - Merger

func ToAnnotatedTag

func ToAnnotatedTag(repo *repo_model.Repository, t *git.Tag, c *git.Commit) *api.AnnotatedTag

ToAnnotatedTag convert git.Tag to api.AnnotatedTag

func ToAnnotatedTagObject

func ToAnnotatedTagObject(repo *repo_model.Repository, commit *git.Commit) *api.AnnotatedTagObject

ToAnnotatedTagObject convert a git.Commit to an api.AnnotatedTagObject

func ToBranch

func ToBranch(repo *repo_model.Repository, b *git.Branch, c *git.Commit, bp *git_model.ProtectedBranch, user *user_model.User, isRepoAdmin bool) (*api.Branch, error)

ToBranch convert a git.Commit and git.Branch to an api.Branch

func ToBranchProtection added in v1.12.0

func ToBranchProtection(bp *git_model.ProtectedBranch) *api.BranchProtection

ToBranchProtection convert a ProtectedBranch to api.BranchProtection

func ToCombinedStatus added in v1.14.0

func ToCombinedStatus(statuses []*git_model.CommitStatus, repo *api.Repository) *api.CombinedStatus

ToCombinedStatus converts List of CommitStatus to a CombinedStatus

func ToComment added in v1.14.0

func ToComment(c *issues_model.Comment) *api.Comment

ToComment converts a issues_model.Comment to the api.Comment format

func ToCommit

func ToCommit(repo *repo_model.Repository, gitRepo *git.Repository, commit *git.Commit, userCache map[string]*user_model.User) (*api.Commit, error)

ToCommit convert a git.Commit to api.Commit

func ToCommitMeta

func ToCommitMeta(repo *repo_model.Repository, tag *git.Tag) *api.CommitMeta

ToCommitMeta convert a git.Tag to an api.CommitMeta

func ToCommitStatus added in v1.14.0

func ToCommitStatus(status *git_model.CommitStatus) *api.CommitStatus

ToCommitStatus converts git_model.CommitStatus to api.CommitStatus

func ToCommitUser

func ToCommitUser(sig *git.Signature) *api.CommitUser

ToCommitUser convert a git.Signature to an api.CommitUser

func ToCorrectPageSize

func ToCorrectPageSize(size int) int

ToCorrectPageSize makes sure page size is in allowed range.

func ToDeployKey

func ToDeployKey(apiLink string, key *asymkey_model.DeployKey) *api.DeployKey

ToDeployKey convert asymkey_model.DeployKey to api.DeployKey

func ToEmail

func ToEmail(email *user_model.EmailAddress) *api.Email

ToEmail convert models.EmailAddress to api.Email

func ToGPGKey

func ToGPGKey(key *asymkey_model.GPGKey) *api.GPGKey

ToGPGKey converts models.GPGKey to api.GPGKey

func ToGPGKeyEmail

func ToGPGKeyEmail(email *user_model.EmailAddress) *api.GPGKeyEmail

ToGPGKeyEmail convert models.EmailAddress to api.GPGKeyEmail

func ToGitHook

func ToGitHook(h *git.Hook) *api.GitHook

ToGitHook convert git.Hook to api.GitHook

func ToGitServiceType added in v1.13.0

func ToGitServiceType(value string) structs.GitServiceType

ToGitServiceType return GitServiceType based on string

func ToHook

func ToHook(repoLink string, w *webhook.Webhook) *api.Hook

ToHook convert models.Webhook to api.Hook

func ToLFSLock added in v1.14.0

func ToLFSLock(l *git_model.LFSLock) *api.LFSLock

ToLFSLock convert a LFSLock to api.LFSLock

func ToLabel added in v1.12.0

func ToLabel(label *issues_model.Label, repo *repo_model.Repository, org *user_model.User) *api.Label

ToLabel converts Label to API format

func ToLabelList added in v1.12.0

func ToLabelList(labels []*issues_model.Label, repo *repo_model.Repository, org *user_model.User) []*api.Label

ToLabelList converts list of Label to API format

func ToNotificationThread added in v1.14.0

func ToNotificationThread(n *models.Notification) *api.NotificationThread

ToNotificationThread convert a Notification to api.NotificationThread

func ToNotifications added in v1.14.0

func ToNotifications(nl models.NotificationList) []*api.NotificationThread

ToNotifications convert list of Notification to api.NotificationThread list

func ToOAuth2Application added in v1.12.0

func ToOAuth2Application(app *auth.OAuth2Application) *api.OAuth2Application

ToOAuth2Application convert from auth.OAuth2Application to api.OAuth2Application

func ToOrganization

func ToOrganization(org *organization.Organization) *api.Organization

ToOrganization convert user_model.User to api.Organization

func ToPackage added in v1.17.0

func ToPackage(ctx context.Context, pd *packages.PackageDescriptor, doer *user_model.User) (*api.Package, error)

ToPackage convert a packages.PackageDescriptor to api.Package

func ToPackageFile added in v1.17.0

func ToPackageFile(pfd *packages.PackageFileDescriptor) *api.PackageFile

ToPackageFile converts packages.PackageFileDescriptor to api.PackageFile

func ToPayloadCommit added in v1.13.0

func ToPayloadCommit(repo *repo_model.Repository, c *git.Commit) *api.PayloadCommit

ToPayloadCommit convert a git.Commit to api.PayloadCommit

func ToPublicKey

func ToPublicKey(apiLink string, key *asymkey_model.PublicKey) *api.PublicKey

ToPublicKey convert asymkey_model.PublicKey to api.PublicKey

func ToPullReview added in v1.12.0

func ToPullReview(ctx context.Context, r *issues_model.Review, doer *user_model.User) (*api.PullReview, error)

ToPullReview convert a review to api format

func ToPullReviewCommentList added in v1.12.0

func ToPullReviewCommentList(ctx context.Context, review *issues_model.Review, doer *user_model.User) ([]*api.PullReviewComment, error)

ToPullReviewCommentList convert the CodeComments of an review to it's api format

func ToPullReviewList added in v1.12.0

func ToPullReviewList(ctx context.Context, rl []*issues_model.Review, doer *user_model.User) ([]*api.PullReview, error)

ToPullReviewList convert a list of review to it's api format

func ToRelease added in v1.14.0

func ToRelease(r *models.Release) *api.Release

ToRelease convert a models.Release to api.Release

func ToReleaseAttachment added in v1.14.0

func ToReleaseAttachment(a *repo_model.Attachment) *api.Attachment

ToReleaseAttachment converts models.Attachment to api.Attachment

func ToRepo added in v1.14.0

func ToRepo(repo *repo_model.Repository, mode perm.AccessMode) *api.Repository

ToRepo converts a Repository to api.Repository

func ToRepoTransfer added in v1.16.0

func ToRepoTransfer(t *models.RepoTransfer) *api.RepoTransfer

ToRepoTransfer convert a models.RepoTransfer to a structs.RepeTransfer

func ToStopWatches added in v1.13.0

func ToStopWatches(sws []*issues_model.Stopwatch) (api.StopWatches, error)

ToStopWatches convert Stopwatch list to api.StopWatches

func ToTag

func ToTag(repo *repo_model.Repository, t *git.Tag) *api.Tag

ToTag convert a git.Tag to an api.Tag

func ToTeam

func ToTeam(team *organization.Team, loadOrg ...bool) (*api.Team, error)

ToTeam convert models.Team to api.Team

func ToTeams added in v1.17.0

func ToTeams(teams []*organization.Team, loadOrgs bool) ([]*api.Team, error)

ToTeams convert models.Team list to api.Team list

func ToTimelineComment added in v1.16.0

func ToTimelineComment(c *issues_model.Comment, doer *user_model.User) *api.TimelineComment

ToTimelineComment converts a issues_model.Comment to the api.TimelineComment format

func ToTopicResponse

func ToTopicResponse(topic *repo_model.Topic) *api.TopicResponse

ToTopicResponse convert from models.Topic to api.TopicResponse

func ToTrackedTime added in v1.12.0

func ToTrackedTime(t *issues_model.TrackedTime) (apiT *api.TrackedTime)

ToTrackedTime converts TrackedTime to API format

func ToTrackedTimeList added in v1.12.0

func ToTrackedTimeList(tl issues_model.TrackedTimeList) api.TrackedTimeList

ToTrackedTimeList converts TrackedTimeList to API format

func ToUser

func ToUser(user, doer *user_model.User) *api.User

ToUser convert user_model.User to api.User if doer is set, private information is added if the doer has the permission to see it

func ToUserAndPermission added in v1.17.0

func ToUserAndPermission(user, doer *user_model.User, accessMode perm.AccessMode) api.RepoCollaboratorPermission

ToUserAndPermission return User and its collaboration permission for a repository

func ToUserWithAccessMode added in v1.15.0

func ToUserWithAccessMode(user *user_model.User, accessMode perm.AccessMode) *api.User

ToUserWithAccessMode convert user_model.User to api.User AccessMode is not none show add some more information

func ToUsers added in v1.15.0

func ToUsers(doer *user_model.User, users []*user_model.User) []*api.User

ToUsers convert list of user_model.User to list of api.User

func ToVerification

func ToVerification(c *git.Commit) *api.PayloadCommitVerification

ToVerification convert a git.Commit.Signature to an api.PayloadCommitVerification

func ToWikiCommit added in v1.16.0

func ToWikiCommit(commit *git.Commit) *api.WikiCommit

ToWikiCommit convert a git commit into a WikiCommit

func ToWikiCommitList added in v1.16.0

func ToWikiCommitList(commits []*git.Commit, total int64) *api.WikiCommitList

ToWikiCommitList convert a list of git commits into a WikiCommitList

func ToWikiPageMetaData added in v1.16.0

func ToWikiPageMetaData(title string, lastCommit *git.Commit, repo *repo_model.Repository) *api.WikiPageMetaData

ToWikiPageMetaData converts meta information to a WikiPageMetaData

func User2UserSettings added in v1.15.0

func User2UserSettings(user *user_model.User) api.UserSettings

User2UserSettings return UserSettings based on a user

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL