Skip to content

Latest commit

 

History

History
155 lines (125 loc) · 8.12 KB

README.md

File metadata and controls

155 lines (125 loc) · 8.12 KB

Migrations

(Migrations)

Overview

Available Operations

V1MigrationsCreateKeys

Example Usage

package main

import(
	"context"
	unkeygo "github.com/unkeyed/unkey-go"
	"github.com/unkeyed/unkey-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := unkeygo.New(
        unkeygo.WithSecurity("UNKEY_ROOT_KEY"),
    )

    res, err := s.Migrations.V1MigrationsCreateKeys(ctx, []operations.RequestBody{

    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request []operations.RequestBody ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.V1MigrationsCreateKeysResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.ErrBadRequest 400 application/json
sdkerrors.ErrUnauthorized 401 application/json
sdkerrors.ErrForbidden 403 application/json
sdkerrors.ErrNotFound 404 application/json
sdkerrors.ErrConflict 409 application/json
sdkerrors.ErrTooManyRequests 429 application/json
sdkerrors.ErrInternalServerError 500 application/json
sdkerrors.SDKError 4XX, 5XX */*

V1MigrationsEnqueueKeys

Example Usage

package main

import(
	"context"
	unkeygo "github.com/unkeyed/unkey-go"
	"github.com/unkeyed/unkey-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := unkeygo.New(
        unkeygo.WithSecurity("UNKEY_ROOT_KEY"),
    )

    res, err := s.Migrations.V1MigrationsEnqueueKeys(ctx, operations.V1MigrationsEnqueueKeysRequestBody{
        MigrationID: "<id>",
        APIID: "<id>",
        Keys: []operations.Keys{
            operations.Keys{
                Name: unkeygo.String("my key"),
                Start: unkeygo.String("unkey_32kq"),
                OwnerID: unkeygo.String("team_123"),
                Meta: map[string]any{
                    "billingTier": "PRO",
                    "trialEnds": "2023-06-16T17:16:37.161Z",
                },
                Roles: []string{
                    "admin",
                    "finance",
                },
                Permissions: []string{
                    "domains.create_record",
                    "say_hello",
                },
                Expires: unkeygo.Int64(1623869797161),
                Remaining: unkeygo.Int64(1000),
                Refill: &operations.V1MigrationsEnqueueKeysRefill{
                    Interval: operations.V1MigrationsEnqueueKeysIntervalDaily,
                    Amount: 100,
                },
                Ratelimit: &operations.V1MigrationsEnqueueKeysRatelimit{
                    Limit: 10,
                    Duration: 60000,
                },
            },
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.V1MigrationsEnqueueKeysRequestBody ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.V1MigrationsEnqueueKeysResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.ErrBadRequest 400 application/json
sdkerrors.ErrUnauthorized 401 application/json
sdkerrors.ErrForbidden 403 application/json
sdkerrors.ErrNotFound 404 application/json
sdkerrors.ErrConflict 409 application/json
sdkerrors.ErrTooManyRequests 429 application/json
sdkerrors.ErrInternalServerError 500 application/json
sdkerrors.SDKError 4XX, 5XX */*