chore(tasks): support looking up tasks by script id (#437)

This commit is contained in:
Greg 2022-08-15 10:19:09 -06:00 committed by GitHub
parent 7bdad28ee0
commit 65ff49fedf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 4 deletions

View File

@ -701,6 +701,7 @@ type ApiGetTasksRequest struct {
offset *int32
sortBy *string
type_ *string
scriptID *string
}
func (r ApiGetTasksRequest) ZapTraceSpan(zapTraceSpan string) ApiGetTasksRequest {
@ -791,6 +792,14 @@ func (r ApiGetTasksRequest) GetType_() *string {
return r.type_
}
func (r ApiGetTasksRequest) ScriptID(scriptID string) ApiGetTasksRequest {
r.scriptID = &scriptID
return r
}
func (r ApiGetTasksRequest) GetScriptID() *string {
return r.scriptID
}
func (r ApiGetTasksRequest) Execute() (Tasks, error) {
return r.ApiService.GetTasksExecute(r)
}
@ -882,6 +891,9 @@ func (a *TasksApiService) GetTasksExecuteWithHttpInfo(r ApiGetTasksRequest) (Tas
if r.type_ != nil {
localVarQueryParams.Add("type", parameterToString(*r.type_, ""))
}
if r.scriptID != nil {
localVarQueryParams.Add("scriptID", parameterToString(*r.scriptID, ""))
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}

@ -1 +1 @@
Subproject commit 0df6358a78262bcf33edd35bb242dce2a9744ea1
Subproject commit 226874df6889b39e3e0794585b7eafaa70e2f8b1

View File

@ -109,9 +109,10 @@ func (c Client) Create(ctx context.Context, params *CreateParams) error {
type FindParams struct {
clients.OrgParams
TaskID string
UserID string
Limit int
TaskID string
UserID string
ScriptID string
Limit int
}
func (c Client) Find(ctx context.Context, params *FindParams) error {
@ -141,6 +142,9 @@ func (c Client) Find(ctx context.Context, params *FindParams) error {
if params.UserID != "" {
getTask = getTask.User(params.UserID)
}
if params.ScriptID != "" {
getTask = getTask.ScriptID(params.ScriptID)
}
tasksResult, err := getTask.Execute()
if err != nil {
return err

View File

@ -125,6 +125,11 @@ func newTaskFindCmd() cli.Command {
Usage: "task owner ID",
Destination: &params.UserID,
},
&cli.StringFlag{
Name: "script-id",
Usage: "script ID",
Destination: &params.ScriptID,
},
&cli.IntFlag{
Name: "limit",
Usage: "the number of tasks to find",