(Identities)
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("<YOUR_BEARER_TOKEN_HERE>"),
)
request := operations.CreateIdentityRequestBody{
ExternalID: "user_123",
Ratelimits: []operations.Ratelimits{
operations.Ratelimits{
Name: "tokens",
Limit: 10,
Duration: 1000,
},
},
}
ctx := context.Background()
res, err := s.Identities.CreateIdentity(ctx, request)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
*operations.CreateIdentityResponse, error
Error Object |
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("<YOUR_BEARER_TOKEN_HERE>"),
)
request := operations.GetIdentityRequest{
IdentityID: unkeygo.String("id_1234"),
ExternalID: unkeygo.String("id_1234"),
}
ctx := context.Background()
res, err := s.Identities.GetIdentity(ctx, request)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
*operations.GetIdentityResponse, error
Error Object |
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("<YOUR_BEARER_TOKEN_HERE>"),
)
request := operations.ListIdentitiesRequest{
Limit: unkeygo.Int64(100),
}
ctx := context.Background()
res, err := s.Identities.ListIdentities(ctx, request)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
for {
// handle items
res, err = res.Next()
if err != nil {
// handle error
}
if res == nil {
break
}
}
}
}
*operations.ListIdentitiesResponse, error
Error Object |
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("<YOUR_BEARER_TOKEN_HERE>"),
)
request := operations.UpdateIdentityRequestBody{
IdentityID: unkeygo.String("id_1234"),
ExternalID: unkeygo.String("user_1234"),
Ratelimits: []operations.UpdateIdentityRatelimits{
operations.UpdateIdentityRatelimits{
Name: "tokens",
Limit: 10,
Duration: 1000,
},
},
}
ctx := context.Background()
res, err := s.Identities.UpdateIdentity(ctx, request)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
*operations.UpdateIdentityResponse, error
Error Object |
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("<YOUR_BEARER_TOKEN_HERE>"),
)
request := operations.DeleteIdentityRequestBody{
IdentityID: "id_1234",
}
ctx := context.Background()
res, err := s.Identities.DeleteIdentity(ctx, request)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
*operations.DeleteIdentityResponse, error
Error Object |
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 |
/ |