11package bitbucket
22
3+ import "context"
4+
35type users interface {
46 Get (username string ) (* User , error )
57 Followers (username string ) (interface {}, error )
@@ -160,6 +162,12 @@ type RepositoryOptions struct {
160162 HasIssues string `json:"has_issues"`
161163 HasWiki string `json:"has_wiki"`
162164 Project string `json:"project"`
165+ ctx context.Context
166+ }
167+
168+ func (ro * RepositoryOptions ) WithContext (ctx context.Context ) * RepositoryOptions {
169+ ro .ctx = ctx
170+ return ro
163171}
164172
165173type RepositoryForkOptions struct {
@@ -176,6 +184,12 @@ type RepositoryForkOptions struct {
176184 HasIssues string `json:"has_issues"`
177185 HasWiki string `json:"has_wiki"`
178186 Project string `json:"project"`
187+ ctx context.Context
188+ }
189+
190+ func (fo * RepositoryForkOptions ) WithContext (ctx context.Context ) * RepositoryForkOptions {
191+ fo .ctx = ctx
192+ return fo
179193}
180194
181195type RepositoryFilesOptions struct {
@@ -209,6 +223,12 @@ type RepositoryBlobWriteOptions struct {
209223 Author string `json:"author"`
210224 Message string `json:"message"`
211225 Branch string `json:"branch"`
226+ ctx context.Context
227+ }
228+
229+ func (ro * RepositoryBlobWriteOptions ) WithContext (ctx context.Context ) * RepositoryBlobWriteOptions {
230+ ro .ctx = ctx
231+ return ro
212232}
213233
214234// RepositoryRefOptions represents the options for describing a repository's refs (i.e.
@@ -294,6 +314,12 @@ type PullRequestsOptions struct {
294314 States []string `json:"states"`
295315 Query string `json:"query"`
296316 Sort string `json:"sort"`
317+ ctx context.Context
318+ }
319+
320+ func (po * PullRequestsOptions ) WithContext (ctx context.Context ) * PullRequestsOptions {
321+ po .ctx = ctx
322+ return po
297323}
298324
299325type PullRequestCommentOptions struct {
@@ -303,6 +329,12 @@ type PullRequestCommentOptions struct {
303329 Content string `json:"content"`
304330 CommentId string `json:"-"`
305331 Parent * int `json:"parent"`
332+ ctx context.Context
333+ }
334+
335+ func (pco * PullRequestCommentOptions ) WithContext (ctx context.Context ) * PullRequestCommentOptions {
336+ pco .ctx = ctx
337+ return pco
306338}
307339
308340type IssuesOptions struct {
@@ -321,6 +353,12 @@ type IssuesOptions struct {
321353 Priority string `json:"priority"`
322354 Version string `json:"version"`
323355 Assignee string `json:"assignee"`
356+ ctx context.Context
357+ }
358+
359+ func (io * IssuesOptions ) WithContext (ctx context.Context ) * IssuesOptions {
360+ io .ctx = ctx
361+ return io
324362}
325363
326364type IssueCommentsOptions struct {
@@ -352,6 +390,12 @@ type CommitsOptions struct {
352390 Exclude string `json:"exclude"`
353391 CommentID string `json:"comment_id"`
354392 Page * int `json:"page"`
393+ ctx context.Context
394+ }
395+
396+ func (cm * CommitsOptions ) WithContext (ctx context.Context ) * CommitsOptions {
397+ cm .ctx = ctx
398+ return cm
355399}
356400
357401type CommitStatusOptions struct {
@@ -373,6 +417,12 @@ type BranchRestrictionsOptions struct {
373417 FullSlug string `json:"full_slug"`
374418 Name string `json:"name"`
375419 Value interface {} `json:"value"`
420+ ctx context.Context
421+ }
422+
423+ func (b * BranchRestrictionsOptions ) WithContext (ctx context.Context ) * BranchRestrictionsOptions {
424+ b .ctx = ctx
425+ return b
376426}
377427
378428type DiffOptions struct {
@@ -406,6 +456,12 @@ type WebhooksOptions struct {
406456 Url string `json:"url"`
407457 Active bool `json:"active"`
408458 Events []string `json:"events"` // EX: {'repo:push','issue:created',..} REF: https://bit.ly/3FjRHHu
459+ ctx context.Context
460+ }
461+
462+ func (wo * WebhooksOptions ) WithContext (ctx context.Context ) * WebhooksOptions {
463+ wo .ctx = ctx
464+ return wo
409465}
410466
411467type RepositoryPipelineOptions struct {
@@ -437,6 +493,12 @@ type RepositoryPipelineVariableOptions struct {
437493 Key string `json:"key"`
438494 Value string `json:"value"`
439495 Secured bool `json:"secured"`
496+ ctx context.Context
497+ }
498+
499+ func (rpvo * RepositoryPipelineVariableOptions ) WithContext (ctx context.Context ) * RepositoryPipelineVariableOptions {
500+ rpvo .ctx = ctx
501+ return rpvo
440502}
441503
442504type RepositoryPipelineVariableDeleteOptions struct {
@@ -469,6 +531,12 @@ type DownloadsOptions struct {
469531 FilePath string `json:"filepath"`
470532 FileName string `json:"filename"`
471533 Files []File `json:"files"`
534+ ctx context.Context
535+ }
536+
537+ func (do * DownloadsOptions ) WithContext (ctx context.Context ) * DownloadsOptions {
538+ do .ctx = ctx
539+ return do
472540}
473541
474542type PageRes struct {
@@ -526,6 +594,12 @@ type RepositoryEnvironmentOptions struct {
526594 Name string `json:"name"`
527595 EnvironmentType RepositoryEnvironmentTypeOption `json:"environment_type"`
528596 Rank int `json:"rank"`
597+ ctx context.Context
598+ }
599+
600+ func (reo * RepositoryEnvironmentOptions ) WithContext (ctx context.Context ) * RepositoryEnvironmentOptions {
601+ reo .ctx = ctx
602+ return reo
529603}
530604
531605type RepositoryEnvironmentDeleteOptions struct {
@@ -553,6 +627,12 @@ type RepositoryDeploymentVariableOptions struct {
553627 Key string `json:"key"`
554628 Value string `json:"value"`
555629 Secured bool `json:"secured"`
630+ ctx context.Context
631+ }
632+
633+ func (rdvo * RepositoryDeploymentVariableOptions ) WithContext (ctx context.Context ) * RepositoryDeploymentVariableOptions {
634+ rdvo .ctx = ctx
635+ return rdvo
556636}
557637
558638type RepositoryDeploymentVariableDeleteOptions struct {
@@ -568,4 +648,10 @@ type DeployKeyOptions struct {
568648 Id int `json:"id"`
569649 Label string `json:"label"`
570650 Key string `json:"key"`
651+ ctx context.Context
652+ }
653+
654+ func (dk * DeployKeyOptions ) WithContext (ctx context.Context ) * DeployKeyOptions {
655+ dk .ctx = ctx
656+ return dk
571657}
0 commit comments