- Archive - Archive a ruleset
- Create - Create a ruleset
- Get - Get a ruleset
- Unarchive - Unarchive a ruleset
- Update - Update a ruleset
- Upsert - Update or create a ruleset
Archive a ruleset
package main
import(
"context"
"log"
"github.com/speakeasy-sdks/hookdeck-go"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/shared"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/operations"
)
func main() {
s := hookdeck.New(
hookdeck.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
id := "recusandae"
ctx := context.Background()
res, err := s.Ruleset.Archive(ctx, id)
if err != nil {
log.Fatal(err)
}
if res.Ruleset != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string | ✔️ | N/A |
*operations.ArchiveRulesetResponse, error
Create a ruleset
package main
import(
"context"
"log"
"github.com/speakeasy-sdks/hookdeck-go"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/shared"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/operations"
)
func main() {
s := hookdeck.New(
hookdeck.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
ctx := context.Background()
res, err := s.Ruleset.Create(ctx, operations.CreateRulesetRequestBody{
IsTeamDefault: hookdeck.Bool(false),
Name: "Miss Cesar Metz",
Rules: []interface{}{
shared.TransformReference{
TransformationID: "occaecati",
Type: shared.TransformReferenceTypeTransform,
},
shared.TransformReference{
TransformationID: "asperiores",
Type: shared.TransformReferenceTypeTransform,
},
shared.DelayRule{
Delay: 267262,
Type: shared.DelayRuleTypeDelay,
},
},
})
if err != nil {
log.Fatal(err)
}
if res.Ruleset != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.CreateRulesetRequestBody | ✔️ | The request object to use for the request. |
*operations.CreateRulesetResponse, error
Get a ruleset
package main
import(
"context"
"log"
"github.com/speakeasy-sdks/hookdeck-go"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/shared"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/operations"
)
func main() {
s := hookdeck.New(
hookdeck.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
id := "iste"
ctx := context.Background()
res, err := s.Ruleset.Get(ctx, id)
if err != nil {
log.Fatal(err)
}
if res.Ruleset != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string | ✔️ | N/A |
*operations.GetRulesetResponse, error
Unarchive a ruleset
package main
import(
"context"
"log"
"github.com/speakeasy-sdks/hookdeck-go"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/shared"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/operations"
)
func main() {
s := hookdeck.New(
hookdeck.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
id := "dolorum"
ctx := context.Background()
res, err := s.Ruleset.Unarchive(ctx, id)
if err != nil {
log.Fatal(err)
}
if res.Ruleset != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string | ✔️ | N/A |
*operations.UnarchiveRulesetResponse, error
Update a ruleset
package main
import(
"context"
"log"
"github.com/speakeasy-sdks/hookdeck-go"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/shared"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/operations"
)
func main() {
s := hookdeck.New(
hookdeck.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
requestBody := operations.UpdateRulesetRequestBody{
IsTeamDefault: hookdeck.Bool(false),
Name: hookdeck.String("Ervin McLaughlin"),
Rules: []interface{}{
shared.AlertRule{
Strategy: shared.AlertStrategyLastAttempt,
Type: shared.AlertRuleTypeAlert,
},
shared.AlertRule{
Strategy: shared.AlertStrategyEachAttempt,
Type: shared.AlertRuleTypeAlert,
},
shared.AlertRule{
Strategy: shared.AlertStrategyEachAttempt,
Type: shared.AlertRuleTypeAlert,
},
shared.RetryRule{
Count: hookdeck.Int64(218749),
Interval: hookdeck.Int64(944373),
Strategy: shared.RetryStrategyExponential,
Type: shared.RetryRuleTypeRetry,
},
},
}
id := "cum"
ctx := context.Background()
res, err := s.Ruleset.Update(ctx, requestBody, id)
if err != nil {
log.Fatal(err)
}
if res.Ruleset != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
requestBody |
operations.UpdateRulesetRequestBody | ✔️ | N/A |
id |
string | ✔️ | N/A |
*operations.UpdateRulesetResponse, error
Update or create a ruleset
package main
import(
"context"
"log"
"github.com/speakeasy-sdks/hookdeck-go"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/shared"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/operations"
)
func main() {
s := hookdeck.New(
hookdeck.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
ctx := context.Background()
res, err := s.Ruleset.Upsert(ctx, operations.UpsertRulesetRequestBody{
IsTeamDefault: hookdeck.Bool(false),
Name: "Marian Wisozk",
Rules: []interface{}{
shared.RetryRule{
Count: hookdeck.Int64(58029),
Interval: hookdeck.Int64(56418),
Strategy: shared.RetryStrategyLinear,
Type: shared.RetryRuleTypeRetry,
},
shared.FilterRule{
Body: &shared.ConnectionFilterProperty{},
Headers: &shared.ConnectionFilterProperty{},
Path: &shared.ConnectionFilterProperty{},
Query: &shared.ConnectionFilterProperty{},
Type: shared.FilterRuleTypeFilter,
},
},
})
if err != nil {
log.Fatal(err)
}
if res.Ruleset != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.UpsertRulesetRequestBody | ✔️ | The request object to use for the request. |