Skip to content

Latest commit

 

History

History
executable file
·
545 lines (431 loc) · 20.3 KB

README.md

File metadata and controls

executable file
·
545 lines (431 loc) · 20.3 KB

Connection

Available Operations

Archive

Archive a connection

Example Usage

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 := "esse"

    ctx := context.Background()
    res, err := s.Connection.Archive(ctx, id)
    if err != nil {
        log.Fatal(err)
    }

    if res.Connection != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id string ✔️ N/A

Response

*operations.ArchiveConnectionResponse, error

Create

Create a connection

Example Usage

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.Connection.Create(ctx, operations.CreateConnectionRequestBody{
        Destination: &operations.CreateConnectionRequestBodyDestination{
            AuthMethod: &shared.APIKey{
                Config: &shared.DestinationAuthMethodAPIKeyConfig{
                    APIKey: "porro",
                    Key: "dolorum",
                    To: shared.DestinationAuthMethodAPIKeyConfigToHeader.ToPointer(),
                },
                Type: shared.APIKeyTypeAPIKey,
            },
            CliPath: hookdeck.String("nam"),
            HTTPMethod: shared.DestinationHTTPMethodPut.ToPointer(),
            Name: "Wayne Lind",
            PathForwardingDisabled: hookdeck.Bool(false),
            RateLimit: hookdeck.Int64(105907),
            RateLimitPeriod: operations.CreateConnectionRequestBodyDestinationRateLimitPeriodMinute.ToPointer(),
            URL: hookdeck.String("molestiae"),
        },
        DestinationID: hookdeck.String("modi"),
        Name: "Krista Rippin",
        Rules: []interface{}{
            shared.RetryRule{
                Count: hookdeck.Int64(18789),
                Interval: hookdeck.Int64(324141),
                Strategy: shared.RetryStrategyExponential,
                Type: shared.RetryRuleTypeRetry,
            },
            shared.RetryRule{
                Count: hookdeck.Int64(612096),
                Interval: hookdeck.Int64(222321),
                Strategy: shared.RetryStrategyExponential,
                Type: shared.RetryRuleTypeRetry,
            },
            shared.AlertRule{
                Strategy: shared.AlertStrategyLastAttempt,
                Type: shared.AlertRuleTypeAlert,
            },
        },
        Ruleset: &operations.CreateConnectionRequestBodyRuleset{
            IsTeamDefault: hookdeck.Bool(false),
            Name: "Wilbur Kirlin",
            Rules: []interface{}{
                shared.DelayRule{
                    Delay: 697631,
                    Type: shared.DelayRuleTypeDelay,
                },
                shared.RetryRule{
                    Count: hookdeck.Int64(60225),
                    Interval: hookdeck.Int64(969810),
                    Strategy: shared.RetryStrategyExponential,
                    Type: shared.RetryRuleTypeRetry,
                },
            },
        },
        RulesetID: hookdeck.String("mollitia"),
        Source: &operations.CreateConnectionRequestBodySource{
            AllowedHTTPMethods: []shared.SourceAllowedHTTPMethod{
                shared.SourceAllowedHTTPMethodGet,
                shared.SourceAllowedHTTPMethodPost,
                shared.SourceAllowedHTTPMethodPost,
            },
            CustomResponse: &shared.SourceCustomResponse{
                Body: "explicabo",
                ContentType: shared.SourceCustomResponseContentTypeXML,
            },
            Name: "Guadalupe Hickle",
        },
        SourceID: hookdeck.String("accusantium"),
    })
    if err != nil {
        log.Fatal(err)
    }

    if res.Connection != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.CreateConnectionRequestBody ✔️ The request object to use for the request.

Response

*operations.CreateConnectionResponse, error

Delete

Delete a connection

Example Usage

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 := "iure"

    ctx := context.Background()
    res, err := s.Connection.Delete(ctx, id)
    if err != nil {
        log.Fatal(err)
    }

    if res.DeleteConnection200ApplicationJSONObject != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id string ✔️ N/A

Response

*operations.DeleteConnectionResponse, error

Get

Get a single connection

Example Usage

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 := "culpa"

    ctx := context.Background()
    res, err := s.Connection.Get(ctx, id)
    if err != nil {
        log.Fatal(err)
    }

    if res.Connection != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id string ✔️ N/A

Response

*operations.GetConnectionResponse, error

Pause

Pause a connection

Example Usage

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 := "doloribus"

    ctx := context.Background()
    res, err := s.Connection.Pause(ctx, id)
    if err != nil {
        log.Fatal(err)
    }

    if res.Connection != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id string ✔️ N/A

Response

*operations.PauseConnectionResponse, error

Unarchive

Unarchive a connection

Example Usage

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 := "sapiente"

    ctx := context.Background()
    res, err := s.Connection.Unarchive(ctx, id)
    if err != nil {
        log.Fatal(err)
    }

    if res.Connection != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id string ✔️ N/A

Response

*operations.UnarchiveConnectionResponse, error

Unpause

Unpause a connection

Example Usage

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 := "architecto"

    ctx := context.Background()
    res, err := s.Connection.Unpause(ctx, id)
    if err != nil {
        log.Fatal(err)
    }

    if res.Connection != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id string ✔️ N/A

Response

*operations.UnpauseConnectionResponse, error

Update

Update a connection

Example Usage

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.UpdateConnectionRequestBody{
        Name: hookdeck.String("Mike Nicolas"),
        Rules: []interface{}{
            shared.FilterRule{
                Body: &shared.ConnectionFilterProperty{},
                Headers: &shared.ConnectionFilterProperty{},
                Path: &shared.ConnectionFilterProperty{},
                Query: &shared.ConnectionFilterProperty{},
                Type: shared.FilterRuleTypeFilter,
            },
            shared.AlertRule{
                Strategy: shared.AlertStrategyEachAttempt,
                Type: shared.AlertRuleTypeAlert,
            },
            shared.FilterRule{
                Body: &shared.ConnectionFilterProperty{},
                Headers: &shared.ConnectionFilterProperty{},
                Path: &shared.ConnectionFilterProperty{},
                Query: &shared.ConnectionFilterProperty{},
                Type: shared.FilterRuleTypeFilter,
            },
        },
        Ruleset: &operations.UpdateConnectionRequestBodyRuleset{
            IsTeamDefault: hookdeck.Bool(false),
            Name: "Shannon Mueller",
            Rules: []interface{}{
                shared.TransformFull{
                    Transformation: &shared.TransformFullTransformation{
                        Code: "enim",
                        Env: map[string]string{
                            "quo": "sequi",
                        },
                        Name: "Vernon Ondricka Sr.",
                    },
                    TransformationID: hookdeck.String("error"),
                    Type: shared.TransformFullTypeTransform,
                },
            },
        },
        RulesetID: hookdeck.String("temporibus"),
    }
    id := "laborum"

    ctx := context.Background()
    res, err := s.Connection.Update(ctx, requestBody, id)
    if err != nil {
        log.Fatal(err)
    }

    if res.Connection != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
requestBody operations.UpdateConnectionRequestBody ✔️ N/A
id string ✔️ N/A

Response

*operations.UpdateConnectionResponse, error