Woodpecker-go: Use Feed instead Activity (#2690)

The models had gotten out of sync.
Use the same definition ~to avoid them getting out of sync in the
future~.

Closes https://github.com/woodpecker-ci/woodpecker/issues/2679
This commit is contained in:
runephilosof-karnovgroup 2023-11-01 10:43:55 +01:00 committed by GitHub
parent bde9f97407
commit 97f04449a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 10 deletions

View file

@ -251,8 +251,8 @@ func (c *client) PipelineCreate(repoID int64, options *PipelineOptions) (*Pipeli
} }
// PipelineQueue returns a list of enqueued pipelines. // PipelineQueue returns a list of enqueued pipelines.
func (c *client) PipelineQueue() ([]*Activity, error) { func (c *client) PipelineQueue() ([]*Feed, error) {
var out []*Activity var out []*Feed
uri := fmt.Sprintf(pathPipelineQueue, c.addr) uri := fmt.Sprintf(pathPipelineQueue, c.addr)
err := c.get(uri, &out) err := c.get(uri, &out)
return out, err return out, err

View file

@ -88,7 +88,7 @@ type Client interface {
PipelineList(repoID int64) ([]*Pipeline, error) PipelineList(repoID int64) ([]*Pipeline, error)
// PipelineQueue returns a list of enqueued pipelines. // PipelineQueue returns a list of enqueued pipelines.
PipelineQueue() ([]*Activity, error) PipelineQueue() ([]*Feed, error)
// PipelineCreate returns creates a pipeline on specified branch. // PipelineCreate returns creates a pipeline on specified branch.
PipelineCreate(repoID int64, opts *PipelineOptions) (*Pipeline, error) PipelineCreate(repoID int64, opts *PipelineOptions) (*Pipeline, error)

View file

@ -139,12 +139,11 @@ type (
Events []string `json:"events"` Events []string `json:"events"`
} }
// Activity represents an item in the user's feed or timeline. // Feed represents an item in the user's feed or timeline.
Activity struct { Feed struct {
Owner string `json:"owner"` RepoID int64 `json:"repo_id"`
Name string `json:"name"` ID int64 `json:"id,omitempty"`
FullName string `json:"full_name"` Number int64 `json:"number,omitempty"`
Number int `json:"number,omitempty"`
Event string `json:"event,omitempty"` Event string `json:"event,omitempty"`
Status string `json:"status,omitempty"` Status string `json:"status,omitempty"`
Created int64 `json:"created_at,omitempty"` Created int64 `json:"created_at,omitempty"`
@ -154,7 +153,7 @@ type (
Branch string `json:"branch,omitempty"` Branch string `json:"branch,omitempty"`
Ref string `json:"ref,omitempty"` Ref string `json:"ref,omitempty"`
Refspec string `json:"refspec,omitempty"` Refspec string `json:"refspec,omitempty"`
CloneURL string `json:"clone_url,omitempty"` Remote string `json:"remote,omitempty"`
Title string `json:"title,omitempty"` Title string `json:"title,omitempty"`
Message string `json:"message,omitempty"` Message string `json:"message,omitempty"`
Author string `json:"author,omitempty"` Author string `json:"author,omitempty"`