From 9f3883a224047a4cf95fed529b767aed1fdecd7f Mon Sep 17 00:00:00 2001 From: alexey Date: Fri, 24 Mar 2023 11:35:57 +0000 Subject: [PATCH] rename BitbucketTrigerPipelineRequestBody and fix typo --- bitbucket.go | 17 +++++++++++++++++ pipelines.go | 19 +------------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/bitbucket.go b/bitbucket.go index aae77e6..be0284b 100644 --- a/bitbucket.go +++ b/bitbucket.go @@ -552,3 +552,20 @@ type DeployKeyOptions struct { Label string `json:"label"` Key string `json:"key"` } + +type TriggerPipelineRequestBody struct { + Target struct { + RefType string `json:"ref_type"` + Type string `json:"type"` + RefName string `json:"ref_name"` + Selector struct { + Type string `json:"type"` + Pattern string `json:"pattern"` + } `json:"selector"` + } `json:"target"` + Variables []struct { + Key string `json:"key"` + Value string `json:"value"` + Secured bool `json:"secured,omitempty"` + } `json:"variables"` +} diff --git a/pipelines.go b/pipelines.go index e846200..300ba0c 100644 --- a/pipelines.go +++ b/pipelines.go @@ -115,24 +115,7 @@ func (p *Pipelines) GetLog(po *PipelinesOptions) (string, error) { return string(rawBody), nil } -type BitbucketTrigerPipelineRequestBody struct { - Target struct { - RefType string `json:"ref_type"` - Type string `json:"type"` - RefName string `json:"ref_name"` - Selector struct { - Type string `json:"type"` - Pattern string `json:"pattern"` - } `json:"selector"` - } `json:"target"` - Variables []struct { - Key string `json:"key"` - Value string `json:"value"` - Secured bool `json:"secured,omitempty"` - } `json:"variables"` -} - -func (p *Pipelines) TriggerPipeline(po *PipelinesOptions, body *BitbucketTrigerPipelineRequestBody) (interface{}, error) { +func (p *Pipelines) TriggerPipeline(po *PipelinesOptions, body *TriggerPipelineRequestBody) (interface{}, error) { urlStr := p.c.requestUrl("/repositories/%s/%s/pipelines/", po.Owner, po.RepoSlug) b, err := json.Marshal(body)