Skip to content

Commit

Permalink
Refactor Repo Tag and Branch Target types to a single Ref Target
Browse files Browse the repository at this point in the history
This commit refactors the existing RepositoryBranchTarget and
RepositoryTagTarget types to a single RepositoryRefTarget since tags and
branches are both refs and the two Target variables represented the
same type anyways. This will also help us move to removing branch
and tag specific options types into a single refs options type.

See #155 and
#153 (comment)
  • Loading branch information
DataDavD committed Dec 8, 2021
1 parent 0ec6e04 commit 2dd2dbb
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions bitbucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ type RepositoryRefOptions struct {
BranchFlg bool
}

type RepositoryRefTarget struct {
Hash string `json:"hash"`
}

type RepositoryBranchOptions struct {
Owner string `json:"owner"`
RepoSlug string `json:"repo_slug"`
Expand All @@ -226,22 +230,10 @@ type RepositoryBranchOptions struct {
}

type RepositoryBranchCreationOptions struct {
Owner string `json:"owner"`
RepoSlug string `json:"repo_slug"`
Name string `json:"name"`
Target RepositoryBranchTarget `json:"target"`
}

type RepositoryBranchDeleteOptions struct {
Owner string `json:"owner"`
RepoSlug string `json:"repo_slug"`
RepoUUID string `json:"uuid"`
RefName string `json:"name"`
RefUUID string `json:uuid`
}

type RepositoryBranchTarget struct {
Hash string `json:"hash"`
Owner string `json:"owner"`
RepoSlug string `json:"repo_slug"`
Name string `json:"name"`
Target RepositoryRefTarget `json:"target"`
}

type RepositoryTagOptions struct {
Expand All @@ -259,11 +251,7 @@ type RepositoryTagCreationOptions struct {
Owner string `json:"owner"`
RepoSlug string `json:"repo_slug"`
Name string `json:"name"`
Target RepositoryTagTarget `json:"target"`
}

type RepositoryTagTarget struct {
Hash string `json:"hash"`
Target RepositoryRefTarget `json:"target"`
}

type PullRequestsOptions struct {
Expand Down

0 comments on commit 2dd2dbb

Please sign in to comment.