- Create - Create a transformation
- Get - Get a transformation
- Test - Test a transformation code
- Update - Update a transformation
- Upsert - Update or create a transformation
Create a transformation
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.Transformation.Create(ctx, operations.CreateTransformationRequestBody{
Code: "quod",
Env: map[string]interface{}{
"qui": "dolorum",
"a": "esse",
"harum": "iusto",
"ipsum": "quisquam",
},
Name: "Marvin Renner",
})
if err != nil {
log.Fatal(err)
}
if res.Transformation != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.CreateTransformationRequestBody | ✔️ | The request object to use for the request. |
*operations.CreateTransformationResponse, error
Get a transformation
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 := "enim"
ctx := context.Background()
res, err := s.Transformation.Get(ctx, id)
if err != nil {
log.Fatal(err)
}
if res.Transformation != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string | ✔️ | N/A |
*operations.GetTransformationResponse, error
Test a transformation code
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.Transformation.Test(ctx, operations.TestTransformationRequestBody{
Code: hookdeck.String("dolorem"),
Env: &operations.TestTransformationRequestBodyEnv{},
EventID: hookdeck.String("sapiente"),
Request: &operations.TestTransformationRequestBodyRequest{
Body: &operations.TestTransformationRequestBodyRequestBody{},
Headers: map[string]string{
"nihil": "sit",
"expedita": "neque",
"sed": "vel",
},
ParsedQuery: &operations.TestTransformationRequestBodyRequestParsedQuery{},
Path: hookdeck.String("libero"),
Query: hookdeck.String("voluptas"),
},
TransformationID: hookdeck.String("deserunt"),
WebhookID: hookdeck.String("quam"),
})
if err != nil {
log.Fatal(err)
}
if res.TransformationExecutorOutput != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.TestTransformationRequestBody | ✔️ | The request object to use for the request. |
*operations.TestTransformationResponse, error
Update a transformation
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.UpdateTransformationRequestBody{
Code: hookdeck.String("ipsum"),
Env: map[string]interface{}{
"qui": "cupiditate",
"maxime": "pariatur",
},
Name: hookdeck.String("Keith Padberg"),
}
id := "aspernatur"
ctx := context.Background()
res, err := s.Transformation.Update(ctx, requestBody, id)
if err != nil {
log.Fatal(err)
}
if res.Transformation != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
requestBody |
operations.UpdateTransformationRequestBody | ✔️ | N/A |
id |
string | ✔️ | N/A |
*operations.UpdateTransformationResponse, error
Update or create a transformation
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.Transformation.Upsert(ctx, operations.UpsertTransformationRequestBody{
Code: "dolores",
Env: map[string]interface{}{
"facilis": "aliquid",
"quam": "molestias",
"temporibus": "qui",
},
Name: "Beverly Cummerata II",
})
if err != nil {
log.Fatal(err)
}
if res.Transformation != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.UpsertTransformationRequestBody | ✔️ | The request object to use for the request. |