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 ktrysmt#155 and
ktrysmt#153 (comment)
  • Loading branch information
DataDavD committed Jul 30, 2021
1 parent 7aba5c0 commit c871362
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 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,14 +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 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 @@ -251,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 c871362

Please sign in to comment.