(Customers.NamedSchedules)
Get a named schedule for the given customer. This endpoint's availability is dependent on your client's configuration.
package main
import(
metronomegosdk "github.com/speakeasy-sdks/metronome-go-sdk"
"github.com/speakeasy-sdks/metronome-go-sdk/models/operations"
"github.com/speakeasy-sdks/metronome-go-sdk/types"
"context"
"log"
)
func main() {
s := metronomegosdk.New(
metronomegosdk.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
var request *operations.GetCustomerNamedScheduleRequestBody = &operations.GetCustomerNamedScheduleRequestBody{
CustomerID: "9b85c1c1-5238-4f2a-a409-61412905e1e1",
ScheduleName: "my-schedule",
CoveringDate: types.MustNewTimeFromString("2022-02-15T00:00:00Z"),
}
ctx := context.Background()
res, err := s.Customers.NamedSchedules.Get(ctx, request)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetCustomerNamedScheduleRequestBody | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetCustomerNamedScheduleResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Update a named schedule for the given customer. This endpoint's availability is dependent on your client's configuration.
package main
import(
metronomegosdk "github.com/speakeasy-sdks/metronome-go-sdk"
"github.com/speakeasy-sdks/metronome-go-sdk/models/operations"
"github.com/speakeasy-sdks/metronome-go-sdk/types"
"context"
"log"
)
func main() {
s := metronomegosdk.New(
metronomegosdk.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
var request *operations.UpdateCustomerNamedScheduleRequestBody = &operations.UpdateCustomerNamedScheduleRequestBody{
CustomerID: "9b85c1c1-5238-4f2a-a409-61412905e1e1",
ScheduleName: "my-schedule",
StartingAt: types.MustTimeFromString("2022-02-01T00:00:00Z"),
EndingBefore: types.MustNewTimeFromString("2022-02-15T00:00:00Z"),
Value: map[string]any{
"my_key": "my_value",
},
}
ctx := context.Background()
res, err := s.Customers.NamedSchedules.Update(ctx, request)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.UpdateCustomerNamedScheduleRequestBody | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.UpdateCustomerNamedScheduleResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |