(Ratelimits)
package main
import(
unkeygo "github.com/unkeyed/unkey-go"
"github.com/unkeyed/unkey-go/models/operations"
"context"
"log"
)
func main() {
s := unkeygo.New(
unkeygo.WithSecurity("UNKEY_ROOT_KEY"),
)
ctx := context.Background()
res, err := s.Ratelimits.Limit(ctx, operations.LimitRequestBody{
Namespace: unkeygo.String("email.outbound"),
Identifier: "user_123",
Limit: 10,
Duration: 60000,
Cost: unkeygo.Int64(2),
Resources: []operations.Resources{
operations.Resources{
Type: "organization",
ID: "org_123",
Name: unkeygo.String("unkey"),
},
},
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
*operations.LimitResponse, 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"
"github.com/unkeyed/unkey-go/models/operations"
"context"
"log"
)
func main() {
s := unkeygo.New(
unkeygo.WithSecurity("UNKEY_ROOT_KEY"),
)
ctx := context.Background()
res, err := s.Ratelimits.DeleteOverride(ctx, operations.DeleteOverrideRequestBody{
NamespaceID: unkeygo.String("rlns_1234"),
NamespaceName: unkeygo.String("email.outbound"),
Identifier: "user_123",
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
*operations.DeleteOverrideResponse, 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 |
*/* |