Skip to content

Commit

Permalink
chore: align internal SDK with published SDK (#4019)
Browse files Browse the repository at this point in the history
  • Loading branch information
zepatrik authored Jul 31, 2024
1 parent 014be39 commit 4fb28b3
Show file tree
Hide file tree
Showing 55 changed files with 1,631 additions and 1,631 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ sdk: .bin/swagger .bin/ory node_modules
--git-user-id ory \
--git-repo-id client-go \
--git-host github.com \
--api-name-suffix "Api" \
--api-name-suffix "API" \
-t .schema/openapi/templates/go \
-c .schema/openapi/gen.go.yml

Expand All @@ -139,7 +139,7 @@ sdk: .bin/swagger .bin/ory node_modules
--git-user-id ory \
--git-repo-id client-go \
--git-host github.com \
--api-name-suffix "Api" \
--api-name-suffix "API" \
-t .schema/openapi/templates/go \
-c .schema/openapi/gen.go.yml

Expand Down
2 changes: 1 addition & 1 deletion cmd/identities/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func NewDeleteIdentityCmd() *cobra.Command {
)

for _, a := range args {
_, err := c.IdentityApi.DeleteIdentity(cmd.Context(), a).Execute()
_, err := c.IdentityAPI.DeleteIdentity(cmd.Context(), a).Execute()
if err != nil {
failed[a] = cmdx.PrintOpenAPIError(cmd, 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 @@ -66,7 +66,7 @@ func NewGetIdentityCmd() *cobra.Command {
identities := make([]kratos.Identity, 0, len(args))
failed := make(map[string]error)
for _, id := range args {
identity, _, err := c.IdentityApi.
identity, _, err := c.IdentityAPI.
GetIdentity(cmd.Context(), id).
IncludeCredential(includeCreds).
Execute()
Expand Down
2 changes: 1 addition & 1 deletion cmd/identities/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Files can contain only a single or an array of identities. The validity of files
return cmdx.FailSilently(cmd)
}

ident, _, err := c.IdentityApi.CreateIdentity(cmd.Context()).CreateIdentityBody(params).Execute()
ident, _, err := c.IdentityAPI.CreateIdentity(cmd.Context()).CreateIdentityBody(params).Execute()
if err != nil {
failed[src] = cmdx.PrintOpenAPIError(cmd, 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 @@ -43,7 +43,7 @@ Eventual consistency means that the list operation will return faster and might
}

consistency := flagx.MustGetString(cmd, "consistency")
req := c.IdentityApi.ListIdentities(cmd.Context()).Consistency(consistency)
req := c.IdentityAPI.ListIdentities(cmd.Context()).Consistency(consistency)
page, perPage, err := cmdx.ParseTokenPaginationArgs(cmd)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/identities/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,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.IdentityApi.GetIdentitySchema(ctx, id).Execute()
return c.IdentityAPI.GetIdentitySchema(ctx, id).Execute()
})
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions cmd/remote/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ var statusCmd = &cobra.Command{
state := &statusState{}
defer cmdx.PrintRow(cmd, state)

alive, _, err := c.MetadataApi.IsAlive(cmd.Context()).Execute()
alive, _, err := c.MetadataAPI.IsAlive(cmd.Context()).Execute()
if err != nil {
return err
}

state.Alive = alive.Status == "ok"

ready, _, err := c.MetadataApi.IsReady(cmd.Context()).Execute()
ready, _, err := c.MetadataAPI.IsReady(cmd.Context()).Execute()
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/remote/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var versionCmd = &cobra.Command{
return err
}

resp, _, err := c.MetadataApi.GetVersion(cmd.Context()).Execute()
resp, _, err := c.MetadataAPI.GetVersion(cmd.Context()).Execute()
if err != nil {
return err
}
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 @@ -19,7 +19,7 @@ var client = pkg.NewSDK("playground")
func createIdentity() *ory.Identity {
ctx := context.Background()

identity, res, err := client.IdentityApi.CreateIdentity(ctx).
identity, res, err := client.IdentityAPI.CreateIdentity(ctx).
CreateIdentityBody(ory.CreateIdentityBody{
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 @@ -20,7 +20,7 @@ func deleteIdentity() {

identity := pkg.CreateIdentity(client)

res, err := client.IdentityApi.DeleteIdentity(ctx, identity.Id).Execute()
res, err := client.IdentityAPI.DeleteIdentity(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 @@ -19,7 +19,7 @@ func getIdentity() *ory.Identity {
ctx := context.Background()
created := pkg.CreateIdentity(client)

identity, res, err := client.IdentityApi.GetIdentity(ctx, created.Id).IncludeCredential([]string{"password"}).Execute()
identity, res, err := client.IdentityAPI.GetIdentity(ctx, created.Id).IncludeCredential([]string{"password"}).Execute()
pkg.SDKExitOnError(err, res)

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

identity, res, err := client.IdentityApi.UpdateIdentity(ctx, toUpdate.Id).UpdateIdentityBody(ory.UpdateIdentityBody{
identity, res, err := client.IdentityAPI.UpdateIdentity(ctx, toUpdate.Id).UpdateIdentityBody(ory.UpdateIdentityBody{
Traits: map[string]interface{}{
"email": "dev+not-" + x.NewUUID().String() + "@ory.sh",
},
Expand Down
6 changes: 3 additions & 3 deletions examples/go/pkg/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ func CreateIdentityWithSession(c *ory.APIClient, email, password string) (*ory.S
}

// Initialize a registration flow
flow, _, err := c.FrontendApi.CreateNativeRegistrationFlow(ctx).Execute()
flow, _, err := c.FrontendAPI.CreateNativeRegistrationFlow(ctx).Execute()
ExitOnError(err)

// Submit the registration flow
result, res, err := c.FrontendApi.UpdateRegistrationFlow(ctx).Flow(flow.Id).UpdateRegistrationFlowBody(
result, res, err := c.FrontendAPI.UpdateRegistrationFlow(ctx).Flow(flow.Id).UpdateRegistrationFlowBody(
ory.UpdateRegistrationFlowWithPasswordMethodAsUpdateRegistrationFlowBody(&ory.UpdateRegistrationFlowWithPasswordMethod{
Method: "password",
Password: password,
Expand All @@ -56,7 +56,7 @@ func CreateIdentity(c *ory.APIClient) *ory.Identity {
ctx := context.Background()

email, _ := RandomCredentials()
identity, _, err := c.IdentityApi.CreateIdentity(ctx).CreateIdentityBody(ory.CreateIdentityBody{
identity, _, err := c.IdentityAPI.CreateIdentity(ctx).CreateIdentityBody(ory.CreateIdentityBody{
SchemaId: "default",
Traits: map[string]interface{}{
"email": email,
Expand Down
2 changes: 1 addition & 1 deletion examples/go/selfservice/error/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
var client = pkg.NewSDK("playground")

func getError() *ory.FlowError {
e, res, err := client.FrontendApi.GetFlowError(context.Background()).Id("stub:500").Execute()
e, res, err := client.FrontendAPI.GetFlowError(context.Background()).Id("stub:500").Execute()
pkg.SDKExitOnError(err, res)
return e
}
Expand Down
4 changes: 2 additions & 2 deletions examples/go/selfservice/login/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ func performLogin() *ory.SuccessfulNativeLogin {
_, _ = pkg.CreateIdentityWithSession(client, email, password)

// Initialize the flow
flow, res, err := client.FrontendApi.CreateNativeLoginFlow(ctx).Execute()
flow, res, err := client.FrontendAPI.CreateNativeLoginFlow(ctx).Execute()
pkg.SDKExitOnError(err, res)

// If you want, print the flow here:
//
// pkg.PrintJSONPretty(flow)

// Submit the form
result, res, err := client.FrontendApi.UpdateLoginFlow(ctx).Flow(flow.Id).UpdateLoginFlowBody(
result, res, err := client.FrontendAPI.UpdateLoginFlow(ctx).Flow(flow.Id).UpdateLoginFlowBody(
ory.UpdateLoginFlowWithPasswordMethodAsUpdateLoginFlowBody(&ory.UpdateLoginFlowWithPasswordMethod{
Method: "password",
Password: password,
Expand Down
2 changes: 1 addition & 1 deletion examples/go/selfservice/logout/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func performLogout() {
_, sessionToken := pkg.CreateIdentityWithSession(client, email, password)

// Log out using session token
res, err := client.FrontendApi.PerformNativeLogout(context.Background()).
res, err := client.FrontendAPI.PerformNativeLogout(context.Background()).
PerformNativeLogoutBody(ory.PerformNativeLogoutBody{SessionToken: sessionToken}).Execute()
pkg.SDKExitOnError(err, res)
}
Expand Down
4 changes: 2 additions & 2 deletions examples/go/selfservice/recovery/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ func performRecovery(email string) *ory.RecoveryFlow {
ctx := context.Background()

// Initialize the flow
flow, res, err := client.FrontendApi.CreateNativeRecoveryFlow(ctx).Execute()
flow, res, err := client.FrontendAPI.CreateNativeRecoveryFlow(ctx).Execute()
pkg.SDKExitOnError(err, res)

// If you want, print the flow here:
//
// pkg.PrintJSONPretty(flow)

// Submit the form
afterSubmit, res, err := client.FrontendApi.UpdateRecoveryFlow(ctx).Flow(flow.Id).
afterSubmit, res, err := client.FrontendAPI.UpdateRecoveryFlow(ctx).Flow(flow.Id).
UpdateRecoveryFlowBody(ory.UpdateRecoveryFlowWithLinkMethodAsUpdateRecoveryFlowBody(&ory.UpdateRecoveryFlowWithLinkMethod{
Email: email,
Method: "link",
Expand Down
4 changes: 2 additions & 2 deletions examples/go/selfservice/registration/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func initRegistration() *ory.SuccessfulNativeRegistration {
ctx := context.Background()

// Initialize the flow
flow, res, err := client.FrontendApi.CreateNativeRegistrationFlow(ctx).Execute()
flow, res, err := client.FrontendAPI.CreateNativeRegistrationFlow(ctx).Execute()
pkg.SDKExitOnError(err, res)

// If you want, print the flow here:
Expand All @@ -30,7 +30,7 @@ func initRegistration() *ory.SuccessfulNativeRegistration {
email, password := pkg.RandomCredentials()

// Submit the registration flow
result, res, err := client.FrontendApi.UpdateRegistrationFlow(ctx).Flow(flow.Id).UpdateRegistrationFlowBody(
result, res, err := client.FrontendAPI.UpdateRegistrationFlow(ctx).Flow(flow.Id).UpdateRegistrationFlowBody(
ory.UpdateRegistrationFlowWithPasswordMethodAsUpdateRegistrationFlowBody(&ory.UpdateRegistrationFlowWithPasswordMethod{
Method: "password",
Password: password,
Expand Down
6 changes: 3 additions & 3 deletions examples/go/selfservice/settings/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func initFlow(email, password string) (string, *ory.SettingsFlow) {
// Create a temporary user
_, sessionToken := pkg.CreateIdentityWithSession(client, email, password)

flow, res, err := client.FrontendApi.CreateNativeSettingsFlow(context.Background()).XSessionToken(sessionToken).Execute()
flow, res, err := client.FrontendAPI.CreateNativeSettingsFlow(context.Background()).XSessionToken(sessionToken).Execute()
pkg.SDKExitOnError(err, res)

// If you want, print the flow here:
Expand All @@ -36,7 +36,7 @@ func changePassword(email, password string) *ory.SettingsFlow {
sessionToken, flow := initFlow(email, password)

// Submit the form
result, res, err := client.FrontendApi.UpdateSettingsFlow(ctx).Flow(flow.Id).XSessionToken(sessionToken).UpdateSettingsFlowBody(
result, res, err := client.FrontendAPI.UpdateSettingsFlow(ctx).Flow(flow.Id).XSessionToken(sessionToken).UpdateSettingsFlowBody(
ory.UpdateSettingsFlowWithPasswordMethodAsUpdateSettingsFlowBody(&ory.UpdateSettingsFlowWithPasswordMethod{
Method: "password",
Password: "not-" + password,
Expand All @@ -51,7 +51,7 @@ func changeTraits(email, password string) *ory.SettingsFlow {
sessionToken, flow := initFlow(email, password)

// Submit the form
result, res, err := client.FrontendApi.UpdateSettingsFlow(ctx).Flow(flow.Id).XSessionToken(sessionToken).UpdateSettingsFlowBody(
result, res, err := client.FrontendAPI.UpdateSettingsFlow(ctx).Flow(flow.Id).XSessionToken(sessionToken).UpdateSettingsFlowBody(
ory.UpdateSettingsFlowWithProfileMethodAsUpdateSettingsFlowBody(&ory.UpdateSettingsFlowWithProfileMethod{
Method: "profile",
Traits: map[string]interface{}{
Expand Down
4 changes: 2 additions & 2 deletions examples/go/selfservice/verification/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ func performVerification(email string) *ory.VerificationFlow {
ctx := context.Background()

// Initialize the flow
flow, res, err := client.FrontendApi.CreateNativeVerificationFlow(ctx).Execute()
flow, res, err := client.FrontendAPI.CreateNativeVerificationFlow(ctx).Execute()
pkg.SDKExitOnError(err, res)

// If you want, print the flow here:
//
// pkg.PrintJSONPretty(flow)

// Submit the form
afterSubmit, res, err := client.FrontendApi.UpdateVerificationFlow(ctx).Flow(flow.Id).
afterSubmit, res, err := client.FrontendAPI.UpdateVerificationFlow(ctx).Flow(flow.Id).
UpdateVerificationFlowBody(ory.UpdateVerificationFlowWithLinkMethodAsUpdateVerificationFlowBody(&ory.UpdateVerificationFlowWithLinkMethod{
Email: email,
Method: "link",
Expand Down
2 changes: 1 addition & 1 deletion examples/go/session/tosession/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func toSession() *ory.Session {
email, password := pkg.RandomCredentials()
_, sessionToken := pkg.CreateIdentityWithSession(client, email, password)

session, res, err := client.FrontendApi.ToSessionExecute(ory.FrontendApiApiToSessionRequest{}.
session, res, err := client.FrontendAPI.ToSessionExecute(ory.FrontendAPIApiToSessionRequest{}.
XSessionToken(sessionToken))
pkg.SDKExitOnError(err, res)
return session
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ require (
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe
github.com/ory/analytics-go/v5 v5.0.1
github.com/ory/client-go v0.2.0-alpha.60
github.com/ory/client-go v1.14.3
github.com/ory/dockertest/v3 v3.10.1-0.20240704115616-d229e74b748d
github.com/ory/go-acc v0.2.9-0.20230103102148-6b1c9a70dbbe
github.com/ory/graceful v0.1.4-0.20230301144740-e222150c51d0
Expand Down
8 changes: 4 additions & 4 deletions internal/client-go/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ docs/ContinueWithSettingsUi.md
docs/ContinueWithSettingsUiFlow.md
docs/ContinueWithVerificationUi.md
docs/ContinueWithVerificationUiFlow.md
docs/CourierApi.md
docs/CourierAPI.md
docs/CourierMessageStatus.md
docs/CourierMessageType.md
docs/CreateIdentityBody.md
Expand All @@ -33,13 +33,13 @@ docs/ErrorBrowserLocationChangeRequired.md
docs/ErrorFlowReplaced.md
docs/ErrorGeneric.md
docs/FlowError.md
docs/FrontendApi.md
docs/FrontendAPI.md
docs/GenericError.md
docs/GetVersion200Response.md
docs/HealthNotReadyStatus.md
docs/HealthStatus.md
docs/Identity.md
docs/IdentityApi.md
docs/IdentityAPI.md
docs/IdentityCredentials.md
docs/IdentityCredentialsCode.md
docs/IdentityCredentialsOidc.md
Expand All @@ -62,7 +62,7 @@ docs/LoginFlowState.md
docs/LogoutFlow.md
docs/Message.md
docs/MessageDispatch.md
docs/MetadataApi.md
docs/MetadataAPI.md
docs/NeedsPrivilegedSessionError.md
docs/OAuth2Client.md
docs/OAuth2ConsentRequestOpenIDConnectContext.md
Expand Down
Loading

0 comments on commit 4fb28b3

Please sign in to comment.