Create a worker schedule
client.Workers.Schedules.New(ctx, workerID, body) (*WorkerScheduleUnion, error)
POST/api/workers/{workerId}/schedules
Create a worker schedule
package main
import (
"context"
"fmt"
"time"
"github.com/stainless-sdks/handinger-go"
"github.com/stainless-sdks/handinger-go/option"
)
func main() {
client := handinger.NewClient(
option.WithAPIKey("My API Key"),
)
workerSchedule, err := client.Workers.Schedules.New(
context.TODO(),
"t_org_123_w_01HZY2ZJQ8G7K42W2D7WF6V4GM",
handinger.WorkerScheduleNewParams{
Input: "x",
When: handinger.WorkerScheduleNewParamsWhenUnion{
OfWorkerScheduleNewsWhenObject: &handinger.WorkerScheduleNewParamsWhenObject{
Date: time.Now(),
Type: "scheduled",
},
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", workerSchedule)
}
{
"id": "id",
"budget": "low",
"input": "input",
"nextRunAt": "2019-12-27T18:11:19.117Z",
"type": "scheduled"
}Returns Examples
{
"id": "id",
"budget": "low",
"input": "input",
"nextRunAt": "2019-12-27T18:11:19.117Z",
"type": "scheduled"
}