Skip to content

Commit c871362

Browse files
committed
Refactor Repo Tag and Branch Target types to a single Ref Target
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)
1 parent 7aba5c0 commit c871362

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

bitbucket.go

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ type RepositoryRefOptions struct {
214214
BranchFlg bool
215215
}
216216

217+
type RepositoryRefTarget struct {
218+
Hash string `json:"hash"`
219+
}
220+
217221
type RepositoryBranchOptions struct {
218222
Owner string `json:"owner"`
219223
RepoSlug string `json:"repo_slug"`
@@ -226,14 +230,10 @@ type RepositoryBranchOptions struct {
226230
}
227231

228232
type RepositoryBranchCreationOptions struct {
229-
Owner string `json:"owner"`
230-
RepoSlug string `json:"repo_slug"`
231-
Name string `json:"name"`
232-
Target RepositoryBranchTarget `json:"target"`
233-
}
234-
235-
type RepositoryBranchTarget struct {
236-
Hash string `json:"hash"`
233+
Owner string `json:"owner"`
234+
RepoSlug string `json:"repo_slug"`
235+
Name string `json:"name"`
236+
Target RepositoryRefTarget `json:"target"`
237237
}
238238

239239
type RepositoryTagOptions struct {
@@ -251,11 +251,7 @@ type RepositoryTagCreationOptions struct {
251251
Owner string `json:"owner"`
252252
RepoSlug string `json:"repo_slug"`
253253
Name string `json:"name"`
254-
Target RepositoryTagTarget `json:"target"`
255-
}
256-
257-
type RepositoryTagTarget struct {
258-
Hash string `json:"hash"`
254+
Target RepositoryRefTarget `json:"target"`
259255
}
260256

261257
type PullRequestsOptions struct {

0 commit comments

Comments
 (0)