(Migrations)
package main
import(
unkeygo "github.com/unkeyed/unkey-go"
"context"
"github.com/unkeyed/unkey-go/models/operations"
"log"
)
func main() {
s := unkeygo.New(
unkeygo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
ctx := context.Background()
res, err := s.Migrations.V1MigrationsCreateKeys(ctx, []operations.RequestBody{
operations.RequestBody{
APIID: "api_123",
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.V1MigrationsCreateKeysRefill{
Interval: operations.V1MigrationsCreateKeysIntervalDaily,
Amount: 100,
},
Ratelimit: &operations.V1MigrationsCreateKeysRatelimit{
Type: operations.V1MigrationsCreateKeysTypeFast.ToPointer(),
Limit: 10,
RefillRate: 1,
RefillInterval: 60,
},
Enabled: unkeygo.Bool(false),
},
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
*operations.V1MigrationsCreateKeysResponse, error
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 |
*/* |
package main
import(
unkeygo "github.com/unkeyed/unkey-go"
"context"
"github.com/unkeyed/unkey-go/models/operations"
"log"
)
func main() {
s := unkeygo.New(
unkeygo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
ctx := context.Background()
res, err := s.Migrations.V1MigrationsEnqueueKeys(ctx, operations.V1MigrationsEnqueueKeysRequestBody{
MigrationID: "<value>",
APIID: "<value>",
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{
Type: operations.V1MigrationsEnqueueKeysTypeFast.ToPointer(),
Limit: 10,
Duration: 60000,
},
Enabled: unkeygo.Bool(false),
},
},
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
*operations.V1MigrationsEnqueueKeysResponse, error
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 |
*/* |