Skip to content

Latest commit

 

History

History
executable file
·
289 lines (217 loc) · 12 KB

README.md

File metadata and controls

executable file
·
289 lines (217 loc) · 12 KB

Bookmark

Available Operations

Create

Create a new bookmark.

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.Bookmark.Create(ctx, operations.CreateBookmarkRequestBody{
        EventDataID: "nulla",
        Label: "corrupti",
        Name: hookdeck.String("Ben Mueller"),
        WebhookID: "iure",
    })
    if err != nil {
        log.Fatal(err)
    }

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

Parameters

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

Response

*operations.CreateBookmarkResponse, error

Delete

Delete an existing bookmark

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

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

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

Parameters

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

Response

*operations.DeleteBookmarkResponse, error

Get

Retrieve an existing bookmark details.

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

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

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

Parameters

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

Response

*operations.GetBookmarkResponse, error

Trigger

Trigger a bookmark operation to store and replay a specific request.

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.TriggerBookmarkRequestBody{
        Target: operations.TriggerBookmarkRequestBodyTargetHTTP.ToPointer(),
    }
    id := "delectus"

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

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

Parameters

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

Response

*operations.TriggerBookmarkResponse, error

Update

Update an existing bookmark information.

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.UpdateBookmarkRequestBody{
        EventDataID: hookdeck.String("tempora"),
        Label: hookdeck.String("suscipit"),
        Name: hookdeck.String("Alexandra Schulist"),
        WebhookID: hookdeck.String("excepturi"),
    }
    id := "nisi"

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

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

Parameters

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

Response

*operations.UpdateBookmarkResponse, error