Skip to content

Commit 2dd2dbb

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 0ec6e04 commit 2dd2dbb

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

bitbucket.go

Lines changed: 9 additions & 21 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,22 +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 RepositoryBranchDeleteOptions struct {
236-
Owner string `json:"owner"`
237-
RepoSlug string `json:"repo_slug"`
238-
RepoUUID string `json:"uuid"`
239-
RefName string `json:"name"`
240-
RefUUID string `json:uuid`
241-
}
242-
243-
type RepositoryBranchTarget struct {
244-
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"`
245237
}
246238

247239
type RepositoryTagOptions struct {
@@ -259,11 +251,7 @@ type RepositoryTagCreationOptions struct {
259251
Owner string `json:"owner"`
260252
RepoSlug string `json:"repo_slug"`
261253
Name string `json:"name"`
262-
Target RepositoryTagTarget `json:"target"`
263-
}
264-
265-
type RepositoryTagTarget struct {
266-
Hash string `json:"hash"`
254+
Target RepositoryRefTarget `json:"target"`
267255
}
268256

269257
type PullRequestsOptions struct {

0 commit comments

Comments
 (0)