Skip to content

Commit

Permalink
refactor: sdk API is no v0alpha2
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The SDKs are now generated with tag v0alpha2 to reflect that some signatures have changed in a breaking fashion. Please update your imports from `v0alpha1` to `v0alpha2`.
  • Loading branch information
aeneasr committed Oct 19, 2021
1 parent a3ac253 commit 3f06738
Show file tree
Hide file tree
Showing 59 changed files with 849 additions and 1,156 deletions.
2 changes: 1 addition & 1 deletion cmd/identities/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewDeleteCmd() *cobra.Command {
)

for _, a := range args {
_, err := c.V0alpha1Api.AdminDeleteIdentity(cmd.Context(), a).Execute()
_, err := c.V0alpha2Api.AdminDeleteIdentity(cmd.Context(), a).Execute()
if err != nil {
errs = append(errs, err)
continue
Expand Down
2 changes: 1 addition & 1 deletion cmd/identities/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func NewGetCmd() *cobra.Command {
identities := make([]kratos.Identity, 0, len(args))
failed := make(map[string]error)
for _, id := range args {
identity, _, err := c.V0alpha1Api.AdminGetIdentity(cmd.Context(), id).Execute()
identity, _, err := c.V0alpha2Api.AdminGetIdentity(cmd.Context(), id).Execute()
if x.SDKError(err) != nil {
failed[id] = err
continue
Expand Down
4 changes: 2 additions & 2 deletions cmd/identities/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ WARNING: Importing credentials is not yet supported.`,

for src, i := range is {
err = ValidateIdentity(cmd, src, i, func(ctx context.Context, id string) (map[string]interface{}, *http.Response, error) {
return c.V0alpha1Api.GetJsonSchema(ctx, id).Execute()
return c.V0alpha2Api.GetJsonSchema(ctx, id).Execute()
})
if err != nil {
return err
Expand All @@ -63,7 +63,7 @@ WARNING: Importing credentials is not yet supported.`,
return cmdx.FailSilently(cmd)
}

ident, _, err := c.V0alpha1Api.AdminCreateIdentity(cmd.Context()).AdminCreateIdentityBody(params).Execute()
ident, _, err := c.V0alpha2Api.AdminCreateIdentity(cmd.Context()).AdminCreateIdentityBody(params).Execute()
if err != nil {
failed[src] = err
} else {
Expand Down
2 changes: 1 addition & 1 deletion cmd/identities/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func NewListCmd() *cobra.Command {
Aliases: []string{"ls"},
RunE: func(cmd *cobra.Command, args []string) error {
c := cliclient.NewClient(cmd)
req := c.V0alpha1Api.AdminListIdentities(cmd.Context())
req := c.V0alpha2Api.AdminListIdentities(cmd.Context())

if len(args) == 2 {
page, err := strconv.ParseInt(args[0], 0, 64)
Expand Down
2 changes: 1 addition & 1 deletion cmd/identities/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Identities can be supplied via STD_IN or JSON files containing a single or an ar

for src, i := range is {
err = ValidateIdentity(cmd, src, i, func(ctx context.Context, id string) (map[string]interface{}, *http.Response, error) {
return c.V0alpha1Api.GetJsonSchema(ctx, id).Execute()
return c.V0alpha2Api.GetJsonSchema(ctx, id).Execute()
})
if err != nil {
return err
Expand Down
64 changes: 32 additions & 32 deletions docs/docs/.static/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,7 @@
}
],
"summary": "List Identities",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
},
"post": {
"description": "This endpoint creates an identity. It is NOT possible to set an identity's credentials (password, ...)\nusing this method! A way to achieve that will be introduced in the future.\n\nLearn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model).",
Expand Down Expand Up @@ -1437,7 +1437,7 @@
}
],
"summary": "Create an Identity",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/identities/{id}": {
Expand Down Expand Up @@ -1486,7 +1486,7 @@
}
],
"summary": "Delete an Identity",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
},
"get": {
"description": "Learn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model).",
Expand Down Expand Up @@ -1549,7 +1549,7 @@
}
],
"summary": "Get an Identity",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
},
"put": {
"description": "This endpoint updates an identity. It is NOT possible to set an identity's credentials (password, ...)\nusing this method! A way to achieve that will be introduced in the future.\n\nThe full identity payload (except credentials) is expected. This endpoint does not support patching.\n\nLearn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model).",
Expand Down Expand Up @@ -1633,7 +1633,7 @@
}
],
"summary": "Update an Identity",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/identities/{id}/sessions": {
Expand Down Expand Up @@ -1775,7 +1775,7 @@
}
},
"summary": "Create a Recovery Link",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/schemas": {
Expand Down Expand Up @@ -1879,7 +1879,7 @@
"description": "jsonError"
}
},
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/errors": {
Expand Down Expand Up @@ -1940,7 +1940,7 @@
}
},
"summary": "Get Self-Service Errors",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/login": {
Expand Down Expand Up @@ -2009,7 +2009,7 @@
}
},
"summary": "Submit a Login Flow",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/login/api": {
Expand Down Expand Up @@ -2059,7 +2059,7 @@
}
},
"summary": "Initialize Login Flow for APIs, Services, Apps, ...",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/login/browser": {
Expand Down Expand Up @@ -2102,7 +2102,7 @@
}
},
"summary": "Initialize Login Flow for Browsers",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/login/flows": {
Expand Down Expand Up @@ -2181,7 +2181,7 @@
}
},
"summary": "Get Login Flow",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/logout": {
Expand Down Expand Up @@ -2217,7 +2217,7 @@
}
},
"summary": "Complete Self-Service Logout",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/logout/api": {
Expand Down Expand Up @@ -2261,7 +2261,7 @@
}
},
"summary": "Perform Logout for APIs, Services, Apps, ...",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/logout/browser": {
Expand Down Expand Up @@ -2311,7 +2311,7 @@
}
},
"summary": "Create a Logout URL for Browsers",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/recovery": {
Expand Down Expand Up @@ -2388,7 +2388,7 @@
}
},
"summary": "Complete Recovery Flow",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/recovery/api": {
Expand Down Expand Up @@ -2428,7 +2428,7 @@
}
},
"summary": "Initialize Recovery Flow for APIs, Services, Apps, ...",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/recovery/browser": {
Expand Down Expand Up @@ -2471,7 +2471,7 @@
}
},
"summary": "Initialize Recovery Flow for Browsers",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/recovery/flows": {
Expand Down Expand Up @@ -2540,7 +2540,7 @@
}
},
"summary": "Get Recovery Flow",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/registration": {
Expand Down Expand Up @@ -2609,7 +2609,7 @@
}
},
"summary": "Submit a Registration Flow",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/registration/api": {
Expand Down Expand Up @@ -2649,7 +2649,7 @@
}
},
"summary": "Initialize Registration Flow for APIs, Services, Apps, ...",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/registration/browser": {
Expand Down Expand Up @@ -2682,7 +2682,7 @@
}
},
"summary": "Initialize Registration Flow for Browsers",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/registration/flows": {
Expand Down Expand Up @@ -2761,7 +2761,7 @@
}
},
"summary": "Get Registration Flow",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/settings": {
Expand Down Expand Up @@ -2863,7 +2863,7 @@
}
],
"summary": "Complete Settings Flow",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/settings/api": {
Expand Down Expand Up @@ -2913,7 +2913,7 @@
}
},
"summary": "Initialize Settings Flow for APIs, Services, Apps, ...",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/settings/browser": {
Expand Down Expand Up @@ -2966,7 +2966,7 @@
}
},
"summary": "Initialize Settings Flow for Browsers",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/settings/flows": {
Expand Down Expand Up @@ -3053,7 +3053,7 @@
}
},
"summary": "Get Settings Flow",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/verification": {
Expand Down Expand Up @@ -3130,7 +3130,7 @@
}
},
"summary": "Complete Verification Flow",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/verification/api": {
Expand Down Expand Up @@ -3170,7 +3170,7 @@
}
},
"summary": "Initialize Verification Flow for APIs, Services, Apps, ...",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/verification/browser": {
Expand Down Expand Up @@ -3203,7 +3203,7 @@
}
},
"summary": "Initialize Verification Flow for Browser Clients",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/self-service/verification/flows": {
Expand Down Expand Up @@ -3272,7 +3272,7 @@
}
},
"summary": "Get Verification Flow",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/sessions/whoami": {
Expand Down Expand Up @@ -3332,7 +3332,7 @@
}
},
"summary": "Check Who the Current HTTP Session Belongs To",
"tags": ["v0alpha1"]
"tags": ["v0alpha2"]
}
},
"/version": {
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/self-service.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -640,9 +640,9 @@ snippet:
```tsx
import React, { useState, useEffect } from 'react'
import { Text, TextInput, View } from 'react-native'
import { Configuration, V0alpha1Api, LoginFlow } from '@ory/kratos-client'
import { Configuration, V0alpha2Api, LoginFlow } from '@ory/kratos-client'

const kratos = new V0alpha1Api(
const kratos = new V0alpha2Api(
new Configuration({ basePath: 'https://playground.projects.oryapis.com/api/kratos/public' })
)

Expand Down
2 changes: 0 additions & 2 deletions driver/registry_default_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package driver

import (
"context"
"fmt"

"github.com/ory/kratos/driver/config"
"github.com/ory/kratos/selfservice/flow/settings"
Expand Down Expand Up @@ -67,7 +66,6 @@ func (m *RegistryDefault) SettingsFlowErrorHandler() *settings.ErrorHandler {
func (m *RegistryDefault) SettingsStrategies(ctx context.Context) (profileStrategies settings.Strategies) {
for _, strategy := range m.selfServiceStrategies() {
if s, ok := strategy.(settings.Strategy); ok {
fmt.Printf("Strategy %s is %v\n\n", s.SettingsStrategyID(), m.Config(ctx).SelfServiceStrategy(s.SettingsStrategyID()).Enabled)
if m.Config(ctx).SelfServiceStrategy(s.SettingsStrategyID()).Enabled {
profileStrategies = append(profileStrategies, s)
}
Expand Down
2 changes: 1 addition & 1 deletion examples/go/identity/create/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var client = pkg.NewSDK("playground")
func createIdentity() *ory.Identity {
ctx := context.Background()

identity, res, err := client.V0alpha1Api.AdminCreateIdentity(ctx).
identity, res, err := client.V0alpha2Api.AdminCreateIdentity(ctx).
AdminCreateIdentityBody(ory.AdminCreateIdentityBody{
SchemaId: "default",
Traits: map[string]interface{}{
Expand Down
2 changes: 1 addition & 1 deletion examples/go/identity/delete/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func deleteIdentity() {

identity := pkg.CreateIdentity(client)

res, err := client.V0alpha1Api.AdminDeleteIdentity(ctx, identity.Id).Execute()
res, err := client.V0alpha2Api.AdminDeleteIdentity(ctx, identity.Id).Execute()
pkg.SDKExitOnError(err, res)
}

Expand Down
2 changes: 1 addition & 1 deletion examples/go/identity/get/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func getIdentity() *ory.Identity {
ctx := context.Background()
created := pkg.CreateIdentity(client)

identity, res, err := client.V0alpha1Api.AdminGetIdentity(ctx, created.Id).Execute()
identity, res, err := client.V0alpha2Api.AdminGetIdentity(ctx, created.Id).Execute()
pkg.SDKExitOnError(err, res)

return identity
Expand Down

0 comments on commit 3f06738

Please sign in to comment.